void ALMAPI LIST_VI_LISTBOX::ParentOpened() { LPLIST list; LONG style; HDC hdc; list = LockListObject(Object()); I_ASSERT_POINTER(list, return); style = WS_CHILD | WS_BORDER | WS_VSCROLL | LBS_OWNERDRAWFIXED | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT; if (list->DoesMultipleSelections()) style |= (LBS_EXTENDEDSEL|LBS_MULTIPLESEL); m_hwndItem = OWndCreateWindowEx( this, 0, g_listboxObjectClassName, "", style, g_hInstance, this); list->FillListBox(m_hwndItem); SetSelections(); UnlockListObject(Object()); I_ASSERT_WINDOW(m_hwndItem, return); hdc = GetDC(m_hwndItem); m_attributes.AttrCreateFont(hdc); ReleaseDC(m_hwndItem, hdc); m_attributes.AttrCreateBrush(); m_attributes.AttrSetFont(m_hwndItem); }
SelectedChoicesDialog::SelectedChoicesDialog(wxWindow *parent, wxString const& message, wxString const& caption, wxArrayString const& choices) { Create(parent, message, caption, choices); wxButton *selAll = new wxButton(this, -1, _("Select &All")); wxButton *selNone = new wxButton(this, -1, _("Select &None")); selAll->Bind(wxEVT_BUTTON, &SelectedChoicesDialog::SelectAll, this); selNone->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) { SetSelections(wxArrayInt()); }); auto buttonSizer = new wxBoxSizer(wxHORIZONTAL); buttonSizer->Add(selAll, wxSizerFlags(0).Left()); buttonSizer->Add(selNone, wxSizerFlags(0).Right()); wxSizer *sizer = GetSizer(); sizer->Insert(2, buttonSizer, wxSizerFlags(0).Center()); sizer->Fit(this); }
void ALMAPI LIST_VI_COMBOBOX::ParentOpened() { LPLIST list; LONG style; HDC hdc; list = LockListObject(Object()); I_ASSERT_POINTER(list, return); style = WS_CHILD | WS_BORDER | WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT ; switch (list->GetType()) { case OLIST_SIMPLECOMBO: style |= CBS_SIMPLE; break; case OLIST_DROPDOWNCOMBO: style |= CBS_DROPDOWN; break; case OLIST_DROPDOWNLIST: style |= CBS_DROPDOWNLIST; break; } m_hwndItem = OWndCreateWindowEx( this, 0, g_comboboxObjectClassName, "", style, g_hInstance, this); list->FillListBox(m_hwndItem); SetSelections(); UnlockListObject(Object()); I_ASSERT_WINDOW(m_hwndItem, return); hdc = GetDC(m_hwndItem); m_attributes.AttrCreateFont(hdc); ReleaseDC(m_hwndItem, hdc); m_attributes.AttrCreateBrush(); m_attributes.AttrSetFont(m_hwndItem); }
void SelectedChoicesDialog::SelectAll(wxCommandEvent&) { wxArrayInt sel(m_listbox->GetCount()); std::iota(sel.begin(), sel.end(), 0); SetSelections(sel); }