1/////////////////////////////////////////////////////////////////////////////
2// Name:        tbargtk.h
3// Purpose:     GTK toolbar
4// Author:      Robert Roebling
5// RCS-ID:      $Id: tbargtk.h 44317 2007-01-25 23:35:07Z RD $
6// Copyright:   (c) Robert Roebling
7// Licence:     wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_GTK_TBARGTK_H_
11#define _WX_GTK_TBARGTK_H_
12
13#if wxUSE_TOOLBAR
14
15// ----------------------------------------------------------------------------
16// wxToolBar
17// ----------------------------------------------------------------------------
18
19class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
20{
21public:
22    // construction/destruction
23    wxToolBar() { Init(); }
24    wxToolBar( wxWindow *parent,
25               wxWindowID id,
26               const wxPoint& pos = wxDefaultPosition,
27               const wxSize& size = wxDefaultSize,
28               long style = wxTB_HORIZONTAL,
29               const wxString& name = wxToolBarNameStr )
30    {
31        Init();
32
33        Create(parent, id, pos, size, style, name);
34    }
35
36    bool Create( wxWindow *parent,
37                 wxWindowID id,
38                 const wxPoint& pos = wxDefaultPosition,
39                 const wxSize& size = wxDefaultSize,
40                 long style = 0,
41                 const wxString& name = wxToolBarNameStr );
42
43    virtual ~wxToolBar();
44
45    // override base class virtuals
46    virtual void SetMargins(int x, int y);
47    virtual void SetToolSeparation(int separation);
48
49    virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
50
51    virtual void SetToolShortHelp(int id, const wxString& helpString);
52
53    virtual void SetWindowStyleFlag( long style );
54
55#if wxABI_VERSION >= 20802
56    // TODO: In 2.9 these should probably be virtual, and declared in the base class...
57    void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
58    void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
59#endif
60
61    static wxVisualAttributes
62    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
63
64    // implementation from now on
65    // --------------------------
66
67    GtkToolbar   *m_toolbar;
68
69    bool          m_blockEvent;
70
71    void OnInternalIdle();
72
73protected:
74    // common part of all ctors
75    void Init();
76
77    // set the GTK toolbar style and orientation
78    void GtkSetStyle();
79
80    virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
81
82    // implement base class pure virtuals
83    virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
84    virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
85
86    virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
87    virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
88    virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
89
90    virtual wxToolBarToolBase *CreateTool(int id,
91                                          const wxString& label,
92                                          const wxBitmap& bitmap1,
93                                          const wxBitmap& bitmap2,
94                                          wxItemKind kind,
95                                          wxObject *clientData,
96                                          const wxString& shortHelpString,
97                                          const wxString& longHelpString);
98    virtual wxToolBarToolBase *CreateTool(wxControl *control);
99
100private:
101    DECLARE_DYNAMIC_CLASS(wxToolBar)
102};
103
104#endif // wxUSE_TOOLBAR
105
106#endif
107    // _WX_GTK_TBARGTK_H_
108