toolbar.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/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. typedef struct _GtkTooltips GtkTooltips;
  12. // ----------------------------------------------------------------------------
  13. // wxToolBar
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
  16. {
  17. public:
  18. // construction/destruction
  19. wxToolBar() { Init(); }
  20. wxToolBar( wxWindow *parent,
  21. wxWindowID id,
  22. const wxPoint& pos = wxDefaultPosition,
  23. const wxSize& size = wxDefaultSize,
  24. long style = wxTB_HORIZONTAL,
  25. const wxString& name = wxToolBarNameStr )
  26. {
  27. Init();
  28. Create(parent, id, pos, size, style, name);
  29. }
  30. bool Create( wxWindow *parent,
  31. wxWindowID id,
  32. const wxPoint& pos = wxDefaultPosition,
  33. const wxSize& size = wxDefaultSize,
  34. long style = wxTB_HORIZONTAL,
  35. const wxString& name = wxToolBarNameStr );
  36. virtual ~wxToolBar();
  37. virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
  38. virtual void SetToolShortHelp(int id, const wxString& helpString);
  39. virtual void SetWindowStyleFlag( long style );
  40. virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
  41. virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
  42. virtual bool Realize();
  43. static wxVisualAttributes
  44. GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
  45. virtual wxToolBarToolBase *CreateTool(int id,
  46. const wxString& label,
  47. const wxBitmap& bitmap1,
  48. const wxBitmap& bitmap2 = wxNullBitmap,
  49. wxItemKind kind = wxITEM_NORMAL,
  50. wxObject *clientData = NULL,
  51. const wxString& shortHelpString = wxEmptyString,
  52. const wxString& longHelpString = wxEmptyString);
  53. virtual wxToolBarToolBase *CreateTool(wxControl *control,
  54. const wxString& label);
  55. // implementation from now on
  56. // --------------------------
  57. protected:
  58. // choose the default border for this window
  59. virtual wxBorder GetDefaultBorder() const { return wxBORDER_DEFAULT; }
  60. virtual wxSize DoGetBestSize() const;
  61. virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
  62. // implement base class pure virtuals
  63. virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
  64. virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
  65. virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
  66. virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
  67. virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
  68. private:
  69. void Init();
  70. void GtkSetStyle();
  71. GSList* GetRadioGroup(size_t pos);
  72. virtual void AddChildGTK(wxWindowGTK* child);
  73. GtkToolbar* m_toolbar;
  74. GtkTooltips* m_tooltips;
  75. DECLARE_DYNAMIC_CLASS(wxToolBar)
  76. };
  77. #endif // wxUSE_TOOLBAR
  78. #endif
  79. // _WX_GTK_TOOLBAR_H_