]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _statusbar.i | |
3 | // Purpose: SWIG interface defs for wxStatusBar | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 24-Aug-1998 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | ||
18 | %{ | |
19 | %} | |
20 | ||
21 | //--------------------------------------------------------------------------- | |
22 | %newgroup; | |
23 | ||
24 | ||
9f8a9f54 RD |
25 | enum { |
26 | wxSB_NORMAL, | |
27 | wxSB_FLAT, | |
28 | wxSB_RAISED | |
29 | }; | |
30 | ||
31 | ||
69d81895 | 32 | |
9f8a9f54 | 33 | |
d14a1e28 | 34 | // wxStatusBar: a window near the bottom of the frame used for status info |
ab1f7d2a | 35 | MustHaveApp(wxStatusBar); |
d14a1e28 RD |
36 | class wxStatusBar : public wxWindow |
37 | { | |
38 | public: | |
2b9048c5 RD |
39 | %pythonAppend wxStatusBar "self._setOORInfo(self)" |
40 | %pythonAppend wxStatusBar() "" | |
b39c3fa0 | 41 | %typemap(out) wxStatusBar*; // turn off this typemap |
d14a1e28 RD |
42 | |
43 | wxStatusBar(wxWindow* parent, wxWindowID id = -1, | |
69d81895 | 44 | long style = wxDEFAULT_STATUSBAR_STYLE, |
d14a1e28 | 45 | const wxString& name = wxPyStatusLineNameStr); |
1b8c7ba6 | 46 | %RenameCtor(PreStatusBar, wxStatusBar()); |
d14a1e28 | 47 | |
b39c3fa0 RD |
48 | // Turn it back on again |
49 | %typemap(out) wxStatusBar* { $result = wxPyMake_wxObject($1, $owner); } | |
50 | ||
d5573410 | 51 | bool Create(wxWindow* parent, wxWindowID id=-1, |
d14a1e28 RD |
52 | long style = wxST_SIZEGRIP, |
53 | const wxString& name = wxPyStatusLineNameStr); | |
54 | ||
55 | // set the number of fields and call SetStatusWidths(widths) if widths are | |
56 | // given | |
57 | virtual void SetFieldsCount(int number = 1 /*, const int *widths = NULL*/); | |
58 | int GetFieldsCount() const; | |
59 | ||
60 | virtual void SetStatusText(const wxString& text, int number = 0); | |
61 | virtual wxString GetStatusText(int number = 0) const; | |
62 | ||
63 | void PushStatusText(const wxString& text, int number = 0); | |
64 | void PopStatusText(int number = 0); | |
65 | ||
66 | ||
67 | // set status field widths as absolute numbers: positive widths mean that | |
68 | // the field has the specified absolute width, negative widths are | |
69 | // interpreted as the sizer options, i.e. the extra space (total space | |
70 | // minus the sum of fixed width fields) is divided between the fields with | |
71 | // negative width according to the abs value of the width (field with width | |
72 | // -2 grows twice as much as one with width -1 &c) | |
9f8a9f54 | 73 | virtual void SetStatusWidths(int widths, const int* widths_field); |
d14a1e28 | 74 | |
9f8a9f54 RD |
75 | |
76 | // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D | |
77 | // border around a field, wxSB_FLAT for no border around a field, so that it | |
78 | // appears flat or wxSB_POPOUT to make the field appear raised. | |
79 | // Setting field styles only works on wxMSW | |
80 | virtual void SetStatusStyles(int styles, const int* styles_field); | |
81 | ||
82 | ||
d14a1e28 | 83 | // Get the position and size of the field's internal bounding rectangle |
7722248d RD |
84 | %extend { |
85 | wxRect GetFieldRect(int i) { | |
86 | wxRect r; | |
87 | self->GetFieldRect(i, r); | |
88 | return r; | |
89 | } | |
90 | } | |
91 | ||
d14a1e28 RD |
92 | // sets the minimal vertical size of the status bar |
93 | virtual void SetMinHeight(int height); | |
94 | ||
95 | // get the dimensions of the horizontal and vertical borders | |
96 | virtual int GetBorderX() const; | |
97 | virtual int GetBorderY() const; | |
880715c9 RD |
98 | |
99 | static wxVisualAttributes | |
100 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
e8b49596 RD |
101 | |
102 | %pythoncode { | |
103 | def GetFields(self): | |
104 | """Return a list of field values in the status bar. """ | |
105 | return [self.GetStatusText(i) for i in range(self.GetFieldsCount())] | |
106 | ||
107 | def SetFields(self, items): | |
108 | """Set the values of the statusbar fields from a list of strings. """ | |
109 | self.SetFieldsCount(len(items)) | |
110 | for i in range(len(items)): | |
111 | self.SetStatusText(items[i], i) | |
112 | } | |
7012bb9f RD |
113 | |
114 | %property(BorderX, GetBorderX, doc="See `GetBorderX`"); | |
115 | %property(BorderY, GetBorderY, doc="See `GetBorderY`"); | |
116 | %property(FieldRect, GetFieldRect, doc="See `GetFieldRect`"); | |
117 | %property(Fields, GetFields, SetFields, doc="See `GetFields` and `SetFields`"); | |
118 | %property(FieldsCount, GetFieldsCount, SetFieldsCount, doc="See `GetFieldsCount` and `SetFieldsCount`"); | |
119 | %property(StatusText, GetStatusText, SetStatusText, doc="See `GetStatusText` and `SetStatusText`"); | |
d14a1e28 RD |
120 | }; |
121 | ||
122 | ||
123 | //--------------------------------------------------------------------------- |