]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/tbargtk.h
New wxDataObject, DnD and Clipboard code
[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"
19
20//-----------------------------------------------------------------------------
21// classes
22//-----------------------------------------------------------------------------
23
24class wxToolBarTool;
716b7364 25class wxToolBar;
c801d85f
KB
26
27//-----------------------------------------------------------------------------
28// constants
29//-----------------------------------------------------------------------------
30
31#define wxTOOL_STYLE_BUTTON 1
32#define wxTOOL_STYLE_SEPARATOR 2
33
34//-----------------------------------------------------------------------------
35// global data
36//-----------------------------------------------------------------------------
37
38extern const char *wxToolBarNameStr;
39
40//-----------------------------------------------------------------------------
41// wxToolBarTool
42//-----------------------------------------------------------------------------
43
44class wxToolBarTool: public wxObject
45{
46 DECLARE_DYNAMIC_CLASS(wxToolBarTool)
47
48 public:
49
50 wxToolBarTool(void) {};
716b7364 51 wxToolBarTool( wxToolBar *owner, int theIndex = 0,
debe6624 52 const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
c67daf87 53 bool toggle = FALSE, wxObject *clientData = (wxObject *) NULL,
fc008f25 54 const wxString& shortHelpString = "", const wxString& longHelpString = "",
c67daf87 55 GtkWidget *item = (GtkWidget *) NULL );
c801d85f
KB
56 ~wxToolBarTool(void);
57
58 public:
59
60 int m_toolStyle;
61 wxObject *m_clientData;
62 int m_index;
63 bool m_toggleState;
64 bool m_isToggle;
65 bool m_deleteSecondBitmap;
66 bool m_enabled;
67 wxBitmap m_bitmap1;
68 wxBitmap m_bitmap2;
69 bool m_isMenuCommand;
70 wxString m_shortHelpString;
71 wxString m_longHelpString;
716b7364 72 wxToolBar *m_owner;
fc008f25 73 GtkWidget *m_item;
c801d85f
KB
74};
75
76//-----------------------------------------------------------------------------
716b7364 77// wxToolBar
c801d85f
KB
78//-----------------------------------------------------------------------------
79
716b7364 80class wxToolBar: public wxControl
c801d85f 81{
716b7364 82 DECLARE_DYNAMIC_CLASS(wxToolBar)
c801d85f
KB
83
84 public:
85
716b7364
RR
86 wxToolBar(void);
87 wxToolBar( wxWindow *parent, wxWindowID id,
c801d85f 88 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
debe6624 89 long style = 0, const wxString& name = wxToolBarNameStr );
716b7364 90 ~wxToolBar(void);
c801d85f 91
debe6624 92 bool Create( wxWindow *parent, wxWindowID id,
c801d85f 93 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
debe6624 94 long style = 0, const wxString& name = wxToolBarNameStr);
c801d85f
KB
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.
debe6624
JS
109 virtual wxToolBarTool *AddTool( int toolIndex, const wxBitmap& bitmap,
110 const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
c67daf87 111 float xPos = -1, float yPos = -1, wxObject *clientData = (wxObject *)NULL,
c801d85f
KB
112 const wxString& helpString1 = "", const wxString& helpString2 = "");
113 virtual void AddSeparator(void);
114 virtual void ClearTools(void);
46dc76ba 115
e3e65dac 116 virtual void Realize(void);
c801d85f 117
debe6624
JS
118 virtual void EnableTool(int toolIndex, bool enable);
119 virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
debe6624 120 virtual wxObject *GetToolClientData(int index) const;
c801d85f 121
debe6624
JS
122 virtual bool GetToolState(int toolIndex) const;
123 virtual bool GetToolEnabled(int toolIndex) const;
c801d85f 124
debe6624 125 virtual void SetMargins(int x, int y);
c801d85f 126 void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); };
debe6624
JS
127 virtual void SetToolPacking(int packing);
128 virtual void SetToolSeparation(int separation);
129
b46e8696 130 // implementation
c801d85f
KB
131
132 GtkToolbar *m_toolbar;
133 wxList m_tools;
b46e8696
RR
134 GdkColor m_fg;
135 GdkColor m_bg;
c801d85f
KB
136};
137
138#endif
139 // __TBARGTKH__
140