]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/tbargtk.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: GTK toolbar
4 // Author: Robert Roebling
6 // Copyright: (c) Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
21 #include "wx/control.h"
22 #include "wx/bitmap.h"
23 #include "wx/tbarbase.h"
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
36 #define wxTOOL_STYLE_BUTTON 1
37 #define wxTOOL_STYLE_SEPARATOR 2
39 //-----------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------
43 extern const wxChar
*wxToolBarNameStr
;
45 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
49 class wxToolBar
: public wxControl
52 DECLARE_DYNAMIC_CLASS(wxToolBar
)
57 wxToolBar( wxWindow
*parent
, wxWindowID id
,
58 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
59 long style
= 0, const wxString
& name
= wxToolBarNameStr
);
62 bool Create( wxWindow
*parent
, wxWindowID id
,
63 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
64 long style
= 0, const wxString
& name
= wxToolBarNameStr
);
66 // Only allow toggle if returns TRUE. Call when left button up.
67 virtual bool OnLeftClick(int toolIndex
, bool toggleDown
);
69 // Call when right button down.
70 virtual void OnRightClick(int toolIndex
, float x
, float y
);
72 // Called when the mouse cursor enters a tool bitmap.
73 // Argument is -1 if mouse is exiting the toolbar.
74 virtual void OnMouseEnter(int toolIndex
);
76 // If pushedBitmap is NULL, a reversed version of bitmap is
77 // created and used as the pushed/toggled image.
78 // If toggle is TRUE, the button toggles between the two states.
79 virtual wxToolBarTool
*AddTool( int toolIndex
, const wxBitmap
& bitmap
,
80 const wxBitmap
& pushedBitmap
= wxNullBitmap
, bool toggle
= FALSE
,
81 float xPos
= -1, float yPos
= -1, wxObject
*clientData
= (wxObject
*)NULL
,
82 const wxString
& helpString1
= "", const wxString
& helpString2
= "");
83 virtual void AddSeparator(void);
84 virtual void ClearTools(void);
86 virtual bool Realize(void);
88 virtual void EnableTool(int toolIndex
, bool enable
);
89 virtual void ToggleTool(int toolIndex
, bool toggle
); // toggle is TRUE if toggled on
90 virtual wxObject
*GetToolClientData(int index
) const;
92 virtual bool GetToolState(int toolIndex
) const;
93 virtual bool GetToolEnabled(int toolIndex
) const;
95 virtual void SetMargins(int x
, int y
);
96 void SetMargins(const wxSize
& size
) { SetMargins(size
.x
, size
.y
); };
97 virtual wxSize
GetToolMargins(void) { return wxSize(m_xMargin
, m_yMargin
); }
99 virtual void SetToolPacking(int packing
);
100 virtual void SetToolSeparation(int separation
);
101 virtual int GetToolPacking();
102 virtual int GetToolSeparation();
104 virtual wxString
GetToolLongHelp(int toolIndex
);
105 virtual wxString
GetToolShortHelp(int toolIndex
);
107 virtual void SetToolLongHelp(int toolIndex
, const wxString
& helpString
);
108 virtual void SetToolShortHelp(int toolIndex
, const wxString
& helpString
);
110 void OnIdle( wxIdleEvent
&ievent
);
114 GtkToolbar
*m_toolbar
;
122 bool m_hasToolAlready
;