git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41268
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
2 only). This style must be used with wxTB\_TEXT.}
\twocolitem{\windowstyle{wxTB\_HORZ\_TEXT}}{Combination of wxTB\_HORZ\_LAYOUT and wxTB\_TEXT.}
\twocolitem{\windowstyle{wxTB\_NO\_TOOLTIPS}}{Don't show the short help tooltips for the tools when the mouse hovers over them.}
2 only). This style must be used with wxTB\_TEXT.}
\twocolitem{\windowstyle{wxTB\_HORZ\_TEXT}}{Combination of wxTB\_HORZ\_LAYOUT and wxTB\_TEXT.}
\twocolitem{\windowstyle{wxTB\_NO\_TOOLTIPS}}{Don't show the short help tooltips for the tools when the mouse hovers over them.}
+\twocolitem{\windowstyle{wxTB\_BOTTOM}}{Align the toolbar at the bottom of parent window.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}. Note that the Win32
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}. Note that the Win32
wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT,
// don't show the toolbar short help tooltips
wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT,
// don't show the toolbar short help tooltips
- wxTB_NO_TOOLTIPS = 0x1000
+ wxTB_NO_TOOLTIPS = 0x1000,
+
+ // lay out toolbar at the bottom of the window
+ wxTB_BOTTOM = 0x2000
void OnToggleAnotherToolbar(wxCommandEvent& event);
void OnToggleHorizontalText(wxCommandEvent& WXUNUSED(event));
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);
void OnToggleToolbarSize(wxCommandEvent& event);
void OnToggleToolbarOrient(wxCommandEvent& event);
void OnToggleToolbarRows(wxCommandEvent& event);
bool m_smallToolbar,
m_horzToolbar,
bool m_smallToolbar,
m_horzToolbar,
m_horzText,
m_useCustomDisabled,
m_showTooltips;
m_horzText,
m_useCustomDisabled,
m_showTooltips;
IDM_TOOLBAR_SHOW_ICONS,
IDM_TOOLBAR_SHOW_BOTH,
IDM_TOOLBAR_CUSTOM_PATH,
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,
IDM_TOOLBAR_OTHER_1,
IDM_TOOLBAR_OTHER_2,
IDM_TOOLBAR_OTHER_3,
+ 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_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)
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARSIZE, MyFrame::OnToggleToolbarSize)
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARORIENT, MyFrame::OnToggleToolbarOrient)
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARROWS, MyFrame::OnToggleToolbarRows)
- 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 )
style |= m_horzToolbar ? wxTB_HORIZONTAL : wxTB_VERTICAL;
if ( m_showTooltips )
combo->Append(_T("in a"));
combo->Append(_T("toolbar"));
toolBar->AddControl(combo);
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
}
#endif // toolbars which don't support controls
m_smallToolbar = true;
m_horzToolbar = true;
m_smallToolbar = true;
m_horzToolbar = true;
+ m_bottomToolbar = false;
m_horzText = false;
m_useCustomDisabled = false;
m_showTooltips = true;
m_horzText = false;
m_useCustomDisabled = false;
m_showTooltips = true;
_T("Switch between using system-generated and custom disabled images"));
_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"));
tbarMenu->AppendSeparator();
tbarMenu->Append(IDM_TOOLBAR_ENABLEPRINT, _T("&Enable print button\tCtrl-E"));
// Create the toolbar
RecreateToolbar();
// 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::LayoutChildren()
{
wxSize size = GetClientSize();
void MyFrame::OnToggleToolbarOrient(wxCommandEvent& WXUNUSED(event))
{
void MyFrame::OnToggleToolbarOrient(wxCommandEvent& WXUNUSED(event))
{
+ if( m_bottomToolbar )
+ m_bottomToolbar = false;
m_horzToolbar = !m_horzToolbar;
m_horzToolbar = !m_horzToolbar;
+ wxMenuBar *menuBar = GetMenuBar();
+ if( menuBar->IsChecked( IDM_TOOLBAR_BOTTOM_ORIENTATION ) )
+ menuBar->Check( IDM_TOOLBAR_BOTTOM_ORIENTATION, false );
event.GetId() - IDM_TOOLBAR_TOGGLERADIOBTN1, true);
}
}
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();
+}
client_area_x_offset += ww;
}
client_area_x_offset += ww;
}
+ else if( m_frameToolBar->GetWindowStyle() & wxTB_BOTTOM )
+ {
+ xx = m_miniEdge;
+ yy = GetClientSize().y;
+#if wxUSE_MENUS_NATIVE
+ yy += m_menuBarHeight;
+#endif // wxUSE_MENU_NATIVE
+ m_frameToolBar->m_x = xx;
+ m_frameToolBar->m_y = yy;
+ ww = m_width - 2*m_miniEdge;
+ hh = m_toolBarDetached ? wxPLACE_HOLDER
+ : m_frameToolBar->m_height;
+ }
else
{
ww = m_width - 2*m_miniEdge;
else
{
ww = m_width - 2*m_miniEdge;
// have the original client size.
GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS );
}
// have the original client size.
GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS );
}
+ else if (GetToolBar->GetWindowStyleFlag() & wxTB_BOTTOM)
+ {
+ tx = 0;
+ ty = statusY - th;
+ GetToolBar->SetSize(tx, ty, cw, th, wxSIZE_NO_ADJUSTMENTS );
+ }
else
{
#if !wxMAC_USE_NATIVE_TOOLBAR
else
{
#if !wxMAC_USE_NATIVE_TOOLBAR
+#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 )
#if wxUSE_STATUSBAR
// adjust client area height to take the status bar into account
if ( y )
int w, h;
GetClientSize(&w, &h);
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);
int sw, sh;
m_frameStatusBar->GetSize(&sw, &sh);
void wxFrame::PositionToolBar()
{
void wxFrame::PositionToolBar()
{
wxToolBar *toolbar = GetToolBar();
if ( toolbar && toolbar->IsShown() )
{
wxToolBar *toolbar = GetToolBar();
if ( toolbar && toolbar->IsShown() )
{
height -= statbar->GetClientSize().y;
}
#endif // wxUSE_STATUSBAR
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())
#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
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;
// 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;
int desiredW = tw;
int desiredH = th;
+ else if( !( toolbar->GetWindowStyleFlag() & wxTB_BOTTOM ) )
if ( style & wxTB_VERTICAL )
msStyle |= CCS_VERT;
if ( style & wxTB_VERTICAL )
msStyle |= CCS_VERT;
+ if( style & wxTB_BOTTOM )
+ msStyle |= CCS_BOTTOM;
+
+ else if (pToolBar->GetWindowStyleFlag() & wxTB_BOTTOM )
+ {
+ vWidth = (wxCoord)(vRect.xRight - vRect.xLeft);
+ pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
+ ,vRect.yBottom - vTHeight // assuming the vRect contains the client coordinates
+ ,vWidth
+ ,vHeight
+ );
+ }
else
{
wxCoord vSwidth = 0;
else
{
wxCoord vSwidth = 0;