4
4
// Author: Julian Smart
7
// RCS-ID: $Id: toolbar.cpp,v 1.60 2006/12/12 21:44:51 RR Exp $
7
// RCS-ID: $Id: toolbar.cpp 46558 2007-06-20 14:02:06Z JS $
8
8
// Copyright: (c) Julian Smart
9
9
// Licence: wxWindows licence
10
10
/////////////////////////////////////////////////////////////////////////////
47
47
#error You need to enable XPM support to use XPM bitmaps with toolbar!
48
48
#endif // USE_XPM_BITMAPS
50
// If this is 1, the sample will test an extra toolbar identical to the
51
// main one, but not managed by the frame. This can test subtle differences
52
// in the way toolbars are handled, especially on Mac where there is one
53
// native, 'installed' toolbar.
54
#define USE_UNMANAGED_TOOLBAR 0
50
56
// ----------------------------------------------------------------------------
52
58
// ----------------------------------------------------------------------------
96
102
const wxSize& size = wxDefaultSize,
97
103
long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
105
void PopulateToolbar(wxToolBarBase* toolBar);
99
106
void RecreateToolbar();
101
108
void OnQuit(wxCommandEvent& event);
580
595
// Create the toolbar
581
596
RecreateToolbar();
583
m_textWindow = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
588
wxToolBar* MyFrame::OnCreateToolBar(long style,
590
const wxString& name)
592
return (wxToolBar *)new wxToolBarSimple(this, id,
593
wxDefaultPosition, wxDefaultSize,
597
#endif // USE_GENERIC_TBAR
598
m_panel = new wxPanel(this, wxID_ANY);
599
#if USE_UNMANAGED_TOOLBAR
600
m_extraToolBar = new wxToolBar(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_TEXT|wxTB_FLAT|wxTB_TOP);
601
PopulateToolbar(m_extraToolBar);
603
m_extraToolBar = NULL;
606
m_textWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
608
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
609
m_panel->SetSizer(sizer);
611
sizer->Add(m_extraToolBar, 0, wxEXPAND, 0);
612
sizer->Add(m_textWindow, 1, wxEXPAND, 0);
599
615
void MyFrame::LayoutChildren()
615
m_textWindow->SetSize(offset, 0, size.x - offset, size.y);
631
m_panel->SetSize(offset, 0, size.x - offset, size.y);
618
634
void MyFrame::OnSize(wxSizeEvent& event)