toolbar.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk1/toolbar.h
  3. // Purpose: GTK toolbar
  4. // Author: Robert Roebling
  5. // Copyright: (c) Robert Roebling
  6. // Licence: wxWindows licence
  7. /////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_GTK_TOOLBAR_H_
  9. #define _WX_GTK_TOOLBAR_H_
  10. #if wxUSE_TOOLBAR
  11. // ----------------------------------------------------------------------------
  12. // wxToolBar
  13. // ----------------------------------------------------------------------------
  14. class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
  15. {
  16. public:
  17. // construction/destruction
  18. wxToolBar() { Init(); }
  19. wxToolBar( wxWindow *parent,
  20. wxWindowID id,
  21. const wxPoint& pos = wxDefaultPosition,
  22. const wxSize& size = wxDefaultSize,
  23. long style = 0,
  24. const wxString& name = wxToolBarNameStr )
  25. {
  26. Init();
  27. Create(parent, id, pos, size, style, name);
  28. }
  29. bool Create( wxWindow *parent,
  30. wxWindowID id,
  31. const wxPoint& pos = wxDefaultPosition,
  32. const wxSize& size = wxDefaultSize,
  33. long style = 0,
  34. const wxString& name = wxToolBarNameStr );
  35. virtual ~wxToolBar();
  36. // override base class virtuals
  37. virtual void SetMargins(int x, int y);
  38. virtual void SetToolSeparation(int separation);
  39. virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
  40. virtual void SetToolShortHelp(int id, const wxString& helpString);
  41. virtual void SetWindowStyleFlag( long style );
  42. static wxVisualAttributes
  43. GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
  44. // implementation from now on
  45. // --------------------------
  46. GtkToolbar *m_toolbar;
  47. bool m_blockEvent;
  48. void OnInternalIdle();
  49. protected:
  50. // common part of all ctors
  51. void Init();
  52. // choose the default border for this window
  53. virtual wxBorder GetDefaultBorder() const { return wxBORDER_DEFAULT; }
  54. // set the GTK toolbar style and orientation
  55. void GtkSetStyle();
  56. // implement base class pure virtuals
  57. virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
  58. virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
  59. virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
  60. virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
  61. virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
  62. virtual wxToolBarToolBase *CreateTool(int id,
  63. const wxString& label,
  64. const wxBitmap& bitmap1,
  65. const wxBitmap& bitmap2,
  66. wxItemKind kind,
  67. wxObject *clientData,
  68. const wxString& shortHelpString,
  69. const wxString& longHelpString);
  70. virtual wxToolBarToolBase *CreateTool(wxControl *control,
  71. const wxString& label);
  72. private:
  73. DECLARE_DYNAMIC_CLASS(wxToolBar)
  74. };
  75. #endif // wxUSE_TOOLBAR
  76. #endif
  77. // _WX_GTK_TOOLBAR_H_