]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/tbargtk.h
A couple of identifiers at global level moved to the .cpp file from .h where
[wxWidgets.git] / include / wx / gtk1 / tbargtk.h
CommitLineData
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"
c801d85f
KB
20
21//-----------------------------------------------------------------------------
22// classes
23//-----------------------------------------------------------------------------
24
25class wxToolBarTool;
716b7364 26class wxToolBar;
c801d85f
KB
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) {};
716b7364 52 wxToolBarTool( wxToolBar *owner, int theIndex = 0,
debe6624 53 const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
c67daf87 54 bool toggle = FALSE, wxObject *clientData = (wxObject *) NULL,
fc008f25 55 const wxString& shortHelpString = "", const wxString& longHelpString = "",
c67daf87 56 GtkWidget *item = (GtkWidget *) NULL );
c801d85f
KB
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;
716b7364 73 wxToolBar *m_owner;
fc008f25 74 GtkWidget *m_item;
c801d85f
KB
75};
76
77//-----------------------------------------------------------------------------
716b7364 78// wxToolBar
c801d85f
KB
79//-----------------------------------------------------------------------------
80
716b7364 81class wxToolBar: public wxControl
c801d85f 82{
716b7364 83 DECLARE_DYNAMIC_CLASS(wxToolBar)
c801d85f
KB
84
85 public:
86
716b7364
RR
87 wxToolBar(void);
88 wxToolBar( wxWindow *parent, wxWindowID id,
c801d85f 89 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
debe6624 90 long style = 0, const wxString& name = wxToolBarNameStr );
716b7364 91 ~wxToolBar(void);
c801d85f 92
debe6624 93 bool Create( wxWindow *parent, wxWindowID id,
c801d85f 94 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
debe6624 95 long style = 0, const wxString& name = wxToolBarNameStr);
c801d85f
KB
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.
debe6624
JS
110 virtual wxToolBarTool *AddTool( int toolIndex, const wxBitmap& bitmap,
111 const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
c67daf87 112 float xPos = -1, float yPos = -1, wxObject *clientData = (wxObject *)NULL,
c801d85f
KB
113 const wxString& helpString1 = "", const wxString& helpString2 = "");
114 virtual void AddSeparator(void);
115 virtual void ClearTools(void);
46dc76ba 116
1144d24d 117 virtual bool Realize(void);
c801d85f 118
debe6624
JS
119 virtual void EnableTool(int toolIndex, bool enable);
120 virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
debe6624 121 virtual wxObject *GetToolClientData(int index) const;
c801d85f 122
debe6624
JS
123 virtual bool GetToolState(int toolIndex) const;
124 virtual bool GetToolEnabled(int toolIndex) const;
c801d85f 125
debe6624 126 virtual void SetMargins(int x, int y);
c801d85f 127 void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); };
1144d24d
RR
128 virtual wxSize GetToolMargins(void) { return wxSize(m_xMargin, m_yMargin); }
129
debe6624
JS
130 virtual void SetToolPacking(int packing);
131 virtual void SetToolSeparation(int separation);
1144d24d
RR
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);
debe6624 140
b46e8696 141 // implementation
c801d85f
KB
142
143 GtkToolbar *m_toolbar;
1144d24d 144 int m_separation;
c801d85f 145 wxList m_tools;
1144d24d 146
83624f79
RR
147 GdkColor *m_fg;
148 GdkColor *m_bg;
1144d24d
RR
149 int m_xMargin;
150 int m_yMargin;
151 bool m_hasToolAlready;
c801d85f
KB
152};
153
154#endif
155 // __TBARGTKH__
156