]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: tbargtk.h | |
3 | // Purpose: GTK toolbar | |
4 | // Author: Robert Roebling | |
c801d85f KB |
5 | // RCS-ID: $Id$ |
6 | // Copyright: (c) Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef __TBARGTKH__ | |
11 | #define __TBARGTKH__ | |
12 | ||
13 | #ifdef __GNUG__ | |
14 | #pragma interface | |
15 | #endif | |
16 | ||
17 | #include "wx/defs.h" | |
18 | #include "wx/control.h" | |
ac57418f | 19 | #include "wx/bitmap.h" |
4fcd73bd | 20 | #include "wx/tbarbase.h" |
c801d85f KB |
21 | |
22 | //----------------------------------------------------------------------------- | |
23 | // classes | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | class wxToolBarTool; | |
716b7364 | 27 | class wxToolBar; |
c801d85f KB |
28 | |
29 | //----------------------------------------------------------------------------- | |
30 | // constants | |
31 | //----------------------------------------------------------------------------- | |
32 | ||
33 | #define wxTOOL_STYLE_BUTTON 1 | |
34 | #define wxTOOL_STYLE_SEPARATOR 2 | |
35 | ||
36 | //----------------------------------------------------------------------------- | |
37 | // global data | |
38 | //----------------------------------------------------------------------------- | |
39 | ||
3b90345b | 40 | extern const wxChar *wxToolBarNameStr; |
c801d85f | 41 | |
c801d85f | 42 | //----------------------------------------------------------------------------- |
716b7364 | 43 | // wxToolBar |
c801d85f KB |
44 | //----------------------------------------------------------------------------- |
45 | ||
716b7364 | 46 | class wxToolBar: public wxControl |
c801d85f | 47 | { |
b1da76e1 | 48 | DECLARE_EVENT_TABLE() |
716b7364 | 49 | DECLARE_DYNAMIC_CLASS(wxToolBar) |
c801d85f KB |
50 | |
51 | public: | |
52 | ||
716b7364 RR |
53 | wxToolBar(void); |
54 | wxToolBar( wxWindow *parent, wxWindowID id, | |
c801d85f | 55 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 | 56 | long style = 0, const wxString& name = wxToolBarNameStr ); |
716b7364 | 57 | ~wxToolBar(void); |
c801d85f | 58 | |
debe6624 | 59 | bool Create( wxWindow *parent, wxWindowID id, |
c801d85f | 60 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 | 61 | long style = 0, const wxString& name = wxToolBarNameStr); |
c801d85f KB |
62 | |
63 | // Only allow toggle if returns TRUE. Call when left button up. | |
64 | virtual bool OnLeftClick(int toolIndex, bool toggleDown); | |
65 | ||
66 | // Call when right button down. | |
67 | virtual void OnRightClick(int toolIndex, float x, float y); | |
68 | ||
69 | // Called when the mouse cursor enters a tool bitmap. | |
70 | // Argument is -1 if mouse is exiting the toolbar. | |
71 | virtual void OnMouseEnter(int toolIndex); | |
72 | ||
73 | // If pushedBitmap is NULL, a reversed version of bitmap is | |
74 | // created and used as the pushed/toggled image. | |
75 | // If toggle is TRUE, the button toggles between the two states. | |
debe6624 JS |
76 | virtual wxToolBarTool *AddTool( int toolIndex, const wxBitmap& bitmap, |
77 | const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE, | |
c67daf87 | 78 | float xPos = -1, float yPos = -1, wxObject *clientData = (wxObject *)NULL, |
c801d85f KB |
79 | const wxString& helpString1 = "", const wxString& helpString2 = ""); |
80 | virtual void AddSeparator(void); | |
81 | virtual void ClearTools(void); | |
46dc76ba | 82 | |
1144d24d | 83 | virtual bool Realize(void); |
c801d85f | 84 | |
debe6624 JS |
85 | virtual void EnableTool(int toolIndex, bool enable); |
86 | virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on | |
debe6624 | 87 | virtual wxObject *GetToolClientData(int index) const; |
c801d85f | 88 | |
debe6624 JS |
89 | virtual bool GetToolState(int toolIndex) const; |
90 | virtual bool GetToolEnabled(int toolIndex) const; | |
c801d85f | 91 | |
debe6624 | 92 | virtual void SetMargins(int x, int y); |
c801d85f | 93 | void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); }; |
1144d24d RR |
94 | virtual wxSize GetToolMargins(void) { return wxSize(m_xMargin, m_yMargin); } |
95 | ||
debe6624 JS |
96 | virtual void SetToolPacking(int packing); |
97 | virtual void SetToolSeparation(int separation); | |
1144d24d RR |
98 | virtual int GetToolPacking(); |
99 | virtual int GetToolSeparation(); | |
100 | ||
101 | virtual wxString GetToolLongHelp(int toolIndex); | |
102 | virtual wxString GetToolShortHelp(int toolIndex); | |
103 | ||
104 | virtual void SetToolLongHelp(int toolIndex, const wxString& helpString); | |
105 | virtual void SetToolShortHelp(int toolIndex, const wxString& helpString); | |
b1da76e1 RR |
106 | |
107 | void OnIdle( wxIdleEvent &ievent ); | |
debe6624 | 108 | |
b46e8696 | 109 | // implementation |
c801d85f KB |
110 | |
111 | GtkToolbar *m_toolbar; | |
1144d24d | 112 | int m_separation; |
c801d85f | 113 | wxList m_tools; |
1144d24d | 114 | |
83624f79 RR |
115 | GdkColor *m_fg; |
116 | GdkColor *m_bg; | |
1144d24d RR |
117 | int m_xMargin; |
118 | int m_yMargin; | |
119 | bool m_hasToolAlready; | |
c801d85f KB |
120 | }; |
121 | ||
122 | #endif | |
123 | // __TBARGTKH__ |