]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/tbargtk.h
Compile improvemnts for strict compilers and the like
[wxWidgets.git] / include / wx / gtk / tbargtk.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: tbargtk.h
3// Purpose: GTK toolbar
4// Author: Robert Roebling
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"
19#include "wx/bitmap.h"
20
21//-----------------------------------------------------------------------------
22// classes
23//-----------------------------------------------------------------------------
24
25class wxToolBarTool;
26class wxToolBar;
27
28//-----------------------------------------------------------------------------
29// constants
30//-----------------------------------------------------------------------------
31
32#define wxTOOL_STYLE_BUTTON 1
33#define wxTOOL_STYLE_SEPARATOR 2
34
35//-----------------------------------------------------------------------------
36// global data
37//-----------------------------------------------------------------------------
38
39extern const char *wxToolBarNameStr;
40
41//-----------------------------------------------------------------------------
42// wxToolBarTool
43//-----------------------------------------------------------------------------
44
45class wxToolBarTool: public wxObject
46{
47 DECLARE_DYNAMIC_CLASS(wxToolBarTool)
48
49 public:
50
51 wxToolBarTool(void) {};
52 wxToolBarTool( wxToolBar *owner, int theIndex = 0,
53 const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
54 bool toggle = FALSE, wxObject *clientData = (wxObject *) NULL,
55 const wxString& shortHelpString = "", const wxString& longHelpString = "",
56 GtkWidget *item = (GtkWidget *) NULL );
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 wxToolBar *m_owner;
74 GtkWidget *m_item;
75};
76
77//-----------------------------------------------------------------------------
78// wxToolBar
79//-----------------------------------------------------------------------------
80
81class wxToolBar: public wxControl
82{
83 DECLARE_DYNAMIC_CLASS(wxToolBar)
84
85 public:
86
87 wxToolBar(void);
88 wxToolBar( wxWindow *parent, wxWindowID id,
89 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
90 long style = 0, const wxString& name = wxToolBarNameStr );
91 ~wxToolBar(void);
92
93 bool Create( wxWindow *parent, wxWindowID id,
94 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
95 long style = 0, const wxString& name = wxToolBarNameStr);
96
97 // Only allow toggle if returns TRUE. Call when left button up.
98 virtual bool OnLeftClick(int toolIndex, bool toggleDown);
99
100 // Call when right button down.
101 virtual void OnRightClick(int toolIndex, float x, float y);
102
103 // Called when the mouse cursor enters a tool bitmap.
104 // Argument is -1 if mouse is exiting the toolbar.
105 virtual void OnMouseEnter(int toolIndex);
106
107 // If pushedBitmap is NULL, a reversed version of bitmap is
108 // created and used as the pushed/toggled image.
109 // If toggle is TRUE, the button toggles between the two states.
110 virtual wxToolBarTool *AddTool( int toolIndex, const wxBitmap& bitmap,
111 const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
112 float xPos = -1, float yPos = -1, wxObject *clientData = (wxObject *)NULL,
113 const wxString& helpString1 = "", const wxString& helpString2 = "");
114 virtual void AddSeparator(void);
115 virtual void ClearTools(void);
116
117 virtual bool Realize(void);
118
119 virtual void EnableTool(int toolIndex, bool enable);
120 virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
121 virtual wxObject *GetToolClientData(int index) const;
122
123 virtual bool GetToolState(int toolIndex) const;
124 virtual bool GetToolEnabled(int toolIndex) const;
125
126 virtual void SetMargins(int x, int y);
127 void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); };
128 virtual wxSize GetToolMargins(void) { return wxSize(m_xMargin, m_yMargin); }
129
130 virtual void SetToolPacking(int packing);
131 virtual void SetToolSeparation(int separation);
132 virtual int GetToolPacking();
133 virtual int GetToolSeparation();
134
135 virtual wxString GetToolLongHelp(int toolIndex);
136 virtual wxString GetToolShortHelp(int toolIndex);
137
138 virtual void SetToolLongHelp(int toolIndex, const wxString& helpString);
139 virtual void SetToolShortHelp(int toolIndex, const wxString& helpString);
140
141 // implementation
142
143 GtkToolbar *m_toolbar;
144 int m_separation;
145 wxList m_tools;
146
147 GdkColor *m_fg;
148 GdkColor *m_bg;
149 int m_xMargin;
150 int m_yMargin;
151 bool m_hasToolAlready;
152};
153
154#endif
155 // __TBARGTKH__
156