art.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: ribbon/art.h
  3. // Purpose: interface of wxRibbonArtProvider
  4. // Author: Peter Cawley
  5. // Licence: wxWindows licence
  6. ///////////////////////////////////////////////////////////////////////////////
  7. /**
  8. Identifiers for common settings on ribbon art providers which can be used
  9. to tweak the appearance of the art provider.
  10. @see wxRibbonArtProvider::GetColour()
  11. @see wxRibbonArtProvider::GetFont()
  12. @see wxRibbonArtProvider::GetMetric()
  13. @see wxRibbonArtProvider::SetColour()
  14. @see wxRibbonArtProvider::SetFont()
  15. @see wxRibbonArtProvider::SetMetric()
  16. */
  17. enum wxRibbonArtSetting
  18. {
  19. wxRIBBON_ART_TAB_SEPARATION_SIZE,
  20. wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE,
  21. wxRIBBON_ART_PAGE_BORDER_TOP_SIZE,
  22. wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE,
  23. wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE,
  24. wxRIBBON_ART_PANEL_X_SEPARATION_SIZE,
  25. wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE,
  26. wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE,
  27. wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE,
  28. wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE,
  29. wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE,
  30. wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE,
  31. wxRIBBON_ART_PANEL_LABEL_FONT,
  32. wxRIBBON_ART_BUTTON_BAR_LABEL_FONT,
  33. wxRIBBON_ART_TAB_LABEL_FONT,
  34. wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR,
  35. /// @since 2.9.5
  36. wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR,
  37. wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR,
  38. wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR,
  39. wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
  40. wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR,
  41. wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR,
  42. wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR,
  43. wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR,
  44. wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
  45. wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR,
  46. wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
  47. wxRIBBON_ART_GALLERY_BORDER_COLOUR,
  48. wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR,
  49. wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR,
  50. wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR,
  51. wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR,
  52. wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR,
  53. wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR,
  54. wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR,
  55. wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR,
  56. wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR,
  57. wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR,
  58. wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
  59. wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR,
  60. wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR,
  61. wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR,
  62. wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR,
  63. wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR,
  64. wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR,
  65. wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR,
  66. wxRIBBON_ART_TAB_LABEL_COLOUR,
  67. wxRIBBON_ART_TAB_SEPARATOR_COLOUR,
  68. wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR,
  69. wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR,
  70. wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR,
  71. wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR,
  72. wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
  73. wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR,
  74. wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR,
  75. wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR,
  76. wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
  77. wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR,
  78. wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
  79. wxRIBBON_ART_TAB_BORDER_COLOUR,
  80. wxRIBBON_ART_PANEL_BORDER_COLOUR,
  81. wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR,
  82. wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR,
  83. wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR,
  84. wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR,
  85. wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR,
  86. wxRIBBON_ART_PANEL_LABEL_COLOUR,
  87. wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR,
  88. wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR,
  89. wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR,
  90. wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR,
  91. wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR,
  92. wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
  93. wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR,
  94. wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
  95. wxRIBBON_ART_PAGE_BORDER_COLOUR,
  96. wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR,
  97. wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR,
  98. wxRIBBON_ART_PAGE_BACKGROUND_COLOUR,
  99. wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR,
  100. wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR,
  101. wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
  102. wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR,
  103. wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR,
  104. wxRIBBON_ART_TOOLBAR_BORDER_COLOUR,
  105. wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR,
  106. wxRIBBON_ART_TOOLBAR_FACE_COLOUR,
  107. wxRIBBON_ART_TOOL_BACKGROUND_TOP_COLOUR,
  108. wxRIBBON_ART_TOOL_BACKGROUND_TOP_GRADIENT_COLOUR,
  109. wxRIBBON_ART_TOOL_BACKGROUND_COLOUR,
  110. wxRIBBON_ART_TOOL_BACKGROUND_GRADIENT_COLOUR,
  111. wxRIBBON_ART_TOOL_HOVER_BACKGROUND_TOP_COLOUR,
  112. wxRIBBON_ART_TOOL_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
  113. wxRIBBON_ART_TOOL_HOVER_BACKGROUND_COLOUR,
  114. wxRIBBON_ART_TOOL_HOVER_BACKGROUND_GRADIENT_COLOUR,
  115. wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_COLOUR,
  116. wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
  117. wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_COLOUR,
  118. wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
  119. };
  120. /**
  121. Flags used to describe the direction, state, and/or purpose of a
  122. ribbon-style scroll button.
  123. @see wxRibbonArtProvider::DrawScrollButton()
  124. @see wxRibbonArtProvider::GetScrollButtonMinimumSize()
  125. */
  126. enum wxRibbonScrollButtonStyle
  127. {
  128. wxRIBBON_SCROLL_BTN_LEFT = 0, /**< Button will scroll to the left. */
  129. wxRIBBON_SCROLL_BTN_RIGHT = 1, /**< Button will scroll to the right. */
  130. wxRIBBON_SCROLL_BTN_UP = 2, /**< Button will scroll upward. */
  131. wxRIBBON_SCROLL_BTN_DOWN = 3, /**< Button will scroll downward. */
  132. /** A mask to extract direction from a combination of flags. */
  133. wxRIBBON_SCROLL_BTN_DIRECTION_MASK = 3,
  134. wxRIBBON_SCROLL_BTN_NORMAL = 0, /**< Button is not active or hovered. */
  135. wxRIBBON_SCROLL_BTN_HOVERED = 4, /**< Button has a cursor hovering over it. */
  136. wxRIBBON_SCROLL_BTN_ACTIVE = 8, /**< Button is being pressed. */
  137. /** A mask to extract state from a combination of flags. */
  138. wxRIBBON_SCROLL_BTN_STATE_MASK = 12,
  139. wxRIBBON_SCROLL_BTN_FOR_OTHER = 0, /**< Button is not for scrolling tabs nor pages. */
  140. wxRIBBON_SCROLL_BTN_FOR_TABS = 16, /**< Button is for scrolling tabs. */
  141. wxRIBBON_SCROLL_BTN_FOR_PAGE = 32, /**< Button is for scrolling pages. */
  142. /** A mask to extract purpose from a combination of flags. */
  143. wxRIBBON_SCROLL_BTN_FOR_MASK = 48,
  144. };
  145. /**
  146. Buttons on a ribbon button bar and tools on a ribbon tool bar can each be
  147. one of three different kinds.
  148. */
  149. enum wxRibbonButtonKind
  150. {
  151. /**
  152. Normal button or tool with a clickable area which causes some generic
  153. action.
  154. */
  155. wxRIBBON_BUTTON_NORMAL = 1 << 0,
  156. /**
  157. Dropdown button or tool with a clickable area which typically causes a
  158. dropdown menu.
  159. */
  160. wxRIBBON_BUTTON_DROPDOWN = 1 << 1,
  161. /**
  162. Button or tool with two clickable areas - one which causes a dropdown
  163. menu, and one which causes a generic action.
  164. */
  165. wxRIBBON_BUTTON_HYBRID = wxRIBBON_BUTTON_NORMAL | wxRIBBON_BUTTON_DROPDOWN,
  166. /**
  167. Normal button or tool with a clickable area which toggles the button
  168. between a pressed and unpressed state.
  169. */
  170. wxRIBBON_BUTTON_TOGGLE = 1 << 2
  171. };
  172. /**
  173. @class wxRibbonArtProvider
  174. wxRibbonArtProvider is responsible for drawing all the components of the ribbon
  175. interface. This allows a ribbon bar to have a pluggable look-and-feel, while
  176. retaining the same underlying behaviour. As a single art provider is used for
  177. all ribbon components, a ribbon bar usually has a consistent (though unique)
  178. appearance.
  179. By default, a wxRibbonBar uses an instance of this class called
  180. @c wxRibbonDefaultArtProvider, which resolves to @c wxRibbonAUIArtProvider,
  181. @c wxRibbonMSWArtProvider, or @c wxRibbonOSXArtProvider - whichever is most appropriate
  182. to the current platform. These art providers are all slightly configurable with
  183. regard to colours and fonts, but for larger modifications, you can derive from
  184. one of these classes, or write a completely new art provider class.
  185. Call wxRibbonBar::SetArtProvider to change the art provider being used.
  186. @library{wxribbon}
  187. @category{ribbon}
  188. @see wxRibbonBar
  189. */
  190. class wxRibbonArtProvider
  191. {
  192. public:
  193. /**
  194. Constructor.
  195. */
  196. wxRibbonArtProvider();
  197. /**
  198. Destructor.
  199. */
  200. virtual ~wxRibbonArtProvider();
  201. /**
  202. Create a new art provider which is a clone of this one.
  203. */
  204. virtual wxRibbonArtProvider* Clone() const = 0;
  205. /**
  206. Set the style flags.
  207. Normally called automatically by wxRibbonBar::SetArtProvider with the ribbon
  208. bar's style flags, so that the art provider has the same flags as the bar which
  209. it is serving.
  210. */
  211. virtual void SetFlags(long flags) = 0;
  212. /**
  213. Get the previously set style flags.
  214. */
  215. virtual long GetFlags() const = 0;
  216. /**
  217. Get the value of a certain integer setting.
  218. @a id can be one of the size values of @ref wxRibbonArtSetting.
  219. */
  220. virtual int GetMetric(int id) const = 0;
  221. /**
  222. Set the value of a certain integer setting to the value @e new_val.
  223. @a id can be one of the size values of @ref wxRibbonArtSetting.
  224. */
  225. virtual void SetMetric(int id, int new_val) = 0;
  226. /**
  227. Set the value of a certain font setting to the value @e font.
  228. @a id can be one of the font values of @ref wxRibbonArtSetting.
  229. */
  230. virtual void SetFont(int id, const wxFont& font) = 0;
  231. /**
  232. Get the value of a certain font setting.
  233. @a id can be one of the font values of @ref wxRibbonArtSetting.
  234. */
  235. virtual wxFont GetFont(int id) const = 0;
  236. /**
  237. Get the value of a certain colour setting.
  238. @a id can be one of the colour values of @ref wxRibbonArtSetting.
  239. */
  240. virtual wxColour GetColour(int id) const = 0;
  241. /**
  242. Set the value of a certain colour setting to the value @e colour.
  243. @a id can be one of the colour values of @ref wxRibbonArtSetting, though
  244. not all colour settings will have an effect on every art provider.
  245. @see SetColourScheme()
  246. */
  247. virtual void SetColour(int id, const wxColor& colour) = 0;
  248. /**
  249. @see wxRibbonArtProvider::GetColour()
  250. */
  251. wxColour GetColor(int id) const;
  252. /**
  253. @see wxRibbonArtProvider::SetColour()
  254. */
  255. void SetColor(int id, const wxColour& color);
  256. /**
  257. Get the current colour scheme.
  258. Returns three colours such that if SetColourScheme() were called with
  259. them, the colour scheme would be restored to what it was when
  260. SetColourScheme() was last called. In practice, this usually means that
  261. the returned values are the three colours given in the last call to
  262. SetColourScheme(), however if SetColourScheme() performs an idempotent
  263. operation upon the colours it is given (like clamping a component of
  264. the colour), then the returned values may not be the three colours
  265. given in the last call to SetColourScheme().
  266. If SetColourScheme() has not been called, then the returned values
  267. should result in a colour scheme similar to, if not identical to, the
  268. default colours of the art provider.
  269. Note that if SetColour() is called, then GetColourScheme() does not try
  270. and return a colour scheme similar to colours being used - it's return
  271. values are dependent upon the last values given to SetColourScheme(),
  272. as described above.
  273. @param[out] primary
  274. Pointer to a location to store the primary colour, or NULL.
  275. @param[out] secondary
  276. Pointer to a location to store the secondary colour, or NULL.
  277. @param[out] tertiary
  278. Pointer to a location to store the tertiary colour, or NULL.
  279. */
  280. virtual void GetColourScheme(wxColour* primary,
  281. wxColour* secondary,
  282. wxColour* tertiary) const = 0;
  283. /**
  284. Set all applicable colour settings from a few base colours.
  285. Uses any or all of the three given colours to create a colour scheme,
  286. and then sets all colour settings which are relevant to the art
  287. provider using that scheme.
  288. Note that some art providers may not use the tertiary colour for
  289. anything, and some may not use the secondary colour either.
  290. @see SetColour()
  291. @see GetColourScheme()
  292. */
  293. virtual void SetColourScheme(const wxColour& primary,
  294. const wxColour& secondary,
  295. const wxColour& tertiary) = 0;
  296. /**
  297. Draw the background of the tab region of a ribbon bar.
  298. @param dc
  299. The device context to draw onto.
  300. @param wnd
  301. The window which is being drawn onto.
  302. @param rect
  303. The rectangle within which to draw.
  304. */
  305. virtual void DrawTabCtrlBackground(
  306. wxDC& dc,
  307. wxWindow* wnd,
  308. const wxRect& rect) = 0;
  309. /**
  310. Draw a single tab in the tab region of a ribbon bar.
  311. @param dc
  312. The device context to draw onto.
  313. @param wnd
  314. The window which is being drawn onto (not the wxRibbonPage
  315. associated with the tab being drawn).
  316. @param tab
  317. The rectangle within which to draw, and also the tab label, icon,
  318. and state (active and/or hovered). The drawing rectangle will be
  319. entirely within a rectangle on the same device context previously
  320. painted with DrawTabCtrlBackground(). The rectangle's width will
  321. be at least the minimum value returned by GetBarTabWidth(), and
  322. height will be the value returned by GetTabCtrlHeight().
  323. */
  324. virtual void DrawTab(wxDC& dc,
  325. wxWindow* wnd,
  326. const wxRibbonPageTabInfo& tab) = 0;
  327. /**
  328. Draw a separator between two tabs in a ribbon bar.
  329. @param dc
  330. The device context to draw onto.
  331. @param wnd
  332. The window which is being drawn onto.
  333. @param rect
  334. The rectangle within which to draw, which will be entirely within a
  335. rectangle on the same device context previously painted with
  336. DrawTabCtrlBackground().
  337. @param visibility
  338. The opacity with which to draw the separator. Values are in the range
  339. [0, 1], with 0 being totally transparent, and 1 being totally opaque.
  340. */
  341. virtual void DrawTabSeparator(wxDC& dc,
  342. wxWindow* wnd,
  343. const wxRect& rect,
  344. double visibility) = 0;
  345. /**
  346. Draw the background of a ribbon page.
  347. @param dc
  348. The device context to draw onto.
  349. @param wnd
  350. The window which is being drawn onto (which is commonly the wxRibbonPage
  351. whose background is being drawn, but doesn't have to be).
  352. @param rect
  353. The rectangle within which to draw.
  354. @sa GetPageBackgroundRedrawArea
  355. */
  356. virtual void DrawPageBackground(
  357. wxDC& dc,
  358. wxWindow* wnd,
  359. const wxRect& rect) = 0;
  360. /**
  361. Draw a ribbon-style scroll button.
  362. @param dc
  363. The device context to draw onto.
  364. @param wnd
  365. The window which is being drawn onto.
  366. @param rect
  367. The rectangle within which to draw. The size of this rectangle
  368. will be at least the size returned by GetScrollButtonMinimumSize()
  369. for a scroll button with the same style. For tab scroll buttons,
  370. this rectangle will be entirely within a rectangle on the same
  371. device context previously painted with DrawTabCtrlBackground(), but
  372. this is not guaranteed for other types of button (for example,
  373. page scroll buttons will not be painted on an area previously
  374. painted with DrawPageBackground()).
  375. @param style
  376. A combination of flags from @ref wxRibbonScrollButtonStyle, including
  377. a direction, a for flag, and one or more states.
  378. */
  379. virtual void DrawScrollButton(
  380. wxDC& dc,
  381. wxWindow* wnd,
  382. const wxRect& rect,
  383. long style) = 0;
  384. /**
  385. Draw the background and chrome for a ribbon panel. This should draw
  386. the border, background, label, and any other items of a panel which
  387. are outside the client area of a panel.
  388. Note that when a panel is minimised, this function is not called - only
  389. DrawMinimisedPanel() is called, so a background should be explicitly
  390. painted by that if required.
  391. @param dc
  392. The device context to draw onto.
  393. @param wnd
  394. The window which is being drawn onto, which is always the panel
  395. whose background and chrome is being drawn. The panel label and
  396. other panel attributes can be obtained by querying this.
  397. @param rect
  398. The rectangle within which to draw.
  399. */
  400. virtual void DrawPanelBackground(
  401. wxDC& dc,
  402. wxRibbonPanel* wnd,
  403. const wxRect& rect) = 0;
  404. /**
  405. Draw the background and chrome for a wxRibbonGallery control. This
  406. should draw the border, background, scroll buttons, extension button,
  407. and any other UI elements which are not attached to a specific gallery
  408. item.
  409. @param dc
  410. The device context to draw onto.
  411. @param wnd
  412. The window which is being drawn onto, which is always the gallery
  413. whose background and chrome is being drawn. Attributes used during
  414. drawing like the gallery hover state and individual button states
  415. can be queried from this parameter by wxRibbonGallery::IsHovered(),
  416. wxRibbonGallery::GetExtensionButtonState(),
  417. wxRibbonGallery::GetUpButtonState(), and
  418. wxRibbonGallery::GetDownButtonState().
  419. @param rect
  420. The rectangle within which to draw. This rectangle is the entire
  421. area of the gallery control, not just the client rectangle.
  422. */
  423. virtual void DrawGalleryBackground(
  424. wxDC& dc,
  425. wxRibbonGallery* wnd,
  426. const wxRect& rect) = 0;
  427. /**
  428. Draw the background of a single item in a wxRibbonGallery control. This
  429. is painted on top of a gallery background, and behind the items bitmap.
  430. Unlike DrawButtonBarButton() and DrawTool(), it is not expected to draw
  431. the item bitmap - that is done by the gallery control itself.
  432. @param dc
  433. The device context to draw onto.
  434. @param wnd
  435. The window which is being drawn onto, which is always the gallery
  436. which contains the item being drawn.
  437. @param rect
  438. The rectangle within which to draw. The size of this rectangle will
  439. be the size of the item's bitmap, expanded by gallery item padding
  440. values (wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE,
  441. wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE,
  442. wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE, and
  443. wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE). The drawing
  444. rectangle will be entirely within a rectangle on the same device
  445. context previously painted with DrawGalleryBackground().
  446. @param item
  447. The item whose background is being painted. Typically the
  448. background will vary if the item is hovered, active, or selected;
  449. wxRibbonGallery::GetSelection(), wxRibbonGallery::GetActiveItem(),
  450. and wxRibbonGallery::GetHoveredItem() can be called to test if the
  451. given item is in one of these states.
  452. */
  453. virtual void DrawGalleryItemBackground(
  454. wxDC& dc,
  455. wxRibbonGallery* wnd,
  456. const wxRect& rect,
  457. wxRibbonGalleryItem* item) = 0;
  458. /**
  459. Draw a minimised ribbon panel.
  460. @param dc
  461. The device context to draw onto.
  462. @param wnd
  463. The window which is being drawn onto, which is always the panel
  464. which is minimised. The panel label can be obtained from this
  465. window. The minimised icon obtained from querying the window may
  466. not be the size requested by GetMinimisedPanelMinimumSize() - the
  467. @a bitmap argument contains the icon in the requested size.
  468. @param rect
  469. The rectangle within which to draw. The size of the rectangle will
  470. be at least the size returned by GetMinimisedPanelMinimumSize().
  471. @param bitmap
  472. A copy of the panel's minimised bitmap rescaled to the size
  473. returned by GetMinimisedPanelMinimumSize().
  474. */
  475. virtual void DrawMinimisedPanel(
  476. wxDC& dc,
  477. wxRibbonPanel* wnd,
  478. const wxRect& rect,
  479. wxBitmap& bitmap) = 0;
  480. /**
  481. Draw the background for a wxRibbonButtonBar control.
  482. @param dc
  483. The device context to draw onto.
  484. @param wnd
  485. The window which is being drawn onto (which will typically be the
  486. button bar itself, though this is not guaranteed).
  487. @param rect
  488. The rectangle within which to draw.
  489. */
  490. virtual void DrawButtonBarBackground(
  491. wxDC& dc,
  492. wxWindow* wnd,
  493. const wxRect& rect) = 0;
  494. /**
  495. Draw a single button for a wxRibbonButtonBar control.
  496. @param dc
  497. The device context to draw onto.
  498. @param wnd
  499. The window which is being drawn onto.
  500. @param rect
  501. The rectangle within which to draw. The size of this rectangle will
  502. be a size previously returned by GetButtonBarButtonSize(), and the
  503. rectangle will be entirely within a rectangle on the same device
  504. context previously painted with DrawButtonBarBackground().
  505. @param kind
  506. The kind of button to draw (normal, dropdown or hybrid).
  507. @param state
  508. Combination of a size flag and state flags from the
  509. wxRibbonButtonBarButtonState enumeration.
  510. @param label
  511. The label of the button.
  512. @param bitmap_large
  513. The large bitmap of the button (or the large disabled bitmap when
  514. wxRIBBON_BUTTONBAR_BUTTON_DISABLED is set in @a state).
  515. @param bitmap_small
  516. The small bitmap of the button (or the small disabled bitmap when
  517. wxRIBBON_BUTTONBAR_BUTTON_DISABLED is set in @a state).
  518. */
  519. virtual void DrawButtonBarButton(
  520. wxDC& dc,
  521. wxWindow* wnd,
  522. const wxRect& rect,
  523. wxRibbonButtonBarButtonKind kind,
  524. long state,
  525. const wxString& label,
  526. const wxBitmap& bitmap_large,
  527. const wxBitmap& bitmap_small) = 0;
  528. /**
  529. Draw the background for a wxRibbonToolBar control.
  530. @param dc
  531. The device context to draw onto.
  532. @param wnd
  533. The which is being drawn onto. In most cases this will be a
  534. wxRibbonToolBar, but it doesn't have to be.
  535. @param rect
  536. The rectangle within which to draw. Some of this rectangle will
  537. later be drawn over using DrawToolGroupBackground() and DrawTool(),
  538. but not all of it will (unless there is only a single group of
  539. tools).
  540. */
  541. virtual void DrawToolBarBackground(
  542. wxDC& dc,
  543. wxWindow* wnd,
  544. const wxRect& rect) = 0;
  545. /**
  546. Draw the background for a group of tools on a wxRibbonToolBar control.
  547. @param dc
  548. The device context to draw onto.
  549. @param wnd
  550. The window which is being drawn onto. In most cases this will be a
  551. wxRibbonToolBar, but it doesn't have to be.
  552. @param rect
  553. The rectangle within which to draw. This rectangle is a union of
  554. the individual tools' rectangles. As there are no gaps between
  555. tools, this rectangle will be painted over exactly once by calls to
  556. DrawTool(). The group background could therefore be painted by
  557. DrawTool(), though it can be conceptually easier and more efficient
  558. to draw it all at once here. The rectangle will be entirely within
  559. a rectangle on the same device context previously painted with
  560. DrawToolBarBackground().
  561. */
  562. virtual void DrawToolGroupBackground(
  563. wxDC& dc,
  564. wxWindow* wnd,
  565. const wxRect& rect) = 0;
  566. /**
  567. Draw a single tool (for a wxRibbonToolBar control).
  568. @param dc
  569. The device context to draw onto.
  570. @param wnd
  571. The window which is being drawn onto. In most cases this will be a
  572. wxRibbonToolBar, but it doesn't have to be.
  573. @param rect
  574. The rectangle within which to draw. The size of this rectangle will
  575. at least the size returned by GetToolSize(), and the height of it
  576. will be equal for all tools within the same group. The rectangle
  577. will be entirely within a rectangle on the same device context
  578. previously painted with DrawToolGroupBackground().
  579. @param bitmap
  580. The bitmap to use as the tool's foreground. If the tool is a hybrid
  581. or dropdown tool, then the foreground should also contain a
  582. standard dropdown button.
  583. @param kind
  584. The kind of tool to draw (normal, dropdown, or hybrid).
  585. @param state
  586. A combination of wxRibbonToolBarToolState flags giving the state of
  587. the tool and it's relative position within a tool group.
  588. */
  589. virtual void DrawTool(
  590. wxDC& dc,
  591. wxWindow* wnd,
  592. const wxRect& rect,
  593. const wxBitmap& bitmap,
  594. wxRibbonButtonKind kind,
  595. long state) = 0;
  596. /**
  597. Draw toggle button on wxRibbonBar. This should draw a small toggle button
  598. at top right corner of ribbon bar.
  599. @param dc
  600. The device context to draw onto.
  601. @param wnd
  602. The window which is being drawn onto, which is always the panel
  603. whose background and chrome is being drawn. The panel label and
  604. other panel attributes can be obtained by querying this.
  605. @param rect
  606. The rectangle within which to draw.
  607. @param mode
  608. The wxRibbonDisplayMode which should be applied to display button
  609. @since 2.9.5
  610. */
  611. virtual void DrawToggleButton(wxDC& dc,
  612. wxRibbonBar* wnd,
  613. const wxRect& rect,
  614. wxRibbonDisplayMode mode) = 0;
  615. /**
  616. Draw help button on wxRibbonBar. This should draw a help button
  617. at top right corner of ribbon bar.
  618. @param dc
  619. The device context to draw onto.
  620. @param wnd
  621. The window which is being drawn onto, which is always the panel
  622. whose background and chrome is being drawn. The panel label and
  623. other panel attributes can be obtained by querying this.
  624. @param rect
  625. The rectangle within which to draw.
  626. @since 2.9.5
  627. */
  628. virtual void DrawHelpButton(wxDC& dc,
  629. wxRibbonBar* wnd,
  630. const wxRect& rect) = 0;
  631. /**
  632. Calculate the ideal and minimum width (in pixels) of a tab in a ribbon
  633. bar.
  634. @param dc
  635. A device context to use when one is required for size calculations.
  636. @param wnd
  637. The window onto which the tab will eventually be drawn.
  638. @param label
  639. The tab's label (or wxEmptyString if it has none).
  640. @param bitmap
  641. The tab's icon (or wxNullBitmap if it has none).
  642. @param[out] ideal
  643. The ideal width (in pixels) of the tab.
  644. @param[out] small_begin_need_separator
  645. A size less than the @a ideal size, at which a tab separator should
  646. begin to be drawn (i.e. drawn, but still fairly transparent).
  647. @param[out] small_must_have_separator
  648. A size less than the @a small_begin_need_separator size, at which a
  649. tab separator must be drawn (i.e. drawn at full opacity).
  650. @param[out] minimum
  651. A size less than the @a small_must_have_separator size, and greater
  652. than or equal to zero, which is the minimum pixel width for the tab.
  653. */
  654. virtual void GetBarTabWidth(
  655. wxDC& dc,
  656. wxWindow* wnd,
  657. const wxString& label,
  658. const wxBitmap& bitmap,
  659. int* ideal,
  660. int* small_begin_need_separator,
  661. int* small_must_have_separator,
  662. int* minimum) = 0;
  663. /**
  664. Calculate the height (in pixels) of the tab region of a ribbon bar.
  665. Note that as the tab region can contain scroll buttons, the height
  666. should be greater than or equal to the minimum height for a tab scroll
  667. button.
  668. @param dc
  669. A device context to use when one is required for size calculations.
  670. @param wnd
  671. The window onto which the tabs will eventually be drawn.
  672. @param pages
  673. The tabs which will acquire the returned height.
  674. */
  675. virtual int GetTabCtrlHeight(
  676. wxDC& dc,
  677. wxWindow* wnd,
  678. const wxRibbonPageTabInfoArray& pages) = 0;
  679. /**
  680. Calculate the minimum size (in pixels) of a scroll button.
  681. @param dc
  682. A device context to use when one is required for size calculations.
  683. @param wnd
  684. The window onto which the scroll button will eventually be drawn.
  685. @param style
  686. A combination of flags from @ref wxRibbonScrollButtonStyle, including
  687. a direction, and a for flag (state flags may be given too, but
  688. should be ignored, as a button should retain a constant size,
  689. regardless of its state).
  690. */
  691. virtual wxSize GetScrollButtonMinimumSize(
  692. wxDC& dc,
  693. wxWindow* wnd,
  694. long style) = 0;
  695. /**
  696. Calculate the size of a panel for a given client size. This should
  697. increment the given size by enough to fit the panel label and other
  698. chrome.
  699. @param dc
  700. A device context to use if one is required for size calculations.
  701. @param wnd
  702. The ribbon panel in question.
  703. @param client_size
  704. The client size.
  705. @param[out] client_offset
  706. The offset where the client rectangle begins within the panel (may
  707. be NULL).
  708. @sa GetPanelClientSize()
  709. */
  710. virtual wxSize GetPanelSize(
  711. wxDC& dc,
  712. const wxRibbonPanel* wnd,
  713. wxSize client_size,
  714. wxPoint* client_offset) = 0;
  715. /**
  716. Calculate the client size of a panel for a given overall size. This
  717. should act as the inverse to GetPanelSize(), and decrement the given
  718. size by enough to fit the panel label and other chrome.
  719. @param dc
  720. A device context to use if one is required for size calculations.
  721. @param wnd
  722. The ribbon panel in question.
  723. @param size
  724. The overall size to calculate client size for.
  725. @param[out] client_offset
  726. The offset where the returned client size begins within the given
  727. @a size (may be NULL).
  728. @sa GetPanelSize()
  729. */
  730. virtual wxSize GetPanelClientSize(
  731. wxDC& dc,
  732. const wxRibbonPanel* wnd,
  733. wxSize size,
  734. wxPoint* client_offset) = 0;
  735. /**
  736. Calculate the position and size of the panel extension button.
  737. @param dc
  738. A device context to use if one is required for size calculations.
  739. @param wnd
  740. The ribbon panel in question.
  741. @param rect
  742. The panel rectangle from which calculate extension button rectangle.
  743. @since 2.9.4
  744. */
  745. virtual wxRect GetPanelExtButtonArea(
  746. wxDC& dc,
  747. const wxRibbonPanel* wnd,
  748. wxRect rect) = 0;
  749. /**
  750. Calculate the size of a wxRibbonGallery control for a given client
  751. size. This should increment the given size by enough to fit the gallery
  752. border, buttons, and any other chrome.
  753. @param dc
  754. A device context to use if one is required for size calculations.
  755. @param wnd
  756. The gallery in question.
  757. @param client_size
  758. The client size.
  759. @sa GetGalleryClientSize()
  760. */
  761. virtual wxSize GetGallerySize(
  762. wxDC& dc,
  763. const wxRibbonGallery* wnd,
  764. wxSize client_size) = 0;
  765. /**
  766. Calculate the client size of a wxRibbonGallery control for a given
  767. size. This should act as the inverse to GetGallerySize(), and decrement
  768. the given size by enough to fir the gallery border, buttons, and other
  769. chrome.
  770. @param dc
  771. A device context to use if one is required for size calculations.
  772. @param wnd
  773. The gallery in question.
  774. @param size
  775. The overall size to calculate the client size for.
  776. @param[out] client_offset
  777. The position within the given size at which the returned client
  778. size begins.
  779. @param[out] scroll_up_button
  780. The rectangle within the given size which the scroll up button
  781. occupies.
  782. @param[out] scroll_down_button
  783. The rectangle within the given size which the scroll down button
  784. occupies.
  785. @param[out] extension_button
  786. The rectangle within the given size which the extension button
  787. occupies.
  788. */
  789. virtual wxSize GetGalleryClientSize(
  790. wxDC& dc,
  791. const wxRibbonGallery* wnd,
  792. wxSize size,
  793. wxPoint* client_offset,
  794. wxRect* scroll_up_button,
  795. wxRect* scroll_down_button,
  796. wxRect* extension_button) = 0;
  797. /**
  798. Calculate the portion of a page background which needs to be redrawn
  799. when a page is resized. To optimise the drawing of page backgrounds, as
  800. small an area as possible should be returned. Of course, if the way in
  801. which a background is drawn means that the entire background needs to
  802. be repainted on resize, then the entire new size should be returned.
  803. @param dc
  804. A device context to use when one is required for size calculations.
  805. @param wnd
  806. The page which is being resized.
  807. @param page_old_size
  808. The size of the page prior to the resize (which has already been
  809. painted).
  810. @param page_new_size
  811. The size of the page after the resize.
  812. */
  813. virtual wxRect GetPageBackgroundRedrawArea(
  814. wxDC& dc,
  815. const wxRibbonPage* wnd,
  816. wxSize page_old_size,
  817. wxSize page_new_size) = 0;
  818. /**
  819. Calculate the size of a button within a wxRibbonButtonBar.
  820. @param dc
  821. A device context to use when one is required for size calculations.
  822. @param wnd
  823. The window onto which the button will eventually be drawn (which is
  824. normally a wxRibbonButtonBar, though this is not guaranteed).
  825. @param kind
  826. The kind of button.
  827. @param size
  828. The size-class to calculate the size for. Buttons on a button bar
  829. can have three distinct sizes: wxRIBBON_BUTTONBAR_BUTTON_SMALL,
  830. wxRIBBON_BUTTONBAR_BUTTON_MEDIUM, and wxRIBBON_BUTTONBAR_BUTTON_LARGE.
  831. If the requested size-class is not applicable, then @false should
  832. be returned.
  833. @param label
  834. The label of the button.
  835. @param bitmap_size_large
  836. The size of all "large" bitmaps on the button bar.
  837. @param bitmap_size_small
  838. The size of all "small" bitmaps on the button bar.
  839. @param[out] button_size
  840. The size, in pixels, of the button.
  841. @param[out] normal_region
  842. The region of the button which constitutes the normal button.
  843. @param[out] dropdown_region
  844. The region of the button which constitutes the dropdown button.
  845. @return @true if a size exists for the button, @false otherwise.
  846. */
  847. virtual bool GetButtonBarButtonSize(
  848. wxDC& dc,
  849. wxWindow* wnd,
  850. wxRibbonButtonBarButtonKind kind,
  851. wxRibbonButtonBarButtonState size,
  852. const wxString& label,
  853. wxSize bitmap_size_large,
  854. wxSize bitmap_size_small,
  855. wxSize* button_size,
  856. wxRect* normal_region,
  857. wxRect* dropdown_region) = 0;
  858. /**
  859. Calculate the size of a minimised ribbon panel.
  860. @param dc
  861. A device context to use when one is required for size calculations.
  862. @param wnd
  863. The ribbon panel in question. Attributes like the panel label can
  864. be queried from this.
  865. @param[out] desired_bitmap_size
  866. Optional parameter which is filled with the size of the bitmap
  867. suitable for a minimised ribbon panel.
  868. @param[out] expanded_panel_direction
  869. Optional parameter which is filled with the direction of the
  870. minimised panel (@c wxEAST or @c wxSOUTH depending on the style).
  871. */
  872. virtual wxSize GetMinimisedPanelMinimumSize(
  873. wxDC& dc,
  874. const wxRibbonPanel* wnd,
  875. wxSize* desired_bitmap_size,
  876. wxDirection* expanded_panel_direction) = 0;
  877. /**
  878. Calculate the size of a tool within a wxRibbonToolBar.
  879. @param dc
  880. A device context to use when one is required for size calculations.
  881. @param wnd
  882. The window onto which the tool will eventually be drawn.
  883. @param bitmap_size
  884. The size of the tool's foreground bitmap.
  885. @param kind
  886. The kind of tool (normal, dropdown, or hybrid).
  887. @param is_first
  888. @true if the tool is the first within its group. @false otherwise.
  889. @param is_last
  890. @true if the tool is the last within its group. @false otherwise.
  891. @param[out] dropdown_region
  892. For dropdown and hybrid tools, the region within the returned
  893. size which counts as the dropdown part.
  894. */
  895. virtual wxSize GetToolSize(
  896. wxDC& dc,
  897. wxWindow* wnd,
  898. wxSize bitmap_size,
  899. wxRibbonButtonKind kind,
  900. bool is_first,
  901. bool is_last,
  902. wxRect* dropdown_region) = 0;
  903. /**
  904. Calculate the position and size of the ribbon's toggle button.
  905. @param rect
  906. The ribbon bar rectangle from which calculate toggle button rectangle.
  907. @since 2.9.5
  908. */
  909. virtual wxRect GetBarToggleButtonArea(const wxRect& rect) = 0;
  910. /**
  911. Calculate the position and size of the ribbon's help button.
  912. @param rect
  913. The ribbon bar rectangle from which calculate help button rectangle.
  914. @since 2.9.5
  915. */
  916. virtual wxRect GetRibbonHelpButtonArea(const wxRect& rect) = 0;
  917. };