]>
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 /////////////////////////////////////////////////////////////////////////////
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
53 wxToolBar( wxWindow
*parent
, wxWindowID id
,
54 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
55 long style
= 0, const wxString
& name
= wxToolBarNameStr
);
58 bool Create( wxWindow
*parent
, wxWindowID id
,
59 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
60 long style
= 0, const wxString
& name
= wxToolBarNameStr
);
62 // Only allow toggle if returns TRUE. Call when left button up.
63 virtual bool OnLeftClick(int toolIndex
, bool toggleDown
);
65 // Call when right button down.
66 virtual void OnRightClick(int toolIndex
, float x
, float y
);
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
);
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 wxCoord xPos
= -1, wxCoord yPos
= -1, wxObject
*clientData
= (wxObject
*)NULL
,
78 const wxString
& helpString1
= "", const wxString
& helpString2
= "");
80 // Add arbitrary control
81 virtual bool AddControl(wxControl
*control
);
84 virtual void AddSeparator();
86 // Delete tool by index (=id)
87 virtual bool DeleteTool(int toolIndex
);
90 virtual void ClearTools();
92 // Has to be called after adding tools or changing something
93 virtual bool Realize();
95 virtual void EnableTool(int toolIndex
, bool enable
);
96 virtual void ToggleTool(int toolIndex
, bool toggle
); // toggle is TRUE if toggled on
97 virtual wxObject
*GetToolClientData(int index
) const;
99 virtual bool GetToolState(int toolIndex
) const;
100 virtual bool GetToolEnabled(int toolIndex
) const;
102 virtual void SetMargins(int x
, int y
);
103 void SetMargins(const wxSize
& size
) { SetMargins(size
.x
, size
.y
); };
104 virtual wxSize
GetToolMargins(void) { return wxSize(m_xMargin
, m_yMargin
); }
106 virtual void SetToolPacking(int packing
);
107 virtual void SetToolSeparation(int separation
);
108 virtual int GetToolPacking();
109 virtual int GetToolSeparation();
111 virtual wxString
GetToolLongHelp(int toolIndex
);
112 virtual wxString
GetToolShortHelp(int toolIndex
);
114 virtual void SetToolLongHelp(int toolIndex
, const wxString
& helpString
);
115 virtual void SetToolShortHelp(int toolIndex
, const wxString
& helpString
);
117 void OnIdle( wxIdleEvent
&ievent
);
121 GtkToolbar
*m_toolbar
;
129 bool m_hasToolAlready
;
130 bool m_blockNextEvent
;
132 void OnInternalIdle();
135 DECLARE_EVENT_TABLE()
136 DECLARE_DYNAMIC_CLASS(wxToolBar
)