void OnToggleAnotherToolbar(wxCommandEvent& event);
void OnToggleHorizontalText(wxCommandEvent& WXUNUSED(event));
+ void OnBottomToolbar(wxCommandEvent& WXUNUSED(event));
void OnToggleToolbarSize(wxCommandEvent& event);
void OnToggleToolbarOrient(wxCommandEvent& event);
void OnToggleToolbarRows(wxCommandEvent& event);
bool m_smallToolbar,
m_horzToolbar,
+ m_bottomToolbar,
m_horzText,
m_useCustomDisabled,
m_showTooltips;
IDM_TOOLBAR_SHOW_ICONS,
IDM_TOOLBAR_SHOW_BOTH,
IDM_TOOLBAR_CUSTOM_PATH,
-
+ IDM_TOOLBAR_BOTTOM_ORIENTATION,
IDM_TOOLBAR_OTHER_1,
IDM_TOOLBAR_OTHER_2,
IDM_TOOLBAR_OTHER_3,
- ID_COMBO = 1000
+ ID_COMBO = 1000,
+ ID_SPIN = 1001
};
// ----------------------------------------------------------------------------
EVT_MENU(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, MyFrame::OnToggleAnotherToolbar)
EVT_MENU(IDM_TOOLBAR_TOGGLE_HORIZONTAL_TEXT, MyFrame::OnToggleHorizontalText)
+ EVT_MENU(IDM_TOOLBAR_BOTTOM_ORIENTATION, MyFrame::OnBottomToolbar)
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARSIZE, MyFrame::OnToggleToolbarSize)
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARORIENT, MyFrame::OnToggleToolbarOrient)
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARROWS, MyFrame::OnToggleToolbarRows)
SetToolBar(NULL);
- style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_HORZ_LAYOUT);
+ style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_HORZ_LAYOUT);
+ if( m_bottomToolbar )
+ style |= wxTB_BOTTOM;
+ else
style |= m_horzToolbar ? wxTB_HORIZONTAL : wxTB_VERTICAL;
if ( m_showTooltips )
combo->Append(_T("in a"));
combo->Append(_T("toolbar"));
toolBar->AddControl(combo);
+
+ //wxSpinCtrl *spin = new wxSpinCtrl( toolBar, ID_SPIN, wxT("0"), wxDefaultPosition, wxSize(80,wxDefaultCoord), 0, 100, 0 );
+ //toolBar->AddControl( spin );
}
#endif // toolbars which don't support controls
m_smallToolbar = true;
m_horzToolbar = true;
+ m_bottomToolbar = false;
m_horzText = false;
m_useCustomDisabled = false;
m_showTooltips = true;
_T("Switch between using system-generated and custom disabled images"));
+ tbarMenu->AppendCheckItem(IDM_TOOLBAR_BOTTOM_ORIENTATION,
+ _T("Set toolbar at the bottom of the window"),
+ _T("Set toolbar at the bottom of the window"));
tbarMenu->AppendSeparator();
tbarMenu->Append(IDM_TOOLBAR_ENABLEPRINT, _T("&Enable print button\tCtrl-E"));
// Create the toolbar
RecreateToolbar();
- m_textWindow = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxPoint(0, 0), wxDefaultSize, wxTE_MULTILINE);
+ m_textWindow = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
}
+#if USE_GENERIC_TBAR
+
+wxToolBar* MyFrame::OnCreateToolBar(long style,
+ wxWindowID id,
+ const wxString& name)
+{
+ return (wxToolBar *)new wxToolBarSimple(this, id,
+ wxDefaultPosition, wxDefaultSize,
+ style, name);
+}
+
+#endif // USE_GENERIC_TBAR
+
void MyFrame::LayoutChildren()
{
wxSize size = GetClientSize();
void MyFrame::OnToggleToolbarOrient(wxCommandEvent& WXUNUSED(event))
{
+ if( m_bottomToolbar )
+ m_bottomToolbar = false;
m_horzToolbar = !m_horzToolbar;
+ wxMenuBar *menuBar = GetMenuBar();
+ if( menuBar->IsChecked( IDM_TOOLBAR_BOTTOM_ORIENTATION ) )
+ menuBar->Check( IDM_TOOLBAR_BOTTOM_ORIENTATION, false );
RecreateToolbar();
}
event.GetId() - IDM_TOOLBAR_TOGGLERADIOBTN1, true);
}
}
+void MyFrame::OnBottomToolbar(wxCommandEvent& event )
+{
+ m_bottomToolbar = !m_bottomToolbar;
+ wxMenuBar *menuBar = GetMenuBar();
+ if( menuBar->IsChecked( IDM_TOOLBAR_TOGGLETOOLBARORIENT ) )
+ menuBar->Check( IDM_TOOLBAR_TOGGLETOOLBARORIENT, false );
+ if( !m_horzToolbar )
+ m_horzToolbar = true;
+ RecreateToolbar();
+}
if ( y )
*y -= pt.y;
-
+#if wxUSE_TOOLBAR
+ if( y )
+ {
+ wxToolBar *toolbar = GetToolBar();
+ if( toolbar && toolbar->HasFlag( wxTB_BOTTOM ) )
+ {
+ *y -= toolbar->GetClientSize().y;
+ }
+ }
+#endif
#if wxUSE_STATUSBAR
// adjust client area height to take the status bar into account
if ( y )
int w, h;
GetClientSize(&w, &h);
+#if wxUSE_TOOLBAR
+ wxToolBar *toolbar = GetToolBar();
+ if( toolbar && toolbar->HasFlag( wxTB_BOTTOM ) )
+ h += toolbar->GetClientRect().height;
+#endif
int sw, sh;
m_frameStatusBar->GetSize(&sw, &sh);
void wxFrame::PositionToolBar()
{
+ int x = 0, y = 0;
wxToolBar *toolbar = GetToolBar();
if ( toolbar && toolbar->IsShown() )
{
height -= statbar->GetClientSize().y;
}
#endif // wxUSE_STATUSBAR
-
- int x = 0;
- int y = 0;
+ int tx, ty, tw, th;
+ toolbar->GetPosition( &tx, &ty );
+ toolbar->GetSize( &tw, &th );
+ if( ( toolbar->GetWindowStyleFlag() & wxTB_HORIZONTAL ) || ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL ) )
+ {
+ x = 0;
+ y = 0;
+ }
+ else if( toolbar->GetWindowStyleFlag() & wxTB_BOTTOM )
+ {
+ x = 0;
+ y = height - th;
+ }
#if defined(WINCE_WITH_COMMANDBAR)
// We're using a commandbar - so we have to allow for it.
if (GetMenuBar() && GetMenuBar()->GetCommandBar())
y = rect.bottom - rect.top;
}
#endif
-
- int tx, ty;
- int tw, th;
- toolbar->GetPosition(&tx, &ty);
- toolbar->GetSize(&tw, &th);
-
+ if( ( toolbar->GetWindowStyleFlag() & wxTB_HORIZONTAL ) || ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL ) )
+ {
// Adjust
if (ty < 0 && (-ty == th))
ty = 0;
if (tx < 0 && (-tx == tw))
tx = 0;
+ }
+ else if( toolbar->GetWindowStyleFlag() & wxTB_BOTTOM )
+ {
+ if( ty < 0 && ( -ty == th ) )
+ ty = height - th;
+ if( tx < 0 && ( -tx == tw ) )
+ tx = 0;
+ }
int desiredW = tw;
int desiredH = th;
{
pt.x += w;
}
- else
+ else if( !( toolbar->GetWindowStyleFlag() & wxTB_BOTTOM ) )
{
pt.y += h;
}