]>
Commit | Line | Data |
---|---|---|
9c039d08 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: stattool.i | |
3 | // Purpose: SWIG definitions for StatusBar and ToolBar classes | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 08/24/1998 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
14 | %module stattool | |
15 | ||
16 | %{ | |
17 | #include "helpers.h" | |
18 | #include <wx/toolbar.h> | |
19 | #include <wx/tbarsmpl.h> | |
20 | %} | |
21 | ||
22 | //---------------------------------------------------------------------- | |
23 | ||
24 | %include typemaps.i | |
25 | %include my_typemaps.i | |
26 | ||
27 | // Import some definitions of other classes, etc. | |
28 | %import _defs.i | |
29 | %import misc.i | |
30 | %import windows.i | |
31 | %import controls.i | |
32 | ||
b8b8dda7 | 33 | %pragma(python) code = "import wx" |
9c039d08 RD |
34 | |
35 | //--------------------------------------------------------------------------- | |
36 | ||
37 | class wxStatusBar : public wxWindow { | |
38 | public: | |
39 | wxStatusBar(wxWindow* parent, wxWindowID id, | |
40 | const wxPoint& pos = wxPyDefaultPosition, | |
41 | const wxSize& size = wxPyDefaultSize, | |
42 | long style = wxST_SIZEGRIP, | |
43 | char* name = "statusBar"); | |
44 | ||
b8b8dda7 | 45 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 RD |
46 | |
47 | %addmethods { | |
48 | %new wxRect* GetFieldRect(long item) { | |
49 | wxRect* rect= new wxRect; | |
50 | self->GetFieldRect(item, *rect); | |
51 | return rect; | |
52 | } | |
53 | } | |
54 | int GetFieldsCount(void); | |
55 | wxString GetStatusText(int ir = 0); | |
56 | void DrawField(wxDC& dc, int i); | |
57 | void DrawFieldText(wxDC& dc, int i); | |
58 | void InitColours(void); | |
59 | ||
60 | // OnSysColourChanged(wxSysColourChangedEvent& event); | |
61 | ||
62 | void SetFieldsCount(int number = 1); | |
63 | void SetStatusText(const wxString& text, int i = 0); | |
64 | void SetStatusWidths(int LCOUNT, int* LIST); | |
65 | }; | |
66 | ||
67 | ||
68 | //--------------------------------------------------------------------------- | |
69 | ||
70 | class wxToolBarTool { | |
71 | public: | |
72 | wxToolBarTool(); | |
73 | ~wxToolBarTool(); | |
b26e2dc4 | 74 | #ifdef __WXMSW__ |
9c039d08 RD |
75 | void SetSize( long w, long h ) { m_width = w; m_height = h; } |
76 | long GetWidth () const { return m_width; } | |
77 | long GetHeight () const { return m_height; } | |
b26e2dc4 | 78 | #endif |
9c039d08 RD |
79 | |
80 | public: | |
81 | int m_toolStyle; | |
82 | wxObject * m_clientData; | |
83 | int m_index; | |
b26e2dc4 | 84 | #ifdef __WXMSW__ |
9c039d08 RD |
85 | long m_x; |
86 | long m_y; | |
87 | long m_width; | |
88 | long m_height; | |
b26e2dc4 | 89 | #endif |
9c039d08 RD |
90 | bool m_toggleState; |
91 | bool m_isToggle; | |
92 | bool m_deleteSecondBitmap; | |
93 | bool m_enabled; | |
94 | wxBitmap m_bitmap1; | |
95 | wxBitmap m_bitmap2; | |
96 | bool m_isMenuCommand; | |
97 | wxString m_shortHelpString; | |
98 | wxString m_longHelpString; | |
99 | }; | |
100 | ||
101 | ||
102 | ||
b26e2dc4 RD |
103 | // class wxToolBarBase : public wxControl { |
104 | // public: | |
105 | ||
106 | class wxToolBar : public wxControl { | |
9c039d08 | 107 | public: |
b26e2dc4 RD |
108 | wxToolBar(wxWindow* parent, wxWindowID id, |
109 | const wxPoint& pos = wxPyDefaultPosition, | |
110 | const wxSize& size = wxPyDefaultSize, | |
111 | long style = wxTB_HORIZONTAL | wxNO_BORDER, | |
112 | char* name = "toolBar"); | |
113 | ||
b8b8dda7 | 114 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 RD |
115 | |
116 | ||
08127323 | 117 | void AddSeparator(); |
9c039d08 RD |
118 | |
119 | // Ignoge the clientData for now... | |
120 | %addmethods { | |
121 | wxToolBarTool* AddTool(int toolIndex, | |
122 | const wxBitmap& bitmap1, | |
123 | const wxBitmap& bitmap2 = wxNullBitmap, | |
124 | int isToggle = FALSE, | |
125 | long xPos = -1, | |
126 | long yPos = -1, | |
127 | //wxObject* clientData = NULL, | |
128 | const wxString& shortHelpString = wxPyEmptyStr, | |
129 | const wxString& longHelpString = wxPyEmptyStr) { | |
130 | return self->AddTool(toolIndex, bitmap1, bitmap2, | |
131 | isToggle, xPos, yPos, NULL, | |
132 | shortHelpString, longHelpString); | |
133 | } | |
08127323 RD |
134 | |
135 | wxToolBarTool* AddSimpleTool(int toolIndex, | |
136 | const wxBitmap& bitmap, | |
137 | const wxString& shortHelpString = wxPyEmptyStr, | |
138 | const wxString& longHelpString = wxPyEmptyStr) { | |
139 | return self->AddTool(toolIndex, bitmap, wxNullBitmap, | |
140 | FALSE, -1, -1, NULL, | |
141 | shortHelpString, longHelpString); | |
142 | } | |
9c039d08 RD |
143 | } |
144 | ||
08127323 | 145 | |
9c039d08 RD |
146 | // void DrawTool(wxMemoryDC& memDC, wxToolBarTool* tool); |
147 | void EnableTool(int toolIndex, const bool enable); | |
b26e2dc4 | 148 | #ifdef __WXMSW__ |
9c039d08 RD |
149 | wxToolBarTool* FindToolForPosition(const float x, const float y); |
150 | wxSize GetToolSize(); | |
151 | wxSize GetToolBitmapSize(); | |
4f22cf8d | 152 | void SetToolBitmapSize(const wxSize& size); |
9c039d08 RD |
153 | // wxSize GetMargins(); |
154 | wxSize GetMaxSize(); | |
155 | // wxObject* GetToolClientData(int toolIndex); | |
b26e2dc4 | 156 | #endif |
9c039d08 RD |
157 | bool GetToolEnabled(int toolIndex); |
158 | wxString GetToolLongHelp(int toolIndex); | |
159 | int GetToolPacking(); | |
160 | int GetToolSeparation(); | |
161 | wxString GetToolShortHelp(int toolIndex); | |
162 | bool GetToolState(int toolIndex); | |
163 | ||
164 | // TODO: figure out how to handle these | |
165 | //bool OnLeftClick(int toolIndex, bool toggleDown); | |
166 | //void OnMouseEnter(int toolIndex); | |
167 | //void OnRightClick(int toolIndex, float x, float y); | |
168 | ||
169 | bool Realize(); | |
08127323 | 170 | |
9c039d08 | 171 | void SetToolLongHelp(int toolIndex, const wxString& helpString); |
9c039d08 | 172 | void SetToolShortHelp(int toolIndex, const wxString& helpString); |
b26e2dc4 RD |
173 | void SetMargins(const wxSize& size); |
174 | void SetToolPacking(int packing); | |
9c039d08 RD |
175 | void SetToolSeparation(int separation); |
176 | void ToggleTool(int toolIndex, const bool toggle); | |
177 | }; | |
178 | ||
179 | ||
180 | ||
b26e2dc4 RD |
181 | // // The Native Toolbar |
182 | // class wxToolBar : public wxToolBarBase { | |
183 | // public: | |
184 | // wxToolBar(wxWindow* parent, wxWindowID id, | |
185 | // const wxPoint& pos = wxPyDefaultPosition, | |
186 | // const wxSize& size = wxPyDefaultSize, | |
187 | // long style = wxTB_HORIZONTAL | wxNO_BORDER, | |
188 | // char* name = "toolBar"); | |
9c039d08 | 189 | |
b8b8dda7 | 190 | // %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 | 191 | |
b26e2dc4 | 192 | // }; |
9c039d08 RD |
193 | |
194 | ||
b26e2dc4 RD |
195 | // // A generic toolbar |
196 | // class wxToolBarSimple : public wxToolBarBase { | |
197 | // public: | |
198 | // wxToolBarSimple(wxWindow* parent, wxWindowID id, | |
199 | // const wxPoint& pos = wxPyDefaultPosition, | |
200 | // const wxSize& size = wxPyDefaultSize, | |
201 | // long style = wxTB_HORIZONTAL | wxNO_BORDER, | |
202 | // char* name = "toolBar"); | |
9c039d08 | 203 | |
b8b8dda7 | 204 | // %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 | 205 | |
b26e2dc4 | 206 | // }; |
9c039d08 RD |
207 | |
208 | ||
209 | //--------------------------------------------------------------------------- | |
210 | ||
211 | ///////////////////////////////////////////////////////////////////////////// | |
212 | // | |
213 | // $Log$ | |
08127323 RD |
214 | // Revision 1.5 1999/01/30 07:30:15 RD |
215 | // Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. | |
216 | // | |
217 | // Various cleanup, tweaks, minor additions, etc. to maintain | |
218 | // compatibility with the current wxWindows. | |
219 | // | |
4f22cf8d | 220 | // Revision 1.4 1998/12/17 14:07:43 RR |
08127323 | 221 | // |
4f22cf8d RR |
222 | // Removed minor differences between wxMSW and wxGTK |
223 | // | |
b8b8dda7 RD |
224 | // Revision 1.3 1998/12/15 20:41:23 RD |
225 | // Changed the import semantics from "from wxPython import *" to "from | |
226 | // wxPython.wx import *" This is for people who are worried about | |
227 | // namespace pollution, they can use "from wxPython import wx" and then | |
228 | // prefix all the wxPython identifiers with "wx." | |
229 | // | |
230 | // Added wxTaskbarIcon for wxMSW. | |
231 | // | |
232 | // Made the events work for wxGrid. | |
233 | // | |
234 | // Added wxConfig. | |
235 | // | |
236 | // Added wxMiniFrame for wxGTK, (untested.) | |
237 | // | |
238 | // Changed many of the args and return values that were pointers to gdi | |
239 | // objects to references to reflect changes in the wxWindows API. | |
240 | // | |
241 | // Other assorted fixes and additions. | |
242 | // | |
b26e2dc4 RD |
243 | // Revision 1.2 1998/10/07 07:34:34 RD |
244 | // Version 0.4.1 for wxGTK | |
245 | // | |
9c039d08 | 246 | // Revision 1.1 1998/10/02 06:40:42 RD |
b26e2dc4 | 247 | // |
9c039d08 RD |
248 | // Version 0.4 of wxPython for MSW. |
249 | // | |
250 | // | |
251 | ||
252 | ||
253 | ||
254 | ||
255 | ||
256 | ||
257 |