~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to samples/toolbar/toolbar.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2007-11-06 18:25:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071106182513-809agqds6igh7mqo
Tags: 2.8.6.1-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.6.1.tar.bz2, renamed debian to debian-upstream.
* Provide a get-orig-source target to do the repackaging.
* Fix "substvar-source-version-is-deprecated" lintian warnings.
* Remove duplicate Description field in debian/control.
* Add "\" at the end of line 8 in debian/python-wxtools.menu to fix
  "bad-test-in-menu-item" lintian error.
* Provide .xpm icons to fix "menu-icon-not-in-xpm-format" lintian errors,
  changed Icon field in debian/python-wxtools.menu.
* Fix "wrong-name-for-upstream-changelog" lintian warnings.
* Remove "Application;" from Categories field in debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Switch "Apps" to "Applications" in debian/python-wxtools.menu to fix
  "menu-item-uses-apps-section" lintian warnings.
* Drop the icon extension from debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Add dpatch support.
* Add "WX_CONFIG" patch.
* debian/rules:
  - added .xpm icons to install-gtk-py-tools target
  - added "docs/changes.txt" to dh_installchangelogs in binary-common target
  - added "\" at the end of "install-examples install-msw-dev
    install-msw-dbg install-headers-msw" line in .PHONY

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Author:      Julian Smart
5
5
// Modified by:
6
6
// Created:     04/01/98
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
49
49
 
 
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
 
55
 
50
56
// ----------------------------------------------------------------------------
51
57
// resources
52
58
// ----------------------------------------------------------------------------
96
102
            const wxSize& size = wxDefaultSize,
97
103
            long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
98
104
 
 
105
    void PopulateToolbar(wxToolBarBase* toolBar);
99
106
    void RecreateToolbar();
100
107
 
101
108
    void OnQuit(wxCommandEvent& event);
154
161
 
155
162
    wxTextCtrl         *m_textWindow;
156
163
 
 
164
    wxPanel            *m_panel;
 
165
    wxToolBar          *m_extraToolBar;
 
166
 
157
167
    wxToolBar          *m_tbar;
158
168
 
159
169
    // the path to the custom bitmap for the test toolbar tool
331
341
    toolBar = CreateToolBar(style, ID_TOOLBAR);
332
342
#endif
333
343
 
 
344
    PopulateToolbar(toolBar);
 
345
}
 
346
 
 
347
void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
 
348
{
334
349
    // Set up toolbar
335
350
    enum
336
351
    {
580
595
    // Create the toolbar
581
596
    RecreateToolbar();
582
597
 
583
 
    m_textWindow = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
584
 
}
585
 
 
586
 
#if USE_GENERIC_TBAR
587
 
 
588
 
wxToolBar* MyFrame::OnCreateToolBar(long style,
589
 
                                    wxWindowID id,
590
 
                                    const wxString& name)
591
 
{
592
 
    return (wxToolBar *)new wxToolBarSimple(this, id,
593
 
                                            wxDefaultPosition, wxDefaultSize,
594
 
                                            style, name);
595
 
}
596
 
 
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);
 
602
#else
 
603
    m_extraToolBar = NULL;
 
604
#endif
 
605
    
 
606
    m_textWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
 
607
 
 
608
    wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
 
609
    m_panel->SetSizer(sizer);
 
610
    if (m_extraToolBar)
 
611
        sizer->Add(m_extraToolBar, 0, wxEXPAND, 0);
 
612
    sizer->Add(m_textWindow, 1, wxEXPAND, 0);
 
613
}
598
614
 
599
615
void MyFrame::LayoutChildren()
600
616
{
612
628
        offset = 0;
613
629
    }
614
630
 
615
 
    m_textWindow->SetSize(offset, 0, size.x - offset, size.y);
 
631
    m_panel->SetSize(offset, 0, size.x - offset, size.y);
616
632
}
617
633
 
618
634
void MyFrame::OnSize(wxSizeEvent& event)