]> git.saurik.com Git - wxWidgets.git/blob - contrib/samples/fl/fl_demo2/fl_demo2.h
Various tweaks, fixes, and additions
[wxWidgets.git] / contrib / samples / fl / fl_demo2 / fl_demo2.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: No names yet.
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
5 // Modified by:
6 // Created: 04/11/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __FLDEMO_G__
13 #define __FLDEMO_G__
14
15 // ID for the menu commands
16
17 #define MINIMAL_QUIT 1
18 #define MINIMAL_ABOUT 102
19
20 #define ID_LOAD 103
21 #define ID_STORE 104
22 #define ID_AUTOSAVE 105
23 //#define ID_SETTINGS 106
24 #define ID_REMOVE 107
25 #define ID_REMOVEALL 108
26 #define ID_RECREATE 109
27 #define ID_ACTIVATE 110
28 #define ID_FIRST 111
29 #define ID_SECOND 112
30 #define ID_THIRD 113
31
32 #define ID_SAY_ITSOK 114
33 #define ID_BTN_YES 115
34 #define ID_BTN_NO 116
35 #define ID_BTN_ESC 117
36
37 #define MAX_LAYOUTS 3
38
39 #define FIRST_LAYOUT 0
40 #define SECOND_LAYOUT 1
41 #define THIRD_LAYOUT 2
42
43 class wxFrameLayout;
44 class wxObjectStorage;
45
46 // FOR NOW::
47 typedef wxPanel MyTestPanel;
48
49 // Define a new application type
50
51 class MyApp: public wxApp
52 {
53 public:
54 bool OnInit(void);
55 };
56
57 // Define a new frame type
58
59 class MyFrame: public wxFrame
60 {
61 protected:
62
63 wxFrameLayout* mLayouts[MAX_LAYOUTS];
64
65 wxFrameLayout* mpNestedLayout;
66 wxFrameLayout* mpAboutBoxLayout;
67
68 int mActiveLayoutNo;
69 bool mAutoSave;
70 bool mSavedAlready;
71
72 // container windows:
73
74 wxTextCtrl* mpClntWindow;
75 wxPanel* mpInternalFrm;
76
77 wxImageList mImageList;
78
79 wxFrame mAboutBox;
80
81 // helpers for control-creation
82
83 wxTextCtrl* CreateTxtCtrl ( const wxString& txt = "wxTextCtrl", wxWindow* parent = NULL );
84 wxTreeCtrl* CreateTreeCtrl( const wxString& label = "TreeCtrl" );
85 wxChoice* CreateChoice ( const wxString& txt = "Choice1" );
86 wxButton* CreateButton ( const wxString& label = "wxButton", wxWindow* pParent = NULL, long id = ID_SAY_ITSOK );
87
88 // helpers for layout-creation
89
90 void AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent );
91 wxWindow* CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent );
92
93 void DropInSomeBars( int layoutNo );
94 void CreateLayout( int layoutNo );
95 void RemoveLayout( int layoutNo );
96
97 void InitAboutBox();
98
99 void ActivateLayout( int layoutNo );
100
101 public: /* public */
102
103 MyFrame( wxFrame *frame, char *title, int x, int y, int w, int h);
104
105 ~MyFrame();
106
107 void SyncMenuBarItems();
108
109 // event handlers
110
111 bool OnClose(void);
112
113 void OnLoad( wxCommandEvent& event );
114 void OnStore( wxCommandEvent& event );
115 void OnAutoSave( wxCommandEvent& event );
116 void OnQuit(wxCommandEvent& event);
117 void OnAbout(wxCommandEvent& event);
118 //void OnSettings( wxCommandEvent& event );
119 void OnRemove( wxCommandEvent& event );
120 void OnRemoveAll( wxCommandEvent& event );
121 void OnRecreate( wxCommandEvent& event );
122 void OnFirst( wxCommandEvent& event );
123 void OnSecond( wxCommandEvent& event );
124 void OnThird( wxCommandEvent& event );
125
126 void OnSayItsOk( wxCommandEvent& event );
127 void OnBtnYes( wxCommandEvent& event );
128 void OnBtnNo( wxCommandEvent& event );
129 void OnBtnEsc( wxCommandEvent& event );
130
131 void OnChar( wxKeyEvent& event );
132
133 DECLARE_EVENT_TABLE()
134 };
135
136 // Define a new button type, StartButton95 (Just for fun)
137
138 class StartButton95 : public wxPanel
139 {
140 DECLARE_DYNAMIC_CLASS( StartButton95 )
141
142 bool m_bPressed;
143 wxBitmap m_PBmp;
144 wxBitmap m_DBmp;
145
146 public:
147 StartButton95(void) : m_bPressed(FALSE) {}
148
149 StartButton95(wxWindow* parent)
150 : m_bPressed(FALSE) { wxPanel::Create(parent,-1); }
151
152 void OnMouseDown( wxMouseEvent& event );
153 void OnMouseUp( wxMouseEvent& event );
154 void OnPaint( wxPaintEvent& event );
155
156 DECLARE_EVENT_TABLE();
157 };
158
159 #endif
160