]> git.saurik.com Git - wxWidgets.git/blame - samples/dialogs/dialogs.h
don't crash when invalid colour is set as fg/bg colour
[wxWidgets.git] / samples / dialogs / dialogs.h
CommitLineData
457814b5
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: dialogs.h
3// Purpose: Common dialogs demo
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
c49245f8 9// Licence: wxWindows license
457814b5
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __DIALOGSH__
13#define __DIALOGSH__
14
15// Define a new application type
16class MyApp: public wxApp
c49245f8
VZ
17{
18public:
19 bool OnInit();
457814b5
JS
20
21 wxFont m_canvasFont;
22 wxColour m_canvasTextColour;
23};
24
f6bcfd97 25// A custom modeless dialog
4c45f240
VZ
26class MyModelessDialog : public wxDialog
27{
28public:
29 MyModelessDialog(wxWindow *parent);
abceee76
VZ
30
31 void OnClose(wxCloseEvent& event);
32
33private:
34 DECLARE_EVENT_TABLE()
4c45f240
VZ
35};
36
f6bcfd97
BP
37// A custom modal dialog
38class MyModalDialog : public wxDialog
39{
40public:
41 MyModalDialog(wxWindow *parent);
42
43 void OnButton(wxCommandEvent& event);
44
45private:
46 wxButton *m_btnFocused;
47 wxButton *m_btnDelete;
48
49 DECLARE_EVENT_TABLE()
50};
51
457814b5
JS
52// Define a new frame type
53class MyFrame: public wxFrame
c49245f8
VZ
54{
55public:
56 MyFrame(wxWindow *parent, const wxString& title,
57 const wxPoint& pos, const wxSize& size);
457814b5 58
329e86bf
RR
59 void ChooseColour(wxCommandEvent& event);
60 void ChooseFont(wxCommandEvent& event);
d93c719a 61 void LogDialog(wxCommandEvent& event);
457814b5
JS
62 void MessageBox(wxCommandEvent& event);
63 void SingleChoice(wxCommandEvent& event);
d6c9c1b7 64 void MultiChoice(wxCommandEvent& event);
457814b5 65 void TextEntry(wxCommandEvent& event);
a294c6d5 66 void PasswordEntry(wxCommandEvent& event);
c49245f8 67 void NumericEntry(wxCommandEvent& event);
457814b5 68 void FileOpen(wxCommandEvent& event);
35b45b33 69 void FileOpen2(wxCommandEvent& event);
c61f4f6d 70 void FilesOpen(wxCommandEvent& event);
457814b5
JS
71 void FileSave(wxCommandEvent& event);
72 void DirChoose(wxCommandEvent& event);
51a58d8b 73 void GenericDirChoose(wxCommandEvent& event);
c50f1fb9 74 void ShowTip(wxCommandEvent& event);
f6bcfd97 75 void ModalDlg(wxCommandEvent& event);
4c45f240 76 void ModelessDlg(wxCommandEvent& event);
abceee76 77 void ShowProgress(wxCommandEvent& event);
457814b5 78
dfad0599 79#if !defined(__WXMSW__) || wxTEST_GENERIC_DIALOGS_IN_MSW
329e86bf
RR
80 void ChooseColourGeneric(wxCommandEvent& event);
81 void ChooseFontGeneric(wxCommandEvent& event);
457814b5 82#endif
c49245f8 83
329e86bf 84 void OnExit(wxCommandEvent& event);
c49245f8 85
4c45f240
VZ
86 void OnButton(wxCommandEvent& event);
87
88private:
89 MyModelessDialog *m_dialog;
90
91 DECLARE_EVENT_TABLE()
457814b5
JS
92};
93
94class MyCanvas: public wxScrolledWindow
95{
c49245f8
VZ
96public:
97 MyCanvas(wxWindow *parent) : wxScrolledWindow(parent) { }
98
99 void OnPaint(wxPaintEvent& event);
100
101 DECLARE_EVENT_TABLE()
457814b5
JS
102};
103
104
105// Menu IDs
a294c6d5
VZ
106enum
107{
108 DIALOGS_CHOOSE_COLOUR = 1,
109 DIALOGS_CHOOSE_COLOUR_GENERIC,
110 DIALOGS_CHOOSE_FONT,
111 DIALOGS_CHOOSE_FONT_GENERIC,
112 DIALOGS_MESSAGE_BOX,
113 DIALOGS_SINGLE_CHOICE,
d6c9c1b7 114 DIALOGS_MULTI_CHOICE,
a294c6d5
VZ
115 DIALOGS_TEXT_ENTRY,
116 DIALOGS_PASSWORD_ENTRY,
117 DIALOGS_FILE_OPEN,
35b45b33 118 DIALOGS_FILE_OPEN2,
a294c6d5
VZ
119 DIALOGS_FILES_OPEN,
120 DIALOGS_FILE_SAVE,
121 DIALOGS_DIR_CHOOSE,
51a58d8b 122 DIALOGS_GENERIC_DIR_CHOOSE,
a294c6d5
VZ
123 DIALOGS_TIP,
124 DIALOGS_NUM_ENTRY,
4c45f240 125 DIALOGS_LOG_DIALOG,
f6bcfd97 126 DIALOGS_MODAL,
4c45f240 127 DIALOGS_MODELESS,
abceee76
VZ
128 DIALOGS_MODELESS_BTN,
129 DIALOGS_PROGRESS
a294c6d5 130};
457814b5
JS
131
132#endif
133