]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/tbargtk.h
char handling fixed again
[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#include "wx/tbarbase.h"
21
22//-----------------------------------------------------------------------------
23// classes
24//-----------------------------------------------------------------------------
25
26class wxToolBarTool;
27class wxToolBar;
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
40extern const char *wxToolBarNameStr;
41
42//-----------------------------------------------------------------------------
43// wxToolBar
44//-----------------------------------------------------------------------------
45
46class wxToolBar: public wxControl
47{
48 DECLARE_DYNAMIC_CLASS(wxToolBar)
49
50 public:
51
52 wxToolBar(void);
53 wxToolBar( wxWindow *parent, wxWindowID id,
54 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
55 long style = 0, const wxString& name = wxToolBarNameStr );
56 ~wxToolBar(void);
57
58 bool Create( wxWindow *parent, wxWindowID id,
59 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
60 long style = 0, const wxString& name = wxToolBarNameStr);
61
62 // Only allow toggle if returns TRUE. Call when left button up.
63 virtual bool OnLeftClick(int toolIndex, bool toggleDown);
64
65 // Call when right button down.
66 virtual void OnRightClick(int toolIndex, float x, float y);
67
68 // Called when the mouse cursor enters a tool bitmap.
69 // Argument is -1 if mouse is exiting the toolbar.
70 virtual void OnMouseEnter(int toolIndex);
71
72 // If pushedBitmap is NULL, a reversed version of bitmap is
73 // created and used as the pushed/toggled image.
74 // If toggle is TRUE, the button toggles between the two states.
75 virtual wxToolBarTool *AddTool( int toolIndex, const wxBitmap& bitmap,
76 const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
77 float xPos = -1, float yPos = -1, wxObject *clientData = (wxObject *)NULL,
78 const wxString& helpString1 = "", const wxString& helpString2 = "");
79 virtual void AddSeparator(void);
80 virtual void ClearTools(void);
81
82 virtual bool Realize(void);
83
84 virtual void EnableTool(int toolIndex, bool enable);
85 virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
86 virtual wxObject *GetToolClientData(int index) const;
87
88 virtual bool GetToolState(int toolIndex) const;
89 virtual bool GetToolEnabled(int toolIndex) const;
90
91 virtual void SetMargins(int x, int y);
92 void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); };
93 virtual wxSize GetToolMargins(void) { return wxSize(m_xMargin, m_yMargin); }
94
95 virtual void SetToolPacking(int packing);
96 virtual void SetToolSeparation(int separation);
97 virtual int GetToolPacking();
98 virtual int GetToolSeparation();
99
100 virtual wxString GetToolLongHelp(int toolIndex);
101 virtual wxString GetToolShortHelp(int toolIndex);
102
103 virtual void SetToolLongHelp(int toolIndex, const wxString& helpString);
104 virtual void SetToolShortHelp(int toolIndex, const wxString& helpString);
105
106 // implementation
107
108 GtkToolbar *m_toolbar;
109 int m_separation;
110 wxList m_tools;
111
112 GdkColor *m_fg;
113 GdkColor *m_bg;
114 int m_xMargin;
115 int m_yMargin;
116 bool m_hasToolAlready;
117};
118
119#endif
120 // __TBARGTKH__
121