4#include "Stroika/Foundation/StroikaPreComp.h"
6DISABLE_COMPILER_MSC_WARNING_START (5054)
8DISABLE_COMPILER_MSC_WARNING_END (5054)
19 template <
class EnumType,
class CollType>
20 HRESULT CreateSTLEnumerator (IUnknown** ppUnk, IUnknown* pUnkForRelease, CollType& collection)
26 CComObject<EnumType>* pEnum = NULL;
27 HRESULT hr = CComObject<EnumType>::CreateInstance (&pEnum);
32 hr = pEnum->Init (pUnkForRelease, collection);
35 hr = pEnum->QueryInterface (ppUnk);
45 size_t DoFindIndex (vector<CComPtr<IDispatch>>* list, VARIANT eltIntNameOrObj)
47 CComVariant e2r (eltIntNameOrObj);
48 if (SUCCEEDED (e2r.ChangeType (VT_UI4))) {
49 size_t idx = e2r.ulVal;
50 if (idx >= list->size ()) {
55 else if (SUCCEEDED (e2r.ChangeType (VT_DISPATCH))) {
56 for (vector<CComPtr<IDispatch>>::iterator i = list->begin (); i != list->end (); ++i) {
57 if ((*i).p == e2r.pdispVal) {
58 return i - list->begin ();
68 struct STL_ATL_COPY_VARIANT_IDISPATCH {
69 static HRESULT copy (VARIANT* p1,
const ATL::CComPtr<IDispatch>* p2)
71 if (p2 != NULL and *p2 != NULL) {
83 static void init (VARIANT* p)
87 static void destroy (VARIANT* p)
95 void DoEnableDisableChecksEtcsOnMenu (CComPtr<IDispatch> al, HMENU menu)
97 UINT itemCount = ::GetMenuItemCount (menu);
98 for (UINT i = 0; i < itemCount; ++i) {
99 UINT itemID = ::GetMenuItemID (menu, i);
102 MENUITEMINFO menuItemInfo;
103 memset (&menuItemInfo, 0,
sizeof (menuItemInfo));
104 menuItemInfo.cbSize =
sizeof (menuItemInfo);
105 Verify (::GetMenuItemInfo (menu, i,
true, &menuItemInfo));
106 if (menuItemInfo.hSubMenu != NULL) {
107 DoEnableDisableChecksEtcsOnMenu (al, menuItemInfo.hSubMenu);
111 wstring cmdName = CmdNum2Name (itemID);
113 CComVariant cmdNameCCV = cmdName.c_str ();
116 ::EnableMenuItem (menu, i, MF_BYPOSITION | (result.boolVal ? MF_ENABLED : MF_GRAYED));
118 cmdNameCCV = cmdName.c_str ();
121 ::CheckMenuItem (menu, i, MF_BYPOSITION | (result.boolVal ? MF_CHECKED : MF_UNCHECKED));
132ActiveLedIt_IconButtonToolbarElement::ActiveLedIt_IconButtonToolbarElement ()
135 , fPressedOnClick (false)
137 , fIconButtonStyle (eIconButton_PushButton)
138 , fOwningToolbar (NULL)
139 , fOwningActiveLedIt (NULL)
144ActiveLedIt_IconButtonToolbarElement::~ActiveLedIt_IconButtonToolbarElement ()
148HRESULT ActiveLedIt_IconButtonToolbarElement::FinalConstruct ()
153void ActiveLedIt_IconButtonToolbarElement::FinalRelease ()
157LRESULT ActiveLedIt_IconButtonToolbarElement::OnLButtonDown ([[maybe_unused]] UINT uMsg, [[maybe_unused]] WPARAM wParam,
158 [[maybe_unused]] LPARAM lParam, BOOL& bHandled)
162 switch (fIconButtonStyle) {
163 case eIconButton_Sticky:
164 case eIconButton_Toggle: {
165 if (IsWindowEnabled ()) {
166 bool wasPushed = !!(SendMessage (BM_GETSTATE) & BST_PUSHED);
167 fPressedOnClick = wasPushed;
168 if (fIconButtonStyle == eIconButton_Sticky) {
169 SendMessage (BM_SETSTATE, BST_PUSHED);
172 SendMessage (BM_SETSTATE, wasPushed ? 0 : BST_PUSHED);
174 SendMessage (GetParent (), WM_COMMAND, MAKEWPARAM (GetWindowLong (GWL_ID), BN_CLICKED),
reinterpret_cast<LPARAM
> (m_hWnd));
179 case eIconButton_Popup: {
180 CComPtr<IDispatch> oal = fOwningActiveLedIt;
181 CComPtr<IALAcceleratorTable> accelerators;
185 if (SUCCEEDED (accel.ChangeType (VT_DISPATCH))) {
186 accelerators = CComQIPtr<IALAcceleratorTable> (accel.pdispVal);
189 if (SUCCEEDED (fCommand.ChangeType (VT_DISPATCH))) {
190 CComQIPtr<IALCommandList> cm = fCommand.pdispVal;
193 if (SUCCEEDED (cm->GeneratePopupMenu (accelerators, &mH))) {
197 DoEnableDisableChecksEtcsOnMenu (oal, mH);
199 ::TrackPopupMenu (mH, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, wr.left, wr.bottom, 0, m_hWnd, NULL);
201 wstring cmdName = CmdNum2Name (cmdNum);
202 if (cmdName.length () != 0) {
203 CComVariant cmdNameCCV = cmdName.c_str ();
220 return DefWindowProc ();
230LRESULT ActiveLedIt_IconButtonToolbarElement::OnLButtonUp ([[maybe_unused]] UINT uMsg, [[maybe_unused]] WPARAM wParam,
231 [[maybe_unused]] LPARAM lParam, BOOL& bHandled)
237 LRESULT lr = DefWindowProc ();
239 CComPtr<IDispatch> oal = fOwningActiveLedIt;
243 HWND controlHWND =
reinterpret_cast<HWND
> (res.iVal);
244 ::SetFocus (controlHWND);
253LRESULT ActiveLedIt_IconButtonToolbarElement::OnMouseMove ([[maybe_unused]] UINT uMsg, [[maybe_unused]] WPARAM wParam, LPARAM lParam, BOOL& bHandled)
255 if (GetCapture () == m_hWnd and fIconButtonStyle == eIconButton_PushButton) {
256#define MY_GET_X_LPARAM(lp) ((int)(short)LOWORD (lp))
257#define MY_GET_Y_LPARAM(lp) ((int)(short)HIWORD (lp))
260 bool clickedInside = (AsLedRect (cr).Contains (Led_Point (MY_GET_Y_LPARAM (lParam), MY_GET_X_LPARAM (lParam))));
261 bool newPressed = clickedInside ? not fPressedOnClick : fPressedOnClick;
262 SendMessage (BM_SETSTATE, newPressed ? BST_PUSHED : 0);
264 return DefWindowProc ();
265#undef MY_GET_X_LPARAM
266#undef MY_GET_Y_LPARAM
271STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_PreferredHeight (UINT* pVal)
273 const DistanceType kBorderSize = 3;
278 if (fButtonImage.p == NULL) {
279 *pVal = kBorderSize * 2;
282 OLE_XSIZE_HIMETRIC height = 0;
288 ::memset (&pixSize, 0,
sizeof (pixSize));
289 AtlHiMetricToPixel (&hmSize, &pixSize);
290 *pVal = pixSize.cy + 2 * kBorderSize;
293 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
296STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_PreferredWidth (UINT* pVal)
298 const DistanceType kBorderSize = 3;
303 if (fButtonImage.p == NULL) {
304 *pVal = kBorderSize * 2;
307 OLE_XSIZE_HIMETRIC width = 0;
313 ::memset (&pixSize, 0,
sizeof (pixSize));
314 AtlHiMetricToPixel (&hmSize, &pixSize);
315 *pVal = pixSize.cx + kBorderSize * 2;
318 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
321STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_X (INT* pVal)
327 *pVal = fBounds.left;
330 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
333STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_Y (INT* pVal)
342 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
345STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_Width (UINT* pVal)
351 *pVal = fBounds.GetWidth ();
354 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
357STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_Height (UINT* pVal)
363 *pVal = fBounds.GetHeight ();
366 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
369STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::SetRectangle (
int X,
int Y, UINT width, UINT height)
372 if (m_hWnd != NULL) {
373 fBounds = Led_Rect (Y, X, height, width);
374 MoveWindow (X, Y, width, height);
378 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
381STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::NotifyOfOwningToolbar (IDispatch* owningToolbar, IDispatch* owningActiveLedIt)
384 if (fOwningToolbar != owningToolbar or fOwningActiveLedIt != owningActiveLedIt) {
385 if (m_hWnd != NULL) {
389 fOwningToolbar = owningToolbar;
390 fOwningActiveLedIt = owningActiveLedIt;
392 if (fOwningToolbar != NULL) {
393 RECT r = AsRECT (fBounds);
396 CComQIPtr<IALToolbar> otb = fOwningToolbar;
401 Create (parentHWND, &r, NULL, WS_CHILD | WS_VISIBLE, 0, itemID);
406 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
410STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::UpdateEnableState ()
413 if (m_hWnd != NULL) {
414 bool enabled =
false;
415 if (fOwningActiveLedIt != NULL) {
416 CComPtr<IDispatch> al = fOwningActiveLedIt;
417 if (fIconButtonStyle == eIconButton_Popup) {
422 CComVariant cmdCCV = fCommand;
425 enabled = !!result.boolVal;
428 EnableWindow (enabled);
429 if (fIconButtonStyle == eIconButton_Toggle or fIconButtonStyle == eIconButton_Sticky) {
430 bool checked =
false;
431 if (fOwningActiveLedIt != NULL) {
432 CComPtr<IDispatch> al = fOwningActiveLedIt;
434 CComVariant commandCCV = fCommand;
437 checked = !!result.boolVal;
439 SendMessage (BM_SETSTATE, checked ? BST_PUSHED : 0);
444 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
447STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_ButtonImage (IDispatch** pVal)
453 *pVal = CComQIPtr<IDispatch> (fButtonImage);
459 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
462STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::put_ButtonImage (IDispatch* val)
467 if (fButtonImage.p == NULL and val != NULL) {
468 DumpSupportedInterfaces (val,
"SUP INTERFACES FOR JSCRIPT IMAGE");
474 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
477STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_Command (VARIANT* pVal)
483 CComVariant{fCommand}.Detach (pVal);
486 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
489STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::put_Command (VARIANT val)
492 fCommand = CComVariant{val};
493 CheckFixButtonStyle ();
497 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
500STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::get_ButtonStyle (IconButtonStyle* pVal)
506 *pVal = fIconButtonStyle;
509 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
512STDMETHODIMP ActiveLedIt_IconButtonToolbarElement::put_ButtonStyle (IconButtonStyle val)
515 fIconButtonStyle = val;
516 CheckFixButtonStyle ();
520 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
523void ActiveLedIt_IconButtonToolbarElement::UpdateButtonObj ()
525 if (m_hWnd != NULL) {
526 if (fButtonImage.p == NULL) {
527 (void)SendMessage (BM_SETIMAGE, IMAGE_ICON, NULL);
528 (void)SendMessage (BM_SETIMAGE, IMAGE_BITMAP, NULL);
533 OLE_HANDLE pictHandle = NULL;
536 case PICTYPE_BITMAP: {
537 SetWindowLong (GWL_STYLE, (GetWindowLong (GWL_STYLE) & ~BS_ICON) | BS_BITMAP);
538 (void)SendMessage (BM_SETIMAGE, IMAGE_BITMAP, pictHandle);
541 SetWindowLong (GWL_STYLE, (GetWindowLong (GWL_STYLE) & ~BS_BITMAP) | BS_ICON);
542 (void)SendMessage (BM_SETIMAGE, IMAGE_ICON, pictHandle);
545 (void)SendMessage (BM_SETIMAGE, IMAGE_ICON, NULL);
550 SetWindowLong (GWL_ID, CmdObjOrName2Num (fCommand));
554void ActiveLedIt_IconButtonToolbarElement::CheckFixButtonStyle ()
556 CComVariant c = fCommand;
557 if (SUCCEEDED (c.ChangeType (VT_DISPATCH))) {
558 CComQIPtr<IALCommandList> alc = c.pdispVal;
560 if (fIconButtonStyle == eIconButton_Popup) {
561 fIconButtonStyle = eIconButton_PushButton;
565 fIconButtonStyle = eIconButton_Popup;
569 if (fIconButtonStyle == eIconButton_Popup) {
570 fIconButtonStyle = eIconButton_PushButton;
580ActiveLedIt_ComboBoxToolbarElement::ActiveLedIt_ComboBoxToolbarElement ()
581 : fDropDownActive (false)
584 , fPreferredWidth (100)
585 , fPressedOnClick (false)
587 , fCommandListCache ()
588 , fOwningToolbar (NULL)
589 , fOwningActiveLedIt (NULL)
594ActiveLedIt_ComboBoxToolbarElement::~ActiveLedIt_ComboBoxToolbarElement ()
598HRESULT ActiveLedIt_ComboBoxToolbarElement::FinalConstruct ()
603void ActiveLedIt_ComboBoxToolbarElement::FinalRelease ()
607LRESULT ActiveLedIt_ComboBoxToolbarElement::OnCBDropDown ([[maybe_unused]] USHORT uMsg, [[maybe_unused]] USHORT wParam,
608 [[maybe_unused]] HWND ctlHandle, BOOL& bHandled)
610 fDropDownActive =
true;
611 LRESULT lr = DefWindowProc ();
616LRESULT ActiveLedIt_ComboBoxToolbarElement::OnCBCloseUp ([[maybe_unused]] USHORT uMsg, [[maybe_unused]] USHORT wParam,
617 [[maybe_unused]] HWND ctlHandle, BOOL& bHandled)
619 fDropDownActive =
false;
623 LRESULT lr = DefWindowProc ();
625 CComPtr<IDispatch> oal = fOwningActiveLedIt;
629 HWND controlHWND =
reinterpret_cast<HWND
> (res.iVal);
630 ::SetFocus (controlHWND);
639LRESULT ActiveLedIt_ComboBoxToolbarElement::OnCBSelChange ([[maybe_unused]] USHORT uMsg, [[maybe_unused]] USHORT wParam,
640 [[maybe_unused]] HWND ctlHandle, BOOL& bHandled)
643 LRESULT lr = DefWindowProc ();
644 int r =
static_cast<int> (fComboBox.SendMessage (CB_GETCURSEL, 0, 0));
646 if (r >= 0 and
static_cast<size_t> (r) < fCommandListCache.size ()) {
647#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
648 CComQIPtr<IALCommand> alc = (IDispatch*)fCommandListCache[r];
650 CComQIPtr<IALCommand> alc = fCommandListCache[r];
652 CComBSTR internalName;
654 CComPtr<IDispatch> al = fOwningActiveLedIt;
655 CComVariant internalNameCCV = internalName;
664STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::get_PreferredHeight (UINT* pVal)
670 const DistanceType kWhiteSluff = 4;
671 *pVal = ::GetSystemMetrics (SM_CYVSCROLL) + kWhiteSluff;
674 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
677STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::get_PreferredWidth (UINT* pVal)
683 *pVal = fPreferredWidth;
686 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
689STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::get_X (INT* pVal)
695 *pVal = fBounds.left;
698 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
701STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::get_Y (INT* pVal)
710 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
713STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::get_Width (UINT* pVal)
719 *pVal = fBounds.GetWidth ();
722 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
725STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::get_Height (UINT* pVal)
731 *pVal = fBounds.GetHeight ();
734 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
737STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::SetRectangle (
int X,
int Y, UINT width, UINT height)
740 if (m_hWnd != NULL) {
741 fBounds = Led_Rect (Y, X, height, width);
742 MoveWindow (X, Y, width, height);
746 fComboBox.MoveWindow (&cr);
750 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
753STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::NotifyOfOwningToolbar (IDispatch* owningToolbar, IDispatch* owningActiveLedIt)
756 if (fOwningToolbar != owningToolbar or fOwningActiveLedIt != owningActiveLedIt) {
757 if (m_hWnd != NULL) {
761 fOwningToolbar = owningToolbar;
762 fOwningActiveLedIt = owningActiveLedIt;
764 if (fOwningToolbar != NULL) {
765 RECT r = AsRECT (fBounds);
768 CComQIPtr<IALToolbar> otb = fOwningToolbar;
772 Create (parentHWND, &r, NULL, WS_CHILD | WS_VISIBLE);
773 fComboBox.Create (_T(
"ComboBox"), m_hWnd, &r, NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST);
775 HFONT f =
reinterpret_cast<HFONT
> (::GetStockObject (DEFAULT_GUI_FONT));
776 fComboBox.SendMessage (WM_SETFONT,
reinterpret_cast<LPARAM
> (f),
true);
783 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
787STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::UpdateEnableState ()
790 if (m_hWnd != NULL and not fDropDownActive) {
792 bool enabled =
false;
793 size_t idxSelected = kBadIndex;
794 if (fOwningActiveLedIt != NULL) {
795 CComPtr<IDispatch> al = fOwningActiveLedIt;
796 for (vector<CComPtr<IALCommand>>::iterator i = fCommandListCache.begin (); i != fCommandListCache.end (); ++i) {
799#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
800 CComVariant alcmdCCV = (IDispatch*)*i;
802 CComVariant alcmdCCV = *i;
806 if (result.boolVal) {
812#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
813 CComVariant alcmdCCV = (IDispatch*)*i;
815 CComVariant alcmdCCV = *i;
819 if (result.boolVal) {
820 idxSelected = i - fCommandListCache.begin ();
825 fComboBox.EnableWindow (enabled);
826 if (idxSelected == kBadIndex) {
827 (void)fComboBox.SendMessage (CB_SETCURSEL,
static_cast<WPARAM
> (-1), 0);
830 Verify (fComboBox.SendMessage (CB_SETCURSEL,
static_cast<int> (idxSelected), 0) != CB_ERR);
835 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
838STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::get_CommandList (IDispatch** pVal)
844 *pVal = fCommandList;
850 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
853STDMETHODIMP ActiveLedIt_ComboBoxToolbarElement::put_CommandList (IDispatch* val)
858 CallInvalidateLayout ();
861 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
864void ActiveLedIt_ComboBoxToolbarElement::UpdatePopupObj ()
866 if (m_hWnd != NULL) {
870 (void)fComboBox.SendMessage (CB_RESETCONTENT, 0, 0);
871 fCommandListCache.clear ();
872#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
873 CComQIPtr<IALCommandList> cmdList = (IDispatch*)fCommandList;
875 CComQIPtr<IALCommandList> cmdList = fCommandList;
877 if (cmdList.p != NULL) {
880 HDC hdc = GetWindowDC ();
881 HGDIOBJ oldFont = ::SelectObject (hdc, ::GetStockObject (DEFAULT_GUI_FONT));
883 DistanceType maxItemWidth = 0;
884 for (
long i = 0; i < cmdCount; ++i) {
885 CComPtr<IDispatch> e;
887#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
888 CComQIPtr<IALCommand> alc = (IDispatch*)e;
890 CComQIPtr<IALCommand> alc = e;
894 fCommandListCache.push_back (alc);
896 Verify (fComboBox.SendMessage (CB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (itemPrintName.c_str ())) != CB_ERR);
898 memset (&sz, 0,
sizeof (sz));
899 ::GetTextExtentPoint32 (hdc, itemPrintName.c_str (),
static_cast<int> (itemPrintName.length ()), &sz);
900 maxItemWidth = max (maxItemWidth,
static_cast<DistanceType
> (sz.cx));
902 ::SelectObject (hdc, oldFont);
904 const DistanceType kMaxMax = 200;
905 maxItemWidth = min (maxItemWidth, kMaxMax);
906 const DistanceType kWhiteSluff = 6;
907 fPreferredWidth = 2 * ::GetSystemMetrics (SM_CXEDGE) + ::GetSystemMetrics (SM_CXVSCROLL) + maxItemWidth + kWhiteSluff;
910 ::SelectObject (hdc, oldFont);
918void ActiveLedIt_ComboBoxToolbarElement::CallInvalidateLayout ()
920 if (fOwningActiveLedIt != NULL) {
921 CComPtr<IDispatch> oal = fOwningActiveLedIt;
931ActiveLedIt_SeparatorToolbarElement::ActiveLedIt_SeparatorToolbarElement ()
936ActiveLedIt_SeparatorToolbarElement::~ActiveLedIt_SeparatorToolbarElement ()
940HRESULT ActiveLedIt_SeparatorToolbarElement::FinalConstruct ()
945void ActiveLedIt_SeparatorToolbarElement::FinalRelease ()
949STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::get_PreferredHeight (UINT* pVal)
958 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
961STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::get_PreferredWidth (UINT* pVal)
970 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
973STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::get_X (INT* pVal)
979 *pVal = fBounds.left;
982 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
985STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::get_Y (INT* pVal)
994 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
997STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::get_Width (UINT* pVal)
1001 return E_INVALIDARG;
1003 *pVal = fBounds.GetWidth ();
1006 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1009STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::get_Height (UINT* pVal)
1013 return E_INVALIDARG;
1015 *pVal = fBounds.GetHeight ();
1018 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1021STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::SetRectangle (
int X,
int Y, UINT width, UINT height)
1024 fBounds = Led_Rect (Y, X, height, width);
1027 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1030STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::NotifyOfOwningToolbar (IDispatch* , IDispatch* )
1035 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1038STDMETHODIMP ActiveLedIt_SeparatorToolbarElement::UpdateEnableState ()
1043 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1051ActiveLedIt_Toolbar::ActiveLedIt_Toolbar ()
1053 , fOwningActiveLedIt (NULL)
1054 , fOwningALToolbar (NULL)
1059ActiveLedIt_Toolbar::~ActiveLedIt_Toolbar ()
1063LRESULT ActiveLedIt_Toolbar::OnCommand ([[maybe_unused]] UINT uMsg, WPARAM wParam, [[maybe_unused]] LPARAM lParam, BOOL& bHandled)
1065 if (!HIWORD (wParam)) {
1066 if (fOwningActiveLedIt != NULL) {
1067 CComPtr<IDispatch> oal = fOwningActiveLedIt;
1068 wstring cmdName = CmdNum2Name (LOWORD (wParam));
1069 CComVariant cmdNameCCV = cmdName.c_str ();
1070 oal.Invoke1 (DISPID_InvokeCommand, &cmdNameCCV);
1077 LRESULT ActiveLedIt_Toolbar::OnPaint (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
1080 HDC hdc = ::BeginPaint (m_hWnd, &ps);
1083 Tablet tablet (hdc, Tablet::eDoesntOwnDC);
1084 Pen usePen (PS_SOLID, 1, Color::kBlack.GetOSRep ());
1085 GDI_Obj_Selector penSelector (&tablet, usePen);
1086 Led_Rect drawRect = Led_Rect (0, 0, fBounds.GetHeight (), fBounds.GetWidth ());
1087 if (m_hWnd != NULL) {
1089 ::GetClientRect (m_hWnd, &cr);
1090 drawRect = AsLedRect (cr);
1092 tablet.MoveTo (Led_Point (drawRect.GetBottom () - 1, drawRect.GetLeft ()));
1093 tablet.LineTo (Led_Point (drawRect.GetBottom () - 1, drawRect.GetRight ()));
1096 ::EndPaint (m_hWnd, &ps);
1099 ::EndPaint (m_hWnd, &ps);
1104void ActiveLedIt_Toolbar::CallInvalidateLayout ()
1106 if (fOwningActiveLedIt != NULL) {
1107 CComPtr<IDispatch> oal = fOwningActiveLedIt;
1112void ActiveLedIt_Toolbar::DoLayout ()
1115 Led_Rect clientBounds = Led_Rect (0, 0, fBounds.GetHeight (), fBounds.GetWidth ());
1117 Led_Rect clientBounds = Led_Rect (0, 0, max (
static_cast<CoordinateType
> (fBounds.GetHeight ()) - 2 * ::GetSystemMetrics (SM_CYEDGE), 0),
1118 max (
static_cast<CoordinateType
> (fBounds.GetHeight ()) - 2 * ::GetSystemMetrics (SM_CXEDGE), 0));
1122 if (m_hWnd != NULL) {
1124 ::GetClientRect (m_hWnd, &cr);
1125 clientBounds.bottom = max (clientBounds.bottom, cr.bottom);
1128 Led_Rect itemBoundsCursor = Led_Rect (clientBounds.GetTop (), clientBounds.GetLeft () + kHTBEdge, clientBounds.GetHeight (), 0);
1130 for (vector<CComPtr<IDispatch>>::iterator i = fToolbarItems.begin (); i != fToolbarItems.end (); ++i) {
1131#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1132 CComQIPtr<IALToolbarElement> tbi = (IDispatch*)*i;
1134 CComQIPtr<IALToolbarElement> tbi = *i;
1136 UINT preferredWidth = 0;
1138 UINT preferredHeight = 0;
1141 DistanceType useHeight = min (DistanceType (preferredHeight), itemBoundsCursor.GetHeight ());
1142 Led_Rect itemBounds = itemBoundsCursor;
1143 itemBounds.right = itemBounds.left + preferredWidth;
1144 itemBoundsCursor.right = itemBounds.right;
1145 itemBounds.bottom = itemBounds.top + useHeight;
1146 itemBounds = CenterRectInRect (itemBounds, itemBoundsCursor);
1147 tbi->SetRectangle (itemBounds.GetLeft (), itemBounds.GetTop (), itemBounds.GetWidth (), itemBounds.GetHeight ());
1149 itemBoundsCursor.left = itemBoundsCursor.right + kHSluff;
1150 itemBoundsCursor.right = itemBoundsCursor.left;
1154HRESULT ActiveLedIt_Toolbar::FinalConstruct ()
1156 IdleManager::Get ().AddEnterIdler (
this);
1160void ActiveLedIt_Toolbar::FinalRelease ()
1162 IdleManager::Get ().RemoveEnterIdler (
this);
1165void ActiveLedIt_Toolbar::OnEnterIdle ()
1168 for (vector<CComPtr<IDispatch>>::iterator i = fToolbarItems.begin (); i != fToolbarItems.end (); ++i) {
1169#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1170 CComQIPtr<IALToolbarElement> tbi = (IDispatch*)*i;
1172 CComQIPtr<IALToolbarElement> tbi = *i;
1181STDMETHODIMP ActiveLedIt_Toolbar::get__NewEnum (IUnknown** ppUnk)
1183 using VarVarEnum = CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, STL_ATL_COPY_VARIANT_IDISPATCH, std::vector<CComPtr<IDispatch>>>;
1185 if (ppUnk == NULL) {
1186 return E_INVALIDARG;
1188 return CreateSTLEnumerator<VarVarEnum> (ppUnk,
this, fToolbarItems);
1190 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1193STDMETHODIMP ActiveLedIt_Toolbar::get_Item (
long Index, IDispatch** pVal)
1197 return E_INVALIDARG;
1199 if (Index < 0 or
static_cast<size_t> (Index) >= fToolbarItems.size ()) {
1200 return E_INVALIDARG;
1202 *pVal = fToolbarItems[Index];
1205 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1209STDMETHODIMP ActiveLedIt_Toolbar::get_Count (
long* pVal)
1213 return E_INVALIDARG;
1215 *pVal =
static_cast<long> (fToolbarItems.size ());
1217 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1221STDMETHODIMP ActiveLedIt_Toolbar::Add (IDispatch* newElt, UINT atIndex)
1224 if (newElt == NULL) {
1225 return E_INVALIDARG;
1227 size_t idx = min (
static_cast<size_t> (atIndex), fToolbarItems.size ());
1228 fToolbarItems.insert (fToolbarItems.begin () + idx, newElt);
1229 if (fOwningActiveLedIt != NULL) {
1230 CComQIPtr<IALToolbarElement> tbe = newElt;
1233 CallInvalidateLayout ();
1235 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1239STDMETHODIMP ActiveLedIt_Toolbar::MergeAdd (IDispatch* newElts, UINT afterElt)
1242 if (newElts == NULL) {
1243 return E_INVALIDARG;
1245 size_t idx = min (
static_cast<size_t> (afterElt), fToolbarItems.size ());
1246 CComQIPtr<IALToolbar> alt = newElts;
1249 for (
long i = 0; i < nElts2Add; ++i) {
1250 CComPtr<IDispatch> e;
1252 fToolbarItems.insert (fToolbarItems.begin () + idx, e);
1253 if (fOwningActiveLedIt != NULL) {
1254#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1255 CComQIPtr<IALToolbarElement> tbe = (IDispatch*)e;
1257 CComQIPtr<IALToolbarElement> tbe = e;
1259 tbe->NotifyOfOwningToolbar (
this, fOwningActiveLedIt);
1263 CallInvalidateLayout ();
1265 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1269STDMETHODIMP ActiveLedIt_Toolbar::Remove (VARIANT eltIntNameOrIndex)
1272 size_t idx = DoFindIndex (&fToolbarItems, eltIntNameOrIndex);
1273 if (idx != kBadIndex) {
1274 return E_INVALIDARG;
1276 if (fOwningActiveLedIt != NULL) {
1277#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1278 CComQIPtr<IALToolbarElement> tbe = (IDispatch*)fToolbarItems[idx];
1280 CComQIPtr<IALToolbarElement> tbe = fToolbarItems[idx];
1284 fToolbarItems.erase (fToolbarItems.begin () + idx, fToolbarItems.begin () + idx + 1);
1285 CallInvalidateLayout ();
1288 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1291STDMETHODIMP ActiveLedIt_Toolbar::Clear ()
1294 if (fOwningActiveLedIt != NULL) {
1295 for (vector<CComPtr<IDispatch>>::iterator i = fToolbarItems.begin (); i != fToolbarItems.end (); ++i) {
1296#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1297 CComQIPtr<IALToolbarElement> tbe = (IDispatch*)*i;
1299 CComQIPtr<IALToolbarElement> tbe = *i;
1304 fToolbarItems.clear ();
1305 CallInvalidateLayout ();
1307 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1311STDMETHODIMP ActiveLedIt_Toolbar::get_hWnd (HWND* pVal)
1316 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1320STDMETHODIMP ActiveLedIt_Toolbar::get_PreferredHeight (UINT* pVal)
1324 return E_INVALIDARG;
1328 for (vector<CComPtr<IDispatch>>::iterator i = fToolbarItems.begin (); i != fToolbarItems.end (); ++i) {
1329#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1330 CComQIPtr<IALToolbarElement> tbi = (IDispatch*)*i;
1332 CComQIPtr<IALToolbarElement> tbi = *i;
1334 UINT preferredHeight = 0;
1336 maxHeight = max (maxHeight, preferredHeight);
1342 *pVal = maxHeight + 2 * kVInset;
1346 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1349STDMETHODIMP ActiveLedIt_Toolbar::get_PreferredWidth (UINT* pVal)
1353 return E_INVALIDARG;
1355 UINT totalPrefWidth = 0;
1356 for (vector<CComPtr<IDispatch>>::iterator i = fToolbarItems.begin (); i != fToolbarItems.end (); ++i) {
1357#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1358 CComQIPtr<IALToolbarElement> tbi = (IDispatch*)*i;
1360 CComQIPtr<IALToolbarElement> tbi = *i;
1362 UINT preferredWidth = 0;
1364 totalPrefWidth += preferredWidth;
1368 *pVal =
static_cast<UINT
> (totalPrefWidth + 2 * kHTBEdge + kHSluff * (fToolbarItems.size ()) + 2 * ::GetSystemMetrics (SM_CYEDGE));
1372 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1375STDMETHODIMP ActiveLedIt_Toolbar::NotifyOfOwningActiveLedIt (IDispatch* owningActiveLedIt, IDispatch* owningALToolbar)
1378 if (fOwningActiveLedIt != owningActiveLedIt or fOwningALToolbar != owningALToolbar) {
1379 if (m_hWnd != NULL) {
1383 fOwningActiveLedIt = owningActiveLedIt;
1384 fOwningALToolbar = owningALToolbar;
1386 if (fOwningActiveLedIt != NULL) {
1387 HWND parentHWND = 0;
1388 CComQIPtr<IALToolbarList> altbl = fOwningALToolbar;
1389 if (altbl.p != NULL) {
1392 RECT r = AsRECT (fBounds);
1393 Create (parentHWND, &r);
1396 for (vector<CComPtr<IDispatch>>::iterator i = fToolbarItems.begin (); i != fToolbarItems.end (); ++i) {
1397#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1398 CComQIPtr<IALToolbarElement> tbi = (IDispatch*)*i;
1400 CComQIPtr<IALToolbarElement> tbi = *i;
1402 tbi->NotifyOfOwningToolbar (owningActiveLedIt == NULL ? NULL : this, owningActiveLedIt);
1405 CallInvalidateLayout ();
1408 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1412STDMETHODIMP ActiveLedIt_Toolbar::SetRectangle (
int X,
int Y, UINT width, UINT height)
1415 fBounds = Led_Rect (Y, X, height, width);
1416 MoveWindow (X, Y, width, height);
1420 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1428ActiveLedIt_ToolbarList::ActiveLedIt_ToolbarList ()
1430 , fOwningActiveLedIt (NULL)
1435ActiveLedIt_ToolbarList::~ActiveLedIt_ToolbarList ()
1437 if (m_hWnd != NULL) {
1442HRESULT ActiveLedIt_ToolbarList::FinalConstruct ()
1447void ActiveLedIt_ToolbarList::FinalRelease ()
1451LRESULT ActiveLedIt_ToolbarList::OnPaint ([[maybe_unused]] UINT uMsg, [[maybe_unused]] WPARAM wParam, [[maybe_unused]] LPARAM lParam,
1452 [[maybe_unused]] BOOL& bHandled)
1455 HDC hdc = ::BeginPaint (m_hWnd, &ps);
1458 Tablet tablet (hdc, Tablet::eDoesntOwnDC);
1459 Pen usePen (PS_SOLID, 1, Color::kBlack.GetOSRep ());
1460 GDI_Obj_Selector penSelector (&tablet, usePen);
1461 Led_Rect drawRect = Led_Rect (0, 0, fBounds.GetHeight (), fBounds.GetWidth ());
1462 if (m_hWnd != NULL) {
1464 ::GetClientRect (m_hWnd, &cr);
1465 drawRect = AsLedRect (cr);
1467 tablet.MoveTo (Led_Point (drawRect.GetBottom () - 1, drawRect.GetLeft ()));
1468 tablet.LineTo (Led_Point (drawRect.GetBottom () - 1, drawRect.GetRight ()));
1471 ::EndPaint (m_hWnd, &ps);
1474 ::EndPaint (m_hWnd, &ps);
1479STDMETHODIMP ActiveLedIt_ToolbarList::get__NewEnum (IUnknown** ppUnk)
1481 using VarVarEnum = CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, STL_ATL_COPY_VARIANT_IDISPATCH, std::vector<CComPtr<IDispatch>>>;
1482 if (ppUnk == NULL) {
1483 return E_INVALIDARG;
1486 return CreateSTLEnumerator<VarVarEnum> (ppUnk,
this, fToolbars);
1488 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1491STDMETHODIMP ActiveLedIt_ToolbarList::get_Item (
long Index, IDispatch** pVal)
1494 return E_INVALIDARG;
1496 if (Index < 0 or
static_cast<size_t> (Index) >= fToolbars.size ()) {
1497 return E_INVALIDARG;
1500 *pVal = fToolbars[Index];
1503 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1507STDMETHODIMP ActiveLedIt_ToolbarList::get_Count (UINT* pVal)
1510 return E_INVALIDARG;
1513 *pVal =
static_cast<UINT
> (fToolbars.size ());
1515 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1519STDMETHODIMP ActiveLedIt_ToolbarList::Add (IDispatch* newElt, UINT atIndex)
1521 if (newElt == NULL) {
1522 return E_INVALIDARG;
1525 CComQIPtr<IALToolbar> tb = newElt;
1526 ThrowIfErrorHRESULT (tb->NotifyOfOwningActiveLedIt (fOwningActiveLedIt, fOwningActiveLedIt == NULL ? NULL : this));
1527 size_t idx = min (
static_cast<size_t> (atIndex), fToolbars.size ());
1528 fToolbars.insert (fToolbars.begin () + idx, newElt);
1529 CallInvalidateLayout ();
1531 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1535STDMETHODIMP ActiveLedIt_ToolbarList::Remove (VARIANT eltIntNameOrIndex)
1538 size_t idx = DoFindIndex (&fToolbars, eltIntNameOrIndex);
1539 if (idx != kBadIndex) {
1540 return E_INVALIDARG;
1542#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1543 CComQIPtr<IALToolbar> tb = (IDispatch*)fToolbars[idx];
1545 CComQIPtr<IALToolbar> tb = fToolbars[idx];
1548 fToolbars.erase (fToolbars.begin () + idx, fToolbars.begin () + idx + 1);
1549 CallInvalidateLayout ();
1552 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1555STDMETHODIMP ActiveLedIt_ToolbarList::Clear ()
1558 for (vector<CComPtr<IDispatch>>::iterator i = fToolbars.begin (); i != fToolbars.end (); ++i) {
1559#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1560 CComQIPtr<IALToolbar> tb = (IDispatch*)*i;
1562 CComQIPtr<IALToolbar> tb = *i;
1567 CallInvalidateLayout ();
1569 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1573void ActiveLedIt_ToolbarList::CallInvalidateLayout ()
1575 if (fOwningActiveLedIt != NULL) {
1576 CComPtr<IDispatch> oal = fOwningActiveLedIt;
1581STDMETHODIMP ActiveLedIt_ToolbarList::NotifyOfOwningActiveLedIt (IDispatch* owningActiveLedIt, HWND owningHWND)
1584 if (fOwningActiveLedIt != owningActiveLedIt) {
1585 if (m_hWnd != NULL) {
1589 fOwningActiveLedIt = owningActiveLedIt;
1591 if (fOwningActiveLedIt != NULL) {
1592 RECT r = AsRECT (fBounds);
1593 Create (owningHWND, &r, NULL, 0, WS_EX_CLIENTEDGE | WS_EX_WINDOWEDGE);
1596 for (vector<CComPtr<IDispatch>>::iterator i = fToolbars.begin (); i != fToolbars.end (); ++i) {
1597#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1598 CComQIPtr<IALToolbar> tb = (IDispatch*)*i;
1600 CComQIPtr<IALToolbar> tb = *i;
1602 ThrowIfErrorHRESULT (tb->NotifyOfOwningActiveLedIt (owningActiveLedIt, owningActiveLedIt == NULL ? NULL : this));
1604 CallInvalidateLayout ();
1607 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1611STDMETHODIMP ActiveLedIt_ToolbarList::get_hWnd (HWND* pVal)
1616 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1620STDMETHODIMP ActiveLedIt_ToolbarList::get_PreferredHeight (UINT* pVal)
1624 return E_INVALIDARG;
1627 UINT totalHeight = 0;
1628 for (vector<CComPtr<IDispatch>>::iterator i = fToolbars.begin (); i != fToolbars.end (); ++i) {
1629#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1630 CComQIPtr<IALToolbar> tb = (IDispatch*)*i;
1632 CComQIPtr<IALToolbar> tb = *i;
1634 UINT preferredHeight = 0;
1636 totalHeight += preferredHeight;
1640 if (fToolbars.size () > 0) {
1641 *pVal = totalHeight + kRoomForBotLine + 2 * ::GetSystemMetrics (SM_CYEDGE);
1650 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1653STDMETHODIMP ActiveLedIt_ToolbarList::get_PreferredWidth (UINT* pVal)
1657 return E_INVALIDARG;
1660 for (vector<CComPtr<IDispatch>>::iterator i = fToolbars.begin (); i != fToolbars.end (); ++i) {
1661#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1662 CComQIPtr<IALToolbar> tb = (IDispatch*)*i;
1664 CComQIPtr<IALToolbar> tb = *i;
1666 UINT preferredWidth = 0;
1668 maxWidth = max (maxWidth, preferredWidth);
1672 *pVal = maxWidth + 2 * ::GetSystemMetrics (SM_CYEDGE);
1676 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1679STDMETHODIMP ActiveLedIt_ToolbarList::SetRectangle (
int X,
int Y, UINT width, UINT height)
1682 fBounds = Led_Rect (Y, X, height, width);
1683 MoveWindow (X, Y, width, height);
1687 CATCH_AND_HANDLE_EXCEPTIONS_IN_HRESULT_FUNCTION ()
1690void ActiveLedIt_ToolbarList::DoLayout ()
1692 Led_Rect clientBounds =
1693 Led_Rect (0, 0, max (
static_cast<CoordinateType
> (fBounds.GetHeight ()) - 2 * ::GetSystemMetrics (SM_CYEDGE), CoordinateType (0)),
1694 max (
static_cast<CoordinateType
> (fBounds.GetWidth ()) - 2 * ::GetSystemMetrics (SM_CXEDGE), CoordinateType (0)));
1695 if (m_hWnd != NULL) {
1697 ::GetClientRect (m_hWnd, &cr);
1698 clientBounds.bottom = max (clientBounds.bottom, cr.bottom);
1701 Led_Rect itemBoundsCursor = clientBounds;
1702 for (vector<CComPtr<IDispatch>>::iterator i = fToolbars.begin (); i != fToolbars.end (); ++i) {
1703#if qCompilerAndStdLib_altComPtrCvt2ComQIPtrRequiresExtraCast_Buggy
1704 CComQIPtr<IALToolbar> tb = (IDispatch*)*i;
1706 CComQIPtr<IALToolbar> tb = *i;
1711 itemBoundsCursor.bottom = itemBoundsCursor.top + height;
1713 tb->SetRectangle (itemBoundsCursor.left, itemBoundsCursor.top, itemBoundsCursor.GetWidth (), itemBoundsCursor.GetHeight ()));
1714 itemBoundsCursor.top = itemBoundsCursor.bottom;
#define qStroika_Foundation_Debug_AssertionsChecked
The qStroika_Foundation_Debug_AssertionsChecked flag determines if assertions are checked and validat...
String is like std::u32string, except it is much easier to use, often much more space efficient,...
nonvirtual SDKString AsSDKString() const
basic_string< SDKChar > SDKString