bool CInPlaceCombo::Create (int iItem, int iSubItem, CStringList &rlstItems, int nSel) { if (NULL == GetControl()) return false; m_iItem = iItem; m_iSubItem = iSubItem; bool fVisible = (m_dwStyle & WS_VISIBLE) ? true : false; SetStyle (m_dwStyle & ~WS_VISIBLE); if (!FInit()) return false; // Set the proper font HFONT hF = (HFONT)GetParent()->ForwardEvent(WM_GETFONT); ForwardEvent (WM_SETFONT, (WPARAM)hF); // alle Elemente zur Box hinzufügen for (CStringList::iterator it = rlstItems.begin(); it != rlstItems.end(); ++it) { GetComboBox() -> AddString ((*it).c_str()); } if (-1 != nSel) GetComboBox() -> ChangeCurrentIndex (nSel); if (fVisible) { Show(); SetFocus(); } return true; }
void WidgetEditor::CatchEvent(Event* pEvent) { GAppBase::CatchEvent(pEvent); if (pEvent->IsResize()) { m_pRootWin->SetDirtySide(SideEnum::Right); m_pRootWin->SetDirtySide(SideEnum::Bottom); } if (m_bEditMode) { if (pEvent->IsMouse() && pEvent->GetMouseEvent() == LeftDown) { if (m_pSelectedWidget == m_pHoverWidget) UnselectWidget(); else SelectWidget(m_pHoverWidget); } } else { if (pEvent->IsMouse()) { if (pEvent->GetMouseEvent() == MouseMove) UpateFocus(); else ForwardEvent(pEvent); } if (pEvent->IsKeyboard()) { ForwardEvent(pEvent); } } if (pEvent->IsKeyboard() &&pEvent->GetKeyboardEvent() == EKeyboardEvent::KeyDown && pEvent->GetKeyboardKey() == EKeyboardKey::KEY_F1) { m_bEditMode = !m_bEditMode; LOG("Change Edit Mode : %s\n", (m_bEditMode ? "on" : "off")); } }
int CInPlaceCombo::SetItemHeight (int nIndex, UINT cyItemHeight) { return (int)ForwardEvent(CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); }
void CInPlaceCombo::SetHorizontalExtent (UINT uiExtent) { if (IsWin40()) ForwardEvent(CB_SETHORIZONTALEXTENT, uiExtent, 0); }