]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/tbargtk.h
changed the notebook control to use AddPage() interface (Julian's version
[wxWidgets.git] / include / wx / gtk1 / tbargtk.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tbargtk.h
3 // Purpose: GTK toolbar
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __TBARGTKH__
13 #define __TBARGTKH__
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/control.h"
21
22 //-----------------------------------------------------------------------------
23 // classes
24 //-----------------------------------------------------------------------------
25
26 class wxToolBarTool;
27 class wxToolBarGTK;
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
40 extern const char *wxToolBarNameStr;
41
42 //-----------------------------------------------------------------------------
43 // wxToolBarTool
44 //-----------------------------------------------------------------------------
45
46 class wxToolBarTool: public wxObject
47 {
48 DECLARE_DYNAMIC_CLASS(wxToolBarTool)
49
50 public:
51
52 wxToolBarTool(void) {};
53 wxToolBarTool( wxToolBarGTK *owner, const int theIndex = 0,
54 const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
55 const bool toggle = FALSE, wxObject *clientData = NULL,
56 const wxString& shortHelpString = "", const wxString& longHelpString = "");
57 ~wxToolBarTool(void);
58
59 public:
60
61 int m_toolStyle;
62 wxObject *m_clientData;
63 int m_index;
64 bool m_toggleState;
65 bool m_isToggle;
66 bool m_deleteSecondBitmap;
67 bool m_enabled;
68 wxBitmap m_bitmap1;
69 wxBitmap m_bitmap2;
70 bool m_isMenuCommand;
71 wxString m_shortHelpString;
72 wxString m_longHelpString;
73 wxToolBarGTK *m_owner;
74 };
75
76 //-----------------------------------------------------------------------------
77 // wxToolBarGTK
78 //-----------------------------------------------------------------------------
79
80 class wxToolBarGTK: public wxControl
81 {
82 DECLARE_DYNAMIC_CLASS(wxToolBarGTK)
83
84 public:
85
86 wxToolBarGTK(void);
87 wxToolBarGTK( wxWindow *parent, const wxWindowID id,
88 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
89 const long style = 0, const wxString& name = wxToolBarNameStr );
90 ~wxToolBarGTK(void);
91
92 bool Create( wxWindow *parent, const wxWindowID id,
93 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
94 const long style = 0, const wxString& name = wxToolBarNameStr);
95
96 // Only allow toggle if returns TRUE. Call when left button up.
97 virtual bool OnLeftClick(int toolIndex, bool toggleDown);
98
99 // Call when right button down.
100 virtual void OnRightClick(int toolIndex, float x, float y);
101
102 // Called when the mouse cursor enters a tool bitmap.
103 // Argument is -1 if mouse is exiting the toolbar.
104 virtual void OnMouseEnter(int toolIndex);
105
106 // If pushedBitmap is NULL, a reversed version of bitmap is
107 // created and used as the pushed/toggled image.
108 // If toggle is TRUE, the button toggles between the two states.
109 virtual wxToolBarTool *AddTool( const int toolIndex, const wxBitmap& bitmap,
110 const wxBitmap& pushedBitmap = wxNullBitmap, const bool toggle = FALSE,
111 const float xPos = -1, const float yPos = -1, wxObject *clientData = NULL,
112 const wxString& helpString1 = "", const wxString& helpString2 = "");
113 virtual void AddSeparator(void);
114 virtual void ClearTools(void);
115
116 virtual void EnableTool(const int toolIndex, const bool enable);
117 virtual void ToggleTool(const int toolIndex, const bool toggle); // toggle is TRUE if toggled on
118 virtual void SetToggle(const int toolIndex, const bool toggle); // Set this to be togglable (or not)
119 virtual wxObject *GetToolClientData(const int index) const;
120
121 virtual bool GetToolState(const int toolIndex) const;
122 virtual bool GetToolEnabled(const int toolIndex) const;
123
124 virtual void SetMargins(const int x, const int y);
125 void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); };
126 virtual void SetToolPacking(const int packing);
127 virtual void SetToolSeparation(const int separation);
128
129 public:
130
131 GtkToolbar *m_toolbar;
132 wxList m_tools;
133
134 DECLARE_EVENT_TABLE()
135 };
136
137 #endif
138 // __TBARGTKH__
139