]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_statusbar.i
disown wxPyXmlResourceHandler
[wxWidgets.git] / wxPython / src / _statusbar.i
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
25 enum {
26 wxSB_NORMAL,
27 wxSB_FLAT,
28 wxSB_RAISED
29 };
30
31
32
33
34 // wxStatusBar: a window near the bottom of the frame used for status info
35 MustHaveApp(wxStatusBar);
36 class wxStatusBar : public wxWindow
37 {
38 public:
39 %pythonAppend wxStatusBar "self._setOORInfo(self)"
40 %pythonAppend wxStatusBar() ""
41 %typemap(out) wxStatusBar*; // turn off this typemap
42
43 wxStatusBar(wxWindow* parent, wxWindowID id = -1,
44 long style = wxDEFAULT_STATUSBAR_STYLE,
45 const wxString& name = wxPyStatusLineNameStr);
46 %RenameCtor(PreStatusBar, wxStatusBar());
47
48 // Turn it back on again
49 %typemap(out) wxStatusBar* { $result = wxPyMake_wxObject($1, $owner); }
50
51 bool Create(wxWindow* parent, wxWindowID id=-1,
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)
73 virtual void SetStatusWidths(int widths, const int* widths_field);
74
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
83 // Get the position and size of the field's internal bounding rectangle
84 %extend {
85 wxRect GetFieldRect(int i) {
86 wxRect r;
87 self->GetFieldRect(i, r);
88 return r;
89 }
90 }
91
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;
98
99 static wxVisualAttributes
100 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
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 }
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`");
120 };
121
122
123 //---------------------------------------------------------------------------