extracted platform-specific code to determine static box borders to wxStaticBox:...
[wxWidgets.git] / include / wx / statbox.h
1 #ifndef _WX_STATBOX_H_BASE_
2 #define _WX_STATBOX_H_BASE_
3
4 #if wxUSE_STATBOX
5
6 #include "wx/control.h"
7
8 extern WXDLLEXPORT_DATA(const wxChar*) wxStaticBoxNameStr;
9
10 // ----------------------------------------------------------------------------
11 // wxStaticBox: a grouping box with a label
12 // ----------------------------------------------------------------------------
13
14 class WXDLLEXPORT wxStaticBoxBase : public wxControl
15 {
16 public:
17 wxStaticBoxBase() { }
18
19 // overriden base class virtuals
20 virtual bool AcceptsFocus() const { return false; }
21 virtual bool HasTransparentBackground() { return true; }
22
23 // implementation only: this is used by wxStaticBoxSizer to account for the
24 // need for extra space taken by the static box
25 //
26 // the top border is the margin at the top (where the title is),
27 // borderOther is the margin on all other sides
28 virtual void GetBordersForSizer(int *borderTop, int *borderOther) const
29 {
30 static const int BORDER = 5; // FIXME: hardcoded value
31
32 *borderTop = GetLabel().empty() ? BORDER : GetCharHeight();
33 *borderOther = BORDER;
34 }
35
36 private:
37 DECLARE_NO_COPY_CLASS(wxStaticBoxBase)
38 };
39
40 #if defined(__WXUNIVERSAL__)
41 #include "wx/univ/statbox.h"
42 #elif defined(__WXMSW__)
43 #include "wx/msw/statbox.h"
44 #elif defined(__WXMOTIF__)
45 #include "wx/motif/statbox.h"
46 #elif defined(__WXGTK__)
47 #include "wx/gtk/statbox.h"
48 #elif defined(__WXMAC__)
49 #include "wx/mac/statbox.h"
50 #elif defined(__WXCOCOA__)
51 #include "wx/cocoa/statbox.h"
52 #elif defined(__WXPM__)
53 #include "wx/os2/statbox.h"
54 #endif
55
56 #endif // wxUSE_STATBOX
57
58 #endif
59 // _WX_STATBOX_H_BASE_