]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: tbar95.h | |
3 | // Purpose: wxToolBar95 (Windows 95 toolbar) class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart and Markus Holzem | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __TBAR95H__ | |
13 | #define __TBAR95H__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "tbar95.h" | |
17 | #endif | |
18 | ||
19 | #if USE_BUTTONBAR && USE_TOOLBAR | |
20 | #include "wx/tbarbase.h" | |
21 | ||
22 | WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr; | |
23 | ||
24 | #define DEFAULTBITMAPX 16 | |
25 | #define DEFAULTBITMAPY 15 | |
26 | #define DEFAULTBUTTONX 24 | |
27 | #define DEFAULTBUTTONY 24 | |
28 | #define DEFAULTBARHEIGHT 27 | |
29 | ||
30 | class WXDLLEXPORT wxToolBar95: public wxToolBarBase | |
31 | { | |
32 | DECLARE_DYNAMIC_CLASS(wxToolBar95) | |
33 | public: | |
34 | /* | |
35 | * Public interface | |
36 | */ | |
37 | ||
38 | wxToolBar95(void); | |
39 | ||
40 | #if WXWIN_COMPATIBILITY > 0 | |
41 | inline wxToolBar95(wxWindow *parent, int x, int y, int w, int h, | |
42 | long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 2, | |
43 | const char *name = wxToolBarNameStr) | |
44 | { | |
45 | Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name); | |
46 | } | |
47 | #endif | |
48 | inline wxToolBar95(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
49 | const long style = wxNO_BORDER, const int orientation = wxVERTICAL, | |
50 | const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr) | |
51 | { | |
52 | Create(parent, id, pos, size, style, orientation, RowsOrColumns, name); | |
53 | } | |
54 | ~wxToolBar95(void); | |
55 | ||
56 | bool Create(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
57 | const long style = wxNO_BORDER, const int orientation = wxVERTICAL, | |
58 | const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr); | |
59 | ||
60 | // Call default behaviour | |
61 | void OnPaint(wxPaintEvent& event) { Default() ; } | |
62 | void OnSize(wxSizeEvent& event) { Default() ; } | |
63 | void OnMouseEvent(wxMouseEvent& event) { Default() ; } | |
64 | void OnKillFocus(wxFocusEvent& event) { Default() ; } | |
65 | ||
66 | // Handle wxToolBar95 events | |
67 | ||
68 | // If pushedBitmap is NULL, a reversed version of bitmap is | |
69 | // created and used as the pushed/toggled image. | |
70 | // If toggle is TRUE, the button toggles between the two states. | |
71 | wxToolBarTool *AddTool(const int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap, | |
72 | const bool toggle = FALSE, const long xPos = -1, const long yPos = -1, wxObject *clientData = NULL, | |
73 | const wxString& helpString1 = "", const wxString& helpString2 = ""); | |
74 | ||
75 | // New members | |
76 | // Set default bitmap size | |
77 | void SetDefaultSize(const wxSize& size); | |
78 | void EnableTool(const int toolIndex, const bool enable); // additional drawing on enabling | |
79 | void ToggleTool(const int toolIndex, const bool toggle); // toggle is TRUE if toggled on | |
80 | void ClearTools(void); | |
81 | ||
82 | // The button size is bigger than the bitmap size | |
83 | wxSize GetDefaultButtonSize(void) const; | |
84 | ||
85 | wxSize GetMaxSize(void) const; | |
86 | void GetSize(int *w, int *y) const; | |
87 | ||
88 | // Add all the buttons: required for Win95. | |
89 | virtual bool CreateTools(void); | |
90 | virtual void SetRows(const int nRows); | |
91 | virtual void Layout(void) {} | |
92 | ||
93 | // IMPLEMENTATION | |
94 | bool MSWCommand(const WXUINT param, const WXWORD id); | |
95 | bool MSWNotify(const WXWPARAM wParam, const WXLPARAM lParam); | |
96 | ||
97 | // Responds to colour changes | |
98 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
99 | ||
100 | protected: | |
101 | WXHBITMAP m_hBitmap; | |
102 | ||
103 | DECLARE_EVENT_TABLE() | |
104 | }; | |
105 | ||
106 | #endif // USE_TOOL/BUTTONBAR | |
107 | #endif | |
108 | // __TBAR95H__ |