// the application icon (under Windows and OS/2 it is in resources and even
// though we could still include the XPM here it would be unused)
-#if !defined(__WXMSW__) && !defined(__WXPM__)
+#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm"
#endif
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_TEXT(wxID_ANY,MyFrame::OnComboBoxUpdate)
+ EVT_TEXT_ENTER(wxID_ANY,MyFrame::OnComboBoxUpdate)
EVT_COMBOBOX(wxID_ANY,MyFrame::OnComboBoxUpdate)
EVT_MENU(ComboCtrl_Compare, MyFrame::OnShowComparison)
virtual void Init()
{
}
+ virtual ~TreeCtrlComboPopup()
+ {
+ if (!m_isBeingDeleted)
+ {
+ wxMessageBox("error wxTreeCtrl::Destroy() was not called");
+ }
+ SendDestroyEvent();
+ }
virtual bool Create( wxWindow* parent )
{
wxWindow* win = GetPopupWindow();
win->SetSize(rect);
win->Raise(); // This is needed
- win->ShowWithEffect(wxSHOW_EFFECT_SLIDE_TO_BOTTOM);
+ win->ShowWithEffect(wxSHOW_EFFECT_BLEND);
return true;
}
};
// the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu;
- helpMenu->Append(ComboCtrl_About, wxT("&About...\tF1"), wxT("Show about dialog"));
+ helpMenu->Append(ComboCtrl_About, wxT("&About\tF1"), wxT("Show about dialog"));
fileMenu->Append(ComboCtrl_Compare, wxT("&Compare against wxComboBox..."),
wxT("Show some wxOwnerDrawnComboBoxes side-by-side with native wxComboBoxes."));
//
rowSizer = new wxBoxSizer( wxHORIZONTAL );
- rowSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("List View wxComboCtrl:")), 1,
- wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
+ rowSizer->Add( new wxStaticText(panel,
+ wxID_ANY,
+ "List View wxComboCtrl (custom animation):"),
+ 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
rowSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Tree Ctrl wxComboCtrl:")), 1,
wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
rowSizer = new wxBoxSizer( wxHORIZONTAL );
cc = new wxComboCtrlWithCustomPopupAnim();
+
+ // Let's set a custom style for the contained wxTextCtrl. We need to
+ // use two-step creation for it to work properly.
+ cc->SetTextCtrlStyle(wxTE_RIGHT);
+
cc->Create(panel, wxID_ANY, wxEmptyString);
// Make sure we use popup that allows focusing the listview.
panel->SetSizer( topSizer );
topSizer->SetSizeHints( panel );
- SetSize(740,400);
+ Fit();
Centre();
}
{
wxLogDebug(wxT("EVT_TEXT(id=%i,string=\"%s\")"),event.GetId(),event.GetString().c_str());
}
+ else if ( event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER )
+ {
+ wxLogDebug("EVT_TEXT_ENTER(id=%i,string=\"%s\")",
+ event.GetId(), event.GetString().c_str());
+ }
}
void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY,wxT(" wxOwnerDrawnComboBox ")),
wxVERTICAL);
- groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Writable, sorted:")), 0,
+ groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
+ wxT("Writable, with margins, sorted:")), 0,
wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, border );
odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
odc->Append(wxT("H - Appended Item")); // test sorting in append
odc->SetValue(wxT("Dot Dash"));
-
- groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+ odc->SetMargins(15, 10);
+ groupSizer->Add( odc, 0, wxALIGN_CENTER_VERTICAL|wxALL, border );
+ groupSizer->AddStretchSpacer();
//
// Readonly ODComboBox
- groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Read-only:")), 0,
+ groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
+ wxT("Read-only, big font:")), 0,
wxALIGN_CENTER_VERTICAL|wxRIGHT, border );
odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY
);
+ odc->SetFont(odc->GetFont().Scale(1.5));
odc->SetValue(wxT("Dot Dash"));
odc->SetText(wxT("Dot Dash (Testing SetText)"));
- groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+ groupSizer->Add( odc, 0, wxALL, border );
+ groupSizer->AddStretchSpacer();
//
// Disabled ODComboBox
odc->SetValue(wxT("Dot Dash"));
odc->Enable(false);
- groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+ groupSizer->Add( odc, 3, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
rowSizer->Add( groupSizer, 1, wxEXPAND|wxALL, border );
//
// wxComboBox
//
- groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Writable, sorted:")), 0,
+ groupSizer->Add( new wxStaticText(dlg,wxID_ANY,
+ wxT("Writable, with margins, sorted:")), 0,
wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, border );
cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
cb->Append(wxT("H - Appended Item")); // test sorting in append
cb->SetValue(wxT("Dot Dash"));
-
- groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+ cb->SetMargins(15, 10);
+ groupSizer->Add( cb, 0, wxALIGN_CENTER_VERTICAL|wxALL, border );
+ groupSizer->AddStretchSpacer();
//
// Readonly wxComboBox
- groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Read-only:")), 0,
+ groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
+ wxT("Read-only, big font:")), 0,
wxALIGN_CENTER_VERTICAL|wxRIGHT, border );
cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY
);
+ cb->SetFont(cb->GetFont().Scale(1.5));
cb->SetValue(wxT("Dot Dash"));
- groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+ groupSizer->Add( cb, 0, wxALL, border );
+ groupSizer->AddStretchSpacer();
//
// Disabled wxComboBox
cb->SetValue(wxT("Dot Dash"));
cb->Enable(false);
- groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+ groupSizer->Add( cb, 3, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
rowSizer->Add( groupSizer, 1, wxEXPAND|wxALL, border );
- colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, border );
+ colSizer->Add( rowSizer, 1, wxEXPAND|wxALL, border );
dlg->SetSizer( colSizer );
colSizer->SetSizeHints( dlg );