/*********************************************************************\ Function name : CDialogCustomElement::CDialogCustomElement Description : Created at : 11.08.01, @ 17:19:05 Created by : Thomas Kunert Modified by : \*********************************************************************/ CDialogCustomElement::CDialogCustomElement(CDialogDoc* pDoc) { m_strName = GeLoadString(IDS_CUSTOM_ELEMENT); m_strDescr = m_strName; m_type = CustomElement; m_lFlags = BFH_LEFT | BFV_TOP; m_lInitW = 0; m_lInitH = 0; m_pDocument = pDoc; m_strControlID = CreateControlID(); m_pbcGUI = nullptr; m_pData = nullptr; CreateElementList(); if (g_pCustomElements) { m_lElement = (g_pCustomElements->Entries() > 0) ? 0 : -1; CCustomElements* pElement = g_pCustomElements->GetItem(m_lElement); m_strName += " [" + pElement->m_strName + "]"; m_strDescr += " [" + pElement->m_strName + "]"; } else m_lElement = -1; if (g_pCustomElements->Entries() > 0) { m_pbcGUI = bNewDeprecatedUseArraysInstead<BaseContainer>(g_pCustomElements->Entries()); m_pData = bNewDeprecatedUseArraysInstead<TriState<GeData>>(g_pCustomElements->Entries()); } }
/*********************************************************************\ Function name : CDialogGroup::CDialogGroup Description : Created at : 12.08.01, @ 09:17:45 Created by : Thomas Kunert Modified by : \*********************************************************************/ CDialogGroup::CDialogGroup(CDialogDoc* pDoc) { m_strName = GeLoadString(IDS_GROUP); m_strDescr = m_strName; m_type = Group; m_lFlags = BFH_LEFT | BFV_TOP; m_lInitW = 0; m_lInitH = 0; m_lBorderStyle = BORDER_NONE; m_bHasTitleCheckbox = false; m_bHasBorder = true; m_bBorderNoTitle = 0; m_lCols = m_lRows = 1; m_lGroupFlags = 0; m_lTabType = TAB_TABS; m_lScrollType = SCROLLGROUP_VERT | SCROLLGROUP_HORIZ; m_lGroupType = 0; // simple (1 : tab, 2 : scroll, 3 : radio) m_lLeftBorder = m_lRightBorder = m_lTopBorder = m_lBottomBorder = 0; m_lSpaceX = m_lSpaceY = -1; m_pDocument = pDoc; m_strControlID = CreateControlID(); m_lLastChildID = -1; }
CDialogUserArea::CDialogUserArea(CDialogDoc* pDoc) { m_strName = GeLoadString(IDS_USER_AREA); m_strDescr = m_strName; m_type = UserArea; m_lFlags = BFH_LEFT | BFV_TOP; m_lInitW = 100; m_lInitH = 100; m_pDocument = pDoc; m_strControlID = CreateControlID(); }
CDialogRadioBtn::CDialogRadioBtn(CDialogDoc* pDoc) { m_strName = GeLoadString(IDS_RADIO_BTN); m_strDescr = m_strName; m_type = RadioBtn; m_lFlags = BFH_LEFT | BFV_TOP; m_lInitW = 0; m_lInitH = 0; m_bText = false; m_pDocument = pDoc; m_strControlID = CreateControlID(); }
/*********************************************************************\ Function name : CDialogArrowBtn::CDialogArrowBtn Description : Created at : 12.08.01, @ 21:52:38 Created by : Thomas Kunert Modified by : \*********************************************************************/ CDialogArrowBtn::CDialogArrowBtn(CDialogDoc* pDoc) { m_strName = GeLoadString(IDS_ARROW); m_strDescr = m_strName; m_type = ArrowBtn; m_lFlags = BFH_LEFT | BFV_TOP; m_lInitW = 0; m_lInitH = 0; m_lArrowType = ARROW_LEFT; m_bIsPopupButton = false; // m_lChildren = 0; // m_pstrChildren = nullptr; // m_plChildIDs = nullptr; m_pDocument = pDoc; m_strControlID = CreateControlID(); }
MsgRouting AwtTextComponent::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) { /* Use the system provided edit control class to generate context menu. */ if (m_hEditCtrl == NULL) { DWORD dwStyle = WS_CHILD; DWORD dwExStyle = 0; m_hEditCtrl = ::CreateWindowEx(dwExStyle, L"EDIT", L"TEXT", dwStyle, 0, 0, 0, 0, GetHWnd(), reinterpret_cast<HMENU>( static_cast<INT_PTR>( CreateControlID())), AwtToolkit::GetInstance().GetModuleHandle(), NULL); DASSERT(m_hEditCtrl != NULL); if (sm_pDefWindowProc == NULL) { sm_pDefWindowProc = (WNDPROC)::GetWindowLongPtr(m_hEditCtrl, GWLP_WNDPROC); } ::SetLastError(0); INT_PTR ret = ::SetWindowLongPtr(m_hEditCtrl, GWLP_WNDPROC, (INT_PTR)AwtTextArea::EditProc); DASSERT(ret != 0 || ::GetLastError() == 0); } /* * Tricks on the edit control to ensure that its context menu has * the correct set of enabled items according to the RichEdit state. */ ::SetWindowText(m_hEditCtrl, TEXT("TEXT")); if (m_bCanUndo == TRUE && SendMessage(EM_CANUNDO)) { /* Enable 'Undo' item. */ ::SendMessage(m_hEditCtrl, WM_CHAR, 'A', 0); } { /* * Initial selection for the edit control - (0,1). * This enables 'Cut', 'Copy' and 'Delete' and 'Select All'. */ INT nStart = 0; INT nEnd = 1; if (SendMessage(EM_SELECTIONTYPE) == SEL_EMPTY) { /* * RichEdit selection is empty - clear selection of the edit control. * This disables 'Cut', 'Copy' and 'Delete'. */ nStart = -1; nEnd = 0; } else { CHARRANGE cr; EditGetSel(cr); /* Check if all the text is selected. */ if (cr.cpMin == 0) { int len = ::GetWindowTextLength(GetHWnd()); if (cr.cpMin == 0 && cr.cpMax >= len) { /* * All the text is selected in RichEdit - select all the * text in the edit control. This disables 'Select All'. */ nStart = 0; nEnd = -1; } } } ::SendMessage(m_hEditCtrl, EM_SETSEL, (WPARAM)nStart, (LPARAM)nEnd); } /* Disable 'Paste' item if the RichEdit control is read-only. */ ::SendMessage(m_hEditCtrl, EM_SETREADONLY, GetStyle() & ES_READONLY ? TRUE : FALSE, 0); POINT p; p.x = xPos; p.y = yPos; /* * If the context menu is requested with SHIFT+F10 or VK_APPS key, * we position its top left corner to the center of the RichEdit * client rect. */ if (p.x == -1 && p.y == -1) { RECT r; VERIFY(::GetClientRect(GetHWnd(), &r)); p.x = (r.left + r.right) / 2; p.y = (r.top + r.bottom) / 2; VERIFY(::ClientToScreen(GetHWnd(), &p)); } // The context menu steals focus from the proxy. // So, set the focus-restore flag up. SetRestoreFocus(TRUE); ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl, MAKELPARAM(p.x, p.y)); SetRestoreFocus(FALSE); return mrConsume; }