]>
Commit | Line | Data |
---|---|---|
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 | ||
33 | ||
34 | //--------------------------------------------------------------------------- | |
35 | ||
36 | class wxStatusBar : public wxWindow { | |
37 | public: | |
38 | wxStatusBar(wxWindow* parent, wxWindowID id, | |
39 | const wxPoint& pos = wxPyDefaultPosition, | |
40 | const wxSize& size = wxPyDefaultSize, | |
41 | long style = wxST_SIZEGRIP, | |
42 | char* name = "statusBar"); | |
43 | ||
44 | %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)" | |
45 | ||
46 | %addmethods { | |
47 | %new wxRect* GetFieldRect(long item) { | |
48 | wxRect* rect= new wxRect; | |
49 | self->GetFieldRect(item, *rect); | |
50 | return rect; | |
51 | } | |
52 | } | |
53 | int GetFieldsCount(void); | |
54 | wxString GetStatusText(int ir = 0); | |
55 | void DrawField(wxDC& dc, int i); | |
56 | void DrawFieldText(wxDC& dc, int i); | |
57 | void InitColours(void); | |
58 | ||
59 | // OnSysColourChanged(wxSysColourChangedEvent& event); | |
60 | ||
61 | void SetFieldsCount(int number = 1); | |
62 | void SetStatusText(const wxString& text, int i = 0); | |
63 | void SetStatusWidths(int LCOUNT, int* LIST); | |
64 | }; | |
65 | ||
66 | ||
67 | //--------------------------------------------------------------------------- | |
68 | ||
69 | class wxToolBarTool { | |
70 | public: | |
71 | wxToolBarTool(); | |
72 | ~wxToolBarTool(); | |
73 | #ifdef __WXMSW__ | |
74 | void SetSize( long w, long h ) { m_width = w; m_height = h; } | |
75 | long GetWidth () const { return m_width; } | |
76 | long GetHeight () const { return m_height; } | |
77 | #endif | |
78 | ||
79 | public: | |
80 | int m_toolStyle; | |
81 | wxObject * m_clientData; | |
82 | int m_index; | |
83 | #ifdef __WXMSW__ | |
84 | long m_x; | |
85 | long m_y; | |
86 | long m_width; | |
87 | long m_height; | |
88 | #endif | |
89 | bool m_toggleState; | |
90 | bool m_isToggle; | |
91 | bool m_deleteSecondBitmap; | |
92 | bool m_enabled; | |
93 | wxBitmap m_bitmap1; | |
94 | wxBitmap m_bitmap2; | |
95 | bool m_isMenuCommand; | |
96 | wxString m_shortHelpString; | |
97 | wxString m_longHelpString; | |
98 | }; | |
99 | ||
100 | ||
101 | ||
102 | // class wxToolBarBase : public wxControl { | |
103 | // public: | |
104 | ||
105 | class wxToolBar : public wxControl { | |
106 | public: | |
107 | wxToolBar(wxWindow* parent, wxWindowID id, | |
108 | const wxPoint& pos = wxPyDefaultPosition, | |
109 | const wxSize& size = wxPyDefaultSize, | |
110 | long style = wxTB_HORIZONTAL | wxNO_BORDER, | |
111 | char* name = "toolBar"); | |
112 | ||
113 | %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)" | |
114 | ||
115 | ||
116 | void AddSeparator(void); | |
117 | ||
118 | // Ignoge the clientData for now... | |
119 | %addmethods { | |
120 | wxToolBarTool* AddTool(int toolIndex, | |
121 | const wxBitmap& bitmap1, | |
122 | const wxBitmap& bitmap2 = wxNullBitmap, | |
123 | int isToggle = FALSE, | |
124 | long xPos = -1, | |
125 | long yPos = -1, | |
126 | //wxObject* clientData = NULL, | |
127 | const wxString& shortHelpString = wxPyEmptyStr, | |
128 | const wxString& longHelpString = wxPyEmptyStr) { | |
129 | return self->AddTool(toolIndex, bitmap1, bitmap2, | |
130 | isToggle, xPos, yPos, NULL, | |
131 | shortHelpString, longHelpString); | |
132 | } | |
133 | } | |
134 | ||
135 | // void DrawTool(wxMemoryDC& memDC, wxToolBarTool* tool); | |
136 | void EnableTool(int toolIndex, const bool enable); | |
137 | #ifdef __WXMSW__ | |
138 | wxToolBarTool* FindToolForPosition(const float x, const float y); | |
139 | wxSize GetToolSize(); | |
140 | wxSize GetToolBitmapSize(); | |
141 | // wxSize GetMargins(); | |
142 | wxSize GetMaxSize(); | |
143 | // wxObject* GetToolClientData(int toolIndex); | |
144 | #endif | |
145 | bool GetToolEnabled(int toolIndex); | |
146 | #ifdef __WXMSW__ | |
147 | wxString GetToolLongHelp(int toolIndex); | |
148 | int GetToolPacking(); | |
149 | int GetToolSeparation(); | |
150 | wxString GetToolShortHelp(int toolIndex); | |
151 | #endif | |
152 | bool GetToolState(int toolIndex); | |
153 | ||
154 | // TODO: figure out how to handle these | |
155 | //bool OnLeftClick(int toolIndex, bool toggleDown); | |
156 | //void OnMouseEnter(int toolIndex); | |
157 | //void OnRightClick(int toolIndex, float x, float y); | |
158 | ||
159 | ||
160 | #ifdef __WXMSW__ | |
161 | bool Realize(); | |
162 | #else | |
163 | void Realize(); | |
164 | #endif | |
165 | #ifdef __WXMSW__ | |
166 | void SetToolBitmapSize(const wxSize& size); | |
167 | void SetToolLongHelp(int toolIndex, const wxString& helpString); | |
168 | void SetToolShortHelp(int toolIndex, const wxString& helpString); | |
169 | #endif | |
170 | void SetMargins(const wxSize& size); | |
171 | void SetToolPacking(int packing); | |
172 | void SetToolSeparation(int separation); | |
173 | void ToggleTool(int toolIndex, const bool toggle); | |
174 | }; | |
175 | ||
176 | ||
177 | ||
178 | // // The Native Toolbar | |
179 | // class wxToolBar : public wxToolBarBase { | |
180 | // public: | |
181 | // wxToolBar(wxWindow* parent, wxWindowID id, | |
182 | // const wxPoint& pos = wxPyDefaultPosition, | |
183 | // const wxSize& size = wxPyDefaultSize, | |
184 | // long style = wxTB_HORIZONTAL | wxNO_BORDER, | |
185 | // char* name = "toolBar"); | |
186 | ||
187 | // %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)" | |
188 | ||
189 | // }; | |
190 | ||
191 | ||
192 | // // A generic toolbar | |
193 | // class wxToolBarSimple : public wxToolBarBase { | |
194 | // public: | |
195 | // wxToolBarSimple(wxWindow* parent, wxWindowID id, | |
196 | // const wxPoint& pos = wxPyDefaultPosition, | |
197 | // const wxSize& size = wxPyDefaultSize, | |
198 | // long style = wxTB_HORIZONTAL | wxNO_BORDER, | |
199 | // char* name = "toolBar"); | |
200 | ||
201 | // %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)" | |
202 | ||
203 | // }; | |
204 | ||
205 | ||
206 | //--------------------------------------------------------------------------- | |
207 | ||
208 | ///////////////////////////////////////////////////////////////////////////// | |
209 | // | |
210 | // $Log$ | |
211 | // Revision 1.2 1998/10/07 07:34:34 RD | |
212 | // Version 0.4.1 for wxGTK | |
213 | // | |
214 | // Revision 1.1 1998/10/02 06:40:42 RD | |
215 | // | |
216 | // Version 0.4 of wxPython for MSW. | |
217 | // | |
218 | // | |
219 | ||
220 | ||
221 | ||
222 | ||
223 | ||
224 | ||
225 |