1998-07-23 10:39:46 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: test.cpp
|
|
|
|
// Purpose: wxToolBar sample
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04/01/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
1999-10-26 19:38:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-07-23 10:39:46 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// ============================================================================
|
|
|
|
// declarations
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
1998-07-23 10:39:46 -04:00
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
1999-10-26 19:38:33 -04:00
|
|
|
#include <wx/wxprec.h>
|
1998-07-23 10:39:46 -04:00
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
1999-10-26 19:38:33 -04:00
|
|
|
#pragma hdrstop
|
1998-07-23 10:39:46 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
1999-10-26 19:38:33 -04:00
|
|
|
#include <wx/wx.h>
|
1998-07-23 10:39:46 -04:00
|
|
|
#endif
|
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
#include <wx/toolbar.h>
|
1998-12-09 12:30:17 -05:00
|
|
|
#include <wx/log.h>
|
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// resources
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1998-10-18 18:31:48 -04:00
|
|
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
1999-10-26 19:38:33 -04:00
|
|
|
#include "mondrian.xpm"
|
|
|
|
#include "bitmaps/new.xpm"
|
|
|
|
#include "bitmaps/open.xpm"
|
|
|
|
#include "bitmaps/save.xpm"
|
|
|
|
#include "bitmaps/copy.xpm"
|
|
|
|
#include "bitmaps/cut.xpm"
|
|
|
|
// #include "bitmaps/paste.xpm"
|
|
|
|
#include "bitmaps/print.xpm"
|
|
|
|
#include "bitmaps/preview.xpm"
|
|
|
|
#include "bitmaps/help.xpm"
|
|
|
|
#endif // GTK or Motif
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Define a new application
|
|
|
|
class MyApp: public wxApp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool OnInit();
|
|
|
|
bool InitToolbar(wxToolBar* toolBar, bool smallicons = FALSE);
|
|
|
|
};
|
1998-07-31 16:04:04 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// Define a new frame
|
|
|
|
class MyFrame: public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MyFrame(wxFrame *parent,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxString& title = "wxToolBar Sample",
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE);
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
void OnQuit(wxCommandEvent& event);
|
|
|
|
void OnAbout(wxCommandEvent& event);
|
|
|
|
|
|
|
|
void OnToggleToolbar(wxCommandEvent& event);
|
|
|
|
void OnEnablePrint(wxCommandEvent& event) { DoEnablePrint(); }
|
1999-11-18 10:58:35 -05:00
|
|
|
void OnDeletePrint(wxCommandEvent& event) { DoDeletePrint(); }
|
1999-10-26 19:38:33 -04:00
|
|
|
void OnToggleHelp(wxCommandEvent& event) { DoToggleHelp(); }
|
|
|
|
|
|
|
|
void OnToolLeftClick(wxCommandEvent& event);
|
|
|
|
void OnToolEnter(wxCommandEvent& event);
|
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
void OnCombo(wxCommandEvent& event);
|
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
private:
|
|
|
|
void DoEnablePrint();
|
1999-11-18 10:58:35 -05:00
|
|
|
void DoDeletePrint();
|
1999-10-26 19:38:33 -04:00
|
|
|
void DoToggleHelp();
|
|
|
|
|
|
|
|
bool m_smallToolbar;
|
|
|
|
wxTextCtrl* m_textWindow;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
const int ID_TOOLBAR = 500;
|
|
|
|
|
|
|
|
enum
|
1998-07-23 10:39:46 -04:00
|
|
|
{
|
1999-10-26 19:38:33 -04:00
|
|
|
IDM_TOOLBAR_TOGGLETOOLBAR = 200,
|
|
|
|
IDM_TOOLBAR_ENABLEPRINT,
|
1999-11-18 10:58:35 -05:00
|
|
|
IDM_TOOLBAR_DELETEPRINT,
|
1999-11-11 21:17:44 -05:00
|
|
|
IDM_TOOLBAR_TOGGLEHELP,
|
|
|
|
|
|
|
|
ID_COMBO = 1000
|
1999-10-26 19:38:33 -04:00
|
|
|
};
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event tables
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
|
|
|
|
// help button.
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|
|
|
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
|
|
|
|
EVT_MENU(wxID_HELP, MyFrame::OnAbout)
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBAR, MyFrame::OnToggleToolbar)
|
|
|
|
EVT_MENU(IDM_TOOLBAR_ENABLEPRINT, MyFrame::OnEnablePrint)
|
1999-11-18 10:58:35 -05:00
|
|
|
EVT_MENU(IDM_TOOLBAR_DELETEPRINT, MyFrame::OnDeletePrint)
|
1999-10-26 19:38:33 -04:00
|
|
|
EVT_MENU(IDM_TOOLBAR_TOGGLEHELP, MyFrame::OnToggleHelp)
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
EVT_MENU(-1, MyFrame::OnToolLeftClick)
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
EVT_COMBOBOX(ID_COMBO, MyFrame::OnCombo)
|
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter)
|
|
|
|
END_EVENT_TABLE()
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// ============================================================================
|
|
|
|
// implementation
|
|
|
|
// ============================================================================
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// MyApp
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
IMPLEMENT_APP(MyApp)
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// The `main program' equivalent, creating the windows and returning the
|
|
|
|
// main frame
|
|
|
|
bool MyApp::OnInit()
|
|
|
|
{
|
|
|
|
// Create the main frame window
|
|
|
|
MyFrame* frame = new MyFrame((wxFrame *) NULL, -1,
|
|
|
|
"wxToolBar Sample",
|
|
|
|
wxPoint(100, 100), wxSize(450, 300));
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// VZ: what's this for??
|
|
|
|
#if 0
|
1999-09-15 12:15:50 -04:00
|
|
|
// Force a resize. This should probably be replaced by a call to a wxFrame
|
|
|
|
// function that lays out default decorations and the remaining content window.
|
|
|
|
wxSizeEvent event(wxSize(-1, -1), frame->GetId());
|
|
|
|
frame->OnSize(event);
|
1999-10-26 19:38:33 -04:00
|
|
|
#endif // 0
|
|
|
|
|
1999-09-15 12:15:50 -04:00
|
|
|
frame->Show(TRUE);
|
|
|
|
|
|
|
|
frame->SetStatusText("Hello, wxWindows");
|
|
|
|
|
|
|
|
SetTopWindow(frame);
|
|
|
|
|
|
|
|
return TRUE;
|
1998-07-23 10:39:46 -04:00
|
|
|
}
|
|
|
|
|
1999-10-04 07:28:23 -04:00
|
|
|
bool MyApp::InitToolbar(wxToolBar* toolBar, bool smallicons)
|
1998-07-23 10:39:46 -04:00
|
|
|
{
|
|
|
|
// Set up toolbar
|
|
|
|
wxBitmap* toolBarBitmaps[8];
|
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
toolBarBitmaps[0] = new wxBitmap("icon1");
|
|
|
|
toolBarBitmaps[1] = new wxBitmap("icon2");
|
1999-10-04 07:28:23 -04:00
|
|
|
if ( !smallicons )
|
1999-09-15 12:15:50 -04:00
|
|
|
{
|
|
|
|
toolBarBitmaps[2] = new wxBitmap("icon3");
|
|
|
|
toolBarBitmaps[3] = new wxBitmap("icon4");
|
|
|
|
toolBarBitmaps[4] = new wxBitmap("icon5");
|
|
|
|
toolBarBitmaps[5] = new wxBitmap("icon6");
|
|
|
|
toolBarBitmaps[6] = new wxBitmap("icon7");
|
|
|
|
toolBarBitmaps[7] = new wxBitmap("icon8");
|
|
|
|
}
|
1998-07-31 16:04:04 -04:00
|
|
|
#else
|
|
|
|
toolBarBitmaps[0] = new wxBitmap( new_xpm );
|
|
|
|
toolBarBitmaps[1] = new wxBitmap( open_xpm );
|
1999-10-04 07:28:23 -04:00
|
|
|
if ( !smallicons )
|
1999-09-15 12:15:50 -04:00
|
|
|
{
|
|
|
|
toolBarBitmaps[2] = new wxBitmap( save_xpm );
|
|
|
|
toolBarBitmaps[3] = new wxBitmap( copy_xpm );
|
|
|
|
toolBarBitmaps[4] = new wxBitmap( cut_xpm );
|
|
|
|
toolBarBitmaps[5] = new wxBitmap( preview_xpm );
|
|
|
|
toolBarBitmaps[6] = new wxBitmap( print_xpm );
|
|
|
|
toolBarBitmaps[7] = new wxBitmap( help_xpm );
|
|
|
|
}
|
1998-07-23 10:39:46 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
int width = 24;
|
|
|
|
#else
|
|
|
|
int width = 16;
|
|
|
|
#endif
|
|
|
|
int currentX = 5;
|
|
|
|
|
1998-10-18 18:31:48 -04:00
|
|
|
toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New file");
|
1998-07-23 10:39:46 -04:00
|
|
|
currentX += width + 5;
|
1998-10-18 18:31:48 -04:00
|
|
|
toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file");
|
1999-11-11 22:12:51 -05:00
|
|
|
currentX += width + 5;
|
|
|
|
toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 1");
|
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO);
|
|
|
|
combo->Append("This");
|
|
|
|
combo->Append("is a");
|
|
|
|
combo->Append("combobox");
|
|
|
|
combo->Append("in a");
|
|
|
|
combo->Append("toolbar");
|
|
|
|
toolBar->AddControl(combo);
|
1999-09-15 12:15:50 -04:00
|
|
|
|
1999-10-04 07:28:23 -04:00
|
|
|
if ( !smallicons )
|
1999-09-15 12:15:50 -04:00
|
|
|
{
|
|
|
|
currentX += width + 5;
|
1999-11-03 10:55:14 -05:00
|
|
|
toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 2");
|
1999-09-15 12:15:50 -04:00
|
|
|
currentX += width + 5;
|
|
|
|
toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Toggle/Untoggle help button");
|
|
|
|
currentX += width + 5;
|
|
|
|
toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste");
|
|
|
|
currentX += width + 5;
|
1999-11-18 10:58:35 -05:00
|
|
|
toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Delete this tool");
|
1999-09-15 12:15:50 -04:00
|
|
|
currentX += width + 5;
|
|
|
|
toolBar->AddSeparator();
|
1999-11-03 10:55:14 -05:00
|
|
|
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Help button");
|
1999-09-15 12:15:50 -04:00
|
|
|
}
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1998-07-27 05:47:57 -04:00
|
|
|
toolBar->Realize();
|
1998-07-23 10:39:46 -04:00
|
|
|
|
|
|
|
// Can delete the bitmaps since they're reference counted
|
1999-11-11 22:12:51 -05:00
|
|
|
int i, max = smallicons ? 3 : WXSIZEOF(toolBarBitmaps);
|
1999-09-15 12:15:50 -04:00
|
|
|
for (i = 0; i < max; i++)
|
1998-07-23 10:39:46 -04:00
|
|
|
delete toolBarBitmaps[i];
|
1998-07-24 11:43:03 -04:00
|
|
|
|
|
|
|
return TRUE;
|
1998-07-23 10:39:46 -04:00
|
|
|
}
|
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// MyFrame
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-07-24 11:43:03 -04:00
|
|
|
|
|
|
|
// Define my frame constructor
|
1999-09-15 12:15:50 -04:00
|
|
|
MyFrame::MyFrame(wxFrame* parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
long style)
|
|
|
|
: wxFrame(parent, id, title, pos, size, style)
|
1998-07-23 10:39:46 -04:00
|
|
|
{
|
1999-07-25 08:59:58 -04:00
|
|
|
m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE);
|
1999-09-15 12:15:50 -04:00
|
|
|
m_smallToolbar = FALSE;
|
1999-10-26 19:38:33 -04:00
|
|
|
|
|
|
|
// Give it a status line
|
|
|
|
CreateStatusBar();
|
|
|
|
|
|
|
|
// Give it an icon
|
|
|
|
SetIcon(wxICON(mondrian));
|
|
|
|
|
|
|
|
// Make a menubar
|
|
|
|
wxMenu *tbarMenu = new wxMenu;
|
|
|
|
tbarMenu->Append(IDM_TOOLBAR_TOGGLETOOLBAR, "&Toggle toolbar", "Change the toolbar kind");
|
|
|
|
tbarMenu->Append(IDM_TOOLBAR_ENABLEPRINT, "&Enable print button", "");
|
1999-11-18 10:58:35 -05:00
|
|
|
tbarMenu->Append(IDM_TOOLBAR_DELETEPRINT, "&Delete print button", "");
|
1999-10-26 19:38:33 -04:00
|
|
|
tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button", "");
|
|
|
|
|
|
|
|
wxMenu *fileMenu = new wxMenu;
|
|
|
|
fileMenu->Append(wxID_EXIT, "E&xit", "Quit toolbar sample" );
|
|
|
|
|
|
|
|
wxMenu *helpMenu = new wxMenu;
|
|
|
|
helpMenu->Append(wxID_HELP, "&About", "About toolbar sample");
|
|
|
|
|
|
|
|
wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE );
|
|
|
|
|
|
|
|
menuBar->Append(fileMenu, "&File");
|
|
|
|
menuBar->Append(tbarMenu, "&Toolbar");
|
|
|
|
menuBar->Append(helpMenu, "&Help");
|
|
|
|
|
|
|
|
// Associate the menu bar with the frame
|
|
|
|
SetMenuBar(menuBar);
|
|
|
|
|
|
|
|
// Create the toolbar
|
|
|
|
wxToolBar *tbar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL |
|
|
|
|
wxTB_FLAT | wxTB_DOCKABLE,
|
|
|
|
ID_TOOLBAR);
|
|
|
|
|
1999-11-14 10:14:23 -05:00
|
|
|
tbar->SetMargins( 4, 4 );
|
1999-10-26 19:38:33 -04:00
|
|
|
|
|
|
|
wxGetApp().InitToolbar(tbar);
|
1999-09-15 12:15:50 -04:00
|
|
|
}
|
|
|
|
|
1999-10-26 19:38:33 -04:00
|
|
|
void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
|
1999-09-15 12:15:50 -04:00
|
|
|
{
|
1999-10-26 19:38:33 -04:00
|
|
|
// delete and recreate the toolbar
|
|
|
|
wxToolBar *tbar = GetToolBar();
|
|
|
|
delete tbar;
|
|
|
|
|
1999-09-15 12:15:50 -04:00
|
|
|
SetToolBar(NULL);
|
1999-10-26 19:38:33 -04:00
|
|
|
tbar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL |
|
|
|
|
wxTB_FLAT | wxTB_DOCKABLE,
|
|
|
|
ID_TOOLBAR);
|
1999-09-15 12:15:50 -04:00
|
|
|
|
|
|
|
m_smallToolbar = !m_smallToolbar;
|
1999-10-26 19:38:33 -04:00
|
|
|
wxGetApp().InitToolbar(tbar, m_smallToolbar);
|
1998-07-23 10:39:46 -04:00
|
|
|
}
|
|
|
|
|
1998-07-31 16:04:04 -04:00
|
|
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
1998-07-23 10:39:46 -04:00
|
|
|
{
|
1998-07-24 11:43:03 -04:00
|
|
|
Close(TRUE);
|
1998-07-23 10:39:46 -04:00
|
|
|
}
|
|
|
|
|
1998-07-31 16:04:04 -04:00
|
|
|
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
1998-07-23 10:39:46 -04:00
|
|
|
{
|
1999-01-12 18:51:13 -05:00
|
|
|
(void)wxMessageBox("wxWindows toolbar sample", "About wxToolBar");
|
1998-07-24 11:43:03 -04:00
|
|
|
}
|
1998-07-23 10:39:46 -04:00
|
|
|
|
1998-07-24 11:43:03 -04:00
|
|
|
void MyFrame::OnToolLeftClick(wxCommandEvent& event)
|
|
|
|
{
|
1999-07-25 08:59:58 -04:00
|
|
|
wxString str;
|
|
|
|
str.Printf( _T("Clicked on tool %d\n"), event.GetId());
|
|
|
|
m_textWindow->WriteText( str );
|
1999-10-26 19:38:33 -04:00
|
|
|
|
1999-07-25 08:59:58 -04:00
|
|
|
if (event.GetId() == wxID_HELP)
|
|
|
|
{
|
1999-10-26 19:38:33 -04:00
|
|
|
if ( event.GetExtraLong() != 0 )
|
1999-07-25 08:59:58 -04:00
|
|
|
m_textWindow->WriteText( _T("Help button down now.\n") );
|
|
|
|
else
|
|
|
|
m_textWindow->WriteText( _T("Help button up now.\n") );
|
|
|
|
}
|
1999-10-26 19:38:33 -04:00
|
|
|
|
1999-07-25 08:59:58 -04:00
|
|
|
if (event.GetId() == wxID_COPY)
|
|
|
|
{
|
1999-09-15 12:15:50 -04:00
|
|
|
DoEnablePrint();
|
1999-07-25 08:59:58 -04:00
|
|
|
}
|
1999-10-26 19:38:33 -04:00
|
|
|
|
1999-07-25 08:59:58 -04:00
|
|
|
if (event.GetId() == wxID_CUT)
|
|
|
|
{
|
1999-09-15 12:15:50 -04:00
|
|
|
DoToggleHelp();
|
1999-07-25 08:59:58 -04:00
|
|
|
}
|
1999-12-01 10:23:56 -05:00
|
|
|
|
1999-11-18 10:58:35 -05:00
|
|
|
if (event.GetId() == wxID_PRINT)
|
|
|
|
{
|
|
|
|
DoDeletePrint();
|
|
|
|
}
|
1998-07-23 10:39:46 -04:00
|
|
|
}
|
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
void MyFrame::OnCombo(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxLogStatus(_T("Combobox string '%s' selected"), event.GetString().c_str());
|
|
|
|
}
|
|
|
|
|
1999-09-15 12:15:50 -04:00
|
|
|
void MyFrame::DoEnablePrint()
|
|
|
|
{
|
|
|
|
wxToolBar *tb = GetToolBar();
|
|
|
|
if (tb->GetToolEnabled(wxID_PRINT))
|
|
|
|
tb->EnableTool( wxID_PRINT, FALSE );
|
|
|
|
else
|
|
|
|
tb->EnableTool( wxID_PRINT, TRUE );
|
|
|
|
}
|
|
|
|
|
1999-11-18 10:58:35 -05:00
|
|
|
void MyFrame::DoDeletePrint()
|
|
|
|
{
|
|
|
|
wxToolBar *tb = GetToolBar();
|
1999-12-01 10:23:56 -05:00
|
|
|
|
|
|
|
// only implemented in wxGTK for now
|
|
|
|
#ifndef __WXGTK__
|
1999-11-24 07:14:24 -05:00
|
|
|
wxMessageBox("Sorry, wxToolBar::DeleteTool is not implemented under Windows.");
|
|
|
|
#else
|
1999-11-18 10:58:35 -05:00
|
|
|
tb->DeleteTool( wxID_PRINT );
|
1999-11-24 07:14:24 -05:00
|
|
|
#endif
|
1999-11-18 10:58:35 -05:00
|
|
|
}
|
|
|
|
|
1999-09-15 12:15:50 -04:00
|
|
|
void MyFrame::DoToggleHelp()
|
|
|
|
{
|
|
|
|
wxToolBar *tb = GetToolBar();
|
|
|
|
tb->ToggleTool( wxID_HELP, !tb->GetToolState( wxID_HELP ) );
|
|
|
|
}
|
|
|
|
|
1998-07-24 11:43:03 -04:00
|
|
|
void MyFrame::OnToolEnter(wxCommandEvent& event)
|
|
|
|
{
|
1998-07-27 05:47:57 -04:00
|
|
|
if (event.GetSelection() > -1)
|
1998-07-24 11:43:03 -04:00
|
|
|
{
|
|
|
|
wxString str;
|
1999-04-24 21:00:34 -04:00
|
|
|
str.Printf(_T("This is tool number %d"), event.GetSelection());
|
1998-07-24 11:43:03 -04:00
|
|
|
SetStatusText(str);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SetStatusText("");
|
|
|
|
}
|
1998-07-23 10:39:46 -04:00
|
|
|
|