CDropDown::CDropDown(const CRect& WindowRect, CWindow* pParent, bool bAllowEdit, unsigned int iItemHeight, CFontEngine* pFontEngine) : CWindow(WindowRect, pParent), m_bAllowEdit(bAllowEdit) { m_pCViewAncestor = GetView(); m_pEditBox = new CEditBox(CRect(0, 0, m_WindowRect.Width() - m_WindowRect.Height(), m_WindowRect.Height()), this, pFontEngine); if (!m_bAllowEdit) { m_pEditBox->SetReadOnly(true); // Override the normal read-only BG color m_pEditBox->SetBackgroundColor(COLOR_WHITE); } m_pListBox = new CListBox(CRect(0, m_WindowRect.Height(), m_WindowRect.Width(), m_WindowRect.Height() + iItemHeight * 5 + 1), this, true, iItemHeight, pFontEngine); m_pListBox->SetVisible(false); m_pListBox->SetDropDown(this); m_pDropButton = new CPictureButton( CRect(m_WindowRect.Width() - m_WindowRect.Height() + 1, 0, m_WindowRect.Width(), m_WindowRect.Height()), this, CwgBitmapResourceHandle(WGRES_DOWN_ARROW_BITMAP)); CMessageServer::Instance().RegisterMessageClient(this, CMessage::KEYBOARD_KEYDOWN); CMessageServer::Instance().RegisterMessageClient(this, CMessage::MOUSE_BUTTONDOWN); CMessageServer::Instance().RegisterMessageClient(this, CMessage::CTRL_SINGLELCLICK); CMessageServer::Instance().RegisterMessageClient(this, CMessage::CTRL_VALUECHANGE); Draw(); }
CCheckBox::CCheckBox(const CRect& WindowRect, CWindow* pParent) : CWindow(WindowRect, pParent), m_eCheckBoxState(UNCHECKED), m_MouseButton(0), m_hBitmapCheck(CwgBitmapResourceHandle(WGRES_CHECK_BITMAP)) { m_BackgroundColor = DEFAULT_CHECKBOX_BACK_COLOR; CMessageServer::Instance().RegisterMessageClient(this, CMessage::MOUSE_BUTTONUP); CMessageServer::Instance().RegisterMessageClient(this, CMessage::CTRL_SINGLELCLICK); Draw(); }