]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/tbargtk.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: GTK toolbar
4 // Author: Robert Roebling
6 // Copyright: (c) Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
18 #include "wx/control.h"
19 #include "wx/bitmap.h"
20 #include "wx/tbarbase.h"
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 #define wxTOOL_STYLE_BUTTON 1
34 #define wxTOOL_STYLE_SEPARATOR 2
36 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
40 extern const wxChar
*wxToolBarNameStr
;
42 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 class wxToolBar
: public wxControl
49 DECLARE_DYNAMIC_CLASS(wxToolBar
)
54 wxToolBar( wxWindow
*parent
, wxWindowID id
,
55 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
56 long style
= 0, const wxString
& name
= wxToolBarNameStr
);
59 bool Create( wxWindow
*parent
, wxWindowID id
,
60 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
61 long style
= 0, const wxString
& name
= wxToolBarNameStr
);
63 // Only allow toggle if returns TRUE. Call when left button up.
64 virtual bool OnLeftClick(int toolIndex
, bool toggleDown
);
66 // Call when right button down.
67 virtual void OnRightClick(int toolIndex
, float x
, float y
);
69 // Called when the mouse cursor enters a tool bitmap.
70 // Argument is -1 if mouse is exiting the toolbar.
71 virtual void OnMouseEnter(int toolIndex
);
73 // If pushedBitmap is NULL, a reversed version of bitmap is
74 // created and used as the pushed/toggled image.
75 // If toggle is TRUE, the button toggles between the two states.
76 virtual wxToolBarTool
*AddTool( int toolIndex
, const wxBitmap
& bitmap
,
77 const wxBitmap
& pushedBitmap
= wxNullBitmap
, bool toggle
= FALSE
,
78 float xPos
= -1, float yPos
= -1, wxObject
*clientData
= (wxObject
*)NULL
,
79 const wxString
& helpString1
= "", const wxString
& helpString2
= "");
80 virtual void AddSeparator(void);
81 virtual void ClearTools(void);
83 virtual bool Realize(void);
85 virtual void EnableTool(int toolIndex
, bool enable
);
86 virtual void ToggleTool(int toolIndex
, bool toggle
); // toggle is TRUE if toggled on
87 virtual wxObject
*GetToolClientData(int index
) const;
89 virtual bool GetToolState(int toolIndex
) const;
90 virtual bool GetToolEnabled(int toolIndex
) const;
92 virtual void SetMargins(int x
, int y
);
93 void SetMargins(const wxSize
& size
) { SetMargins(size
.x
, size
.y
); };
94 virtual wxSize
GetToolMargins(void) { return wxSize(m_xMargin
, m_yMargin
); }
96 virtual void SetToolPacking(int packing
);
97 virtual void SetToolSeparation(int separation
);
98 virtual int GetToolPacking();
99 virtual int GetToolSeparation();
101 virtual wxString
GetToolLongHelp(int toolIndex
);
102 virtual wxString
GetToolShortHelp(int toolIndex
);
104 virtual void SetToolLongHelp(int toolIndex
, const wxString
& helpString
);
105 virtual void SetToolShortHelp(int toolIndex
, const wxString
& helpString
);
107 void OnIdle( wxIdleEvent
&ievent
);
111 GtkToolbar
*m_toolbar
;
119 bool m_hasToolAlready
;