wxPython 4.3.2__cp315-cp315-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (472) hide show
  1. wx/WebView2Loader.dll +0 -0
  2. wx/__init__.py +22 -0
  3. wx/__init__.pyi +10 -0
  4. wx/__version__.py +9 -0
  5. wx/__version__.pyi +15 -0
  6. wx/_adv.cp315-win_amd64.pyd +0 -0
  7. wx/_aui.cp315-win_amd64.pyd +0 -0
  8. wx/_core.cp315-win_amd64.pyd +0 -0
  9. wx/_dataview.cp315-win_amd64.pyd +0 -0
  10. wx/_glcanvas.cp315-win_amd64.pyd +0 -0
  11. wx/_grid.cp315-win_amd64.pyd +0 -0
  12. wx/_html.cp315-win_amd64.pyd +0 -0
  13. wx/_html2.cp315-win_amd64.pyd +0 -0
  14. wx/_media.cp315-win_amd64.pyd +0 -0
  15. wx/_msw.cp315-win_amd64.pyd +0 -0
  16. wx/_propgrid.cp315-win_amd64.pyd +0 -0
  17. wx/_ribbon.cp315-win_amd64.pyd +0 -0
  18. wx/_richtext.cp315-win_amd64.pyd +0 -0
  19. wx/_stc.cp315-win_amd64.pyd +0 -0
  20. wx/_xml.cp315-win_amd64.pyd +0 -0
  21. wx/_xrc.cp315-win_amd64.pyd +0 -0
  22. wx/adv.py +127 -0
  23. wx/adv.pyi +5931 -0
  24. wx/aui.py +70 -0
  25. wx/aui.pyi +4805 -0
  26. wx/core.py +3417 -0
  27. wx/core.pyi +62949 -0
  28. wx/dataview.py +176 -0
  29. wx/dataview.pyi +3828 -0
  30. wx/gizmos.py +18 -0
  31. wx/glcanvas.py +13 -0
  32. wx/glcanvas.pyi +544 -0
  33. wx/grid.py +237 -0
  34. wx/grid.pyi +5678 -0
  35. wx/html.py +38 -0
  36. wx/html.pyi +3283 -0
  37. wx/html2.py +46 -0
  38. wx/html2.pyi +1301 -0
  39. wx/include/wxPython/sip.h +1938 -0
  40. wx/include/wxPython/wxpy_api.h +418 -0
  41. wx/lib/CDate.py +201 -0
  42. wx/lib/ClickableHtmlWindow.py +57 -0
  43. wx/lib/__init__.py +0 -0
  44. wx/lib/activex.py +178 -0
  45. wx/lib/activexwrapper.py +153 -0
  46. wx/lib/agw/__init__.py +128 -0
  47. wx/lib/agw/advancedsplash.py +563 -0
  48. wx/lib/agw/aquabutton.py +1127 -0
  49. wx/lib/agw/artmanager.py +2110 -0
  50. wx/lib/agw/aui/__init__.py +295 -0
  51. wx/lib/agw/aui/aui_constants.py +2616 -0
  52. wx/lib/agw/aui/aui_switcherdialog.py +1232 -0
  53. wx/lib/agw/aui/aui_utilities.py +648 -0
  54. wx/lib/agw/aui/auibar.py +4045 -0
  55. wx/lib/agw/aui/auibook.py +6288 -0
  56. wx/lib/agw/aui/dockart.py +1198 -0
  57. wx/lib/agw/aui/framemanager.py +10485 -0
  58. wx/lib/agw/aui/tabart.py +2749 -0
  59. wx/lib/agw/aui/tabmdi.py +679 -0
  60. wx/lib/agw/balloontip.py +1157 -0
  61. wx/lib/agw/buttonpanel.py +2787 -0
  62. wx/lib/agw/cubecolourdialog.py +3529 -0
  63. wx/lib/agw/customtreectrl.py +9908 -0
  64. wx/lib/agw/data/ShortcutEditor_1.png +0 -0
  65. wx/lib/agw/data/ShortcutEditor_1_thumb.png +0 -0
  66. wx/lib/agw/data/ShortcutEditor_2.png +0 -0
  67. wx/lib/agw/data/ShortcutEditor_2_thumb.png +0 -0
  68. wx/lib/agw/data/ShortcutEditor_3.png +0 -0
  69. wx/lib/agw/data/ShortcutEditor_3_thumb.png +0 -0
  70. wx/lib/agw/data/ShortcutEditor_4.png +0 -0
  71. wx/lib/agw/data/ShortcutEditor_4_thumb.png +0 -0
  72. wx/lib/agw/data/default_help_text.html +105 -0
  73. wx/lib/agw/flatmenu.py +7392 -0
  74. wx/lib/agw/flatnotebook.py +6669 -0
  75. wx/lib/agw/floatspin.py +1820 -0
  76. wx/lib/agw/fmcustomizedlg.py +535 -0
  77. wx/lib/agw/fmresources.py +407 -0
  78. wx/lib/agw/foldpanelbar.py +2282 -0
  79. wx/lib/agw/fourwaysplitter.py +1130 -0
  80. wx/lib/agw/genericmessagedialog.py +1549 -0
  81. wx/lib/agw/gradientbutton.py +731 -0
  82. wx/lib/agw/hyperlink.py +664 -0
  83. wx/lib/agw/hypertreelist.py +5756 -0
  84. wx/lib/agw/infobar.py +885 -0
  85. wx/lib/agw/knobctrl.py +944 -0
  86. wx/lib/agw/labelbook.py +3028 -0
  87. wx/lib/agw/multidirdialog.py +581 -0
  88. wx/lib/agw/peakmeter.py +1028 -0
  89. wx/lib/agw/persist/__init__.py +188 -0
  90. wx/lib/agw/persist/persist_constants.py +283 -0
  91. wx/lib/agw/persist/persist_handlers.py +2614 -0
  92. wx/lib/agw/persist/persistencemanager.py +863 -0
  93. wx/lib/agw/piectrl.py +1082 -0
  94. wx/lib/agw/pybusyinfo.py +399 -0
  95. wx/lib/agw/pycollapsiblepane.py +940 -0
  96. wx/lib/agw/pygauge.py +570 -0
  97. wx/lib/agw/pyprogress.py +916 -0
  98. wx/lib/agw/ribbon/__init__.py +198 -0
  99. wx/lib/agw/ribbon/art.py +219 -0
  100. wx/lib/agw/ribbon/art_aui.py +1283 -0
  101. wx/lib/agw/ribbon/art_default.py +81 -0
  102. wx/lib/agw/ribbon/art_internal.py +248 -0
  103. wx/lib/agw/ribbon/art_msw.py +2735 -0
  104. wx/lib/agw/ribbon/art_osx.py +52 -0
  105. wx/lib/agw/ribbon/bar.py +1259 -0
  106. wx/lib/agw/ribbon/buttonbar.py +1317 -0
  107. wx/lib/agw/ribbon/control.py +205 -0
  108. wx/lib/agw/ribbon/gallery.py +973 -0
  109. wx/lib/agw/ribbon/page.py +946 -0
  110. wx/lib/agw/ribbon/panel.py +1170 -0
  111. wx/lib/agw/ribbon/toolbar.py +1441 -0
  112. wx/lib/agw/rulerctrl.py +1885 -0
  113. wx/lib/agw/scrolledthumbnail.py +2116 -0
  114. wx/lib/agw/shapedbutton.py +1809 -0
  115. wx/lib/agw/shortcuteditor.py +2642 -0
  116. wx/lib/agw/speedmeter.py +1800 -0
  117. wx/lib/agw/supertooltip.py +1443 -0
  118. wx/lib/agw/thumbnailctrl.py +529 -0
  119. wx/lib/agw/toasterbox.py +1327 -0
  120. wx/lib/agw/ultimatelistctrl.py +13671 -0
  121. wx/lib/agw/xlsgrid.py +2111 -0
  122. wx/lib/agw/zoombar.py +1336 -0
  123. wx/lib/analogclock/__init__.py +140 -0
  124. wx/lib/analogclock/analogclock.py +630 -0
  125. wx/lib/analogclock/helpers.py +986 -0
  126. wx/lib/analogclock/lib_setup/__init__.py +0 -0
  127. wx/lib/analogclock/lib_setup/buttontreectrlpanel.py +297 -0
  128. wx/lib/analogclock/lib_setup/fontselect.py +57 -0
  129. wx/lib/analogclock/setup.py +490 -0
  130. wx/lib/analogclock/styles.py +47 -0
  131. wx/lib/anchors.py +103 -0
  132. wx/lib/art/__init__.py +4 -0
  133. wx/lib/art/flagart.py +1583 -0
  134. wx/lib/art/img2pyartprov.py +56 -0
  135. wx/lib/busy.py +152 -0
  136. wx/lib/buttons.py +1140 -0
  137. wx/lib/calendar.py +1596 -0
  138. wx/lib/checkbox.py +837 -0
  139. wx/lib/colourchooser/__init__.py +36 -0
  140. wx/lib/colourchooser/canvas.py +145 -0
  141. wx/lib/colourchooser/intl.py +24 -0
  142. wx/lib/colourchooser/pycolourbox.py +89 -0
  143. wx/lib/colourchooser/pycolourchooser.py +626 -0
  144. wx/lib/colourchooser/pycolourslider.py +98 -0
  145. wx/lib/colourchooser/pypalette.py +208 -0
  146. wx/lib/colourdb.py +740 -0
  147. wx/lib/colourselect.py +385 -0
  148. wx/lib/colourutils.py +118 -0
  149. wx/lib/combotreebox.py +944 -0
  150. wx/lib/delayedresult.py +420 -0
  151. wx/lib/dialogs.py +510 -0
  152. wx/lib/docview.py +3210 -0
  153. wx/lib/dragscroller.py +79 -0
  154. wx/lib/editor/README.txt +77 -0
  155. wx/lib/editor/__init__.py +24 -0
  156. wx/lib/editor/editor.py +974 -0
  157. wx/lib/editor/images.py +15 -0
  158. wx/lib/editor/selection.py +44 -0
  159. wx/lib/embeddedimage.py +76 -0
  160. wx/lib/eventStack.py +136 -0
  161. wx/lib/eventwatcher.py +440 -0
  162. wx/lib/evtmgr.py +521 -0
  163. wx/lib/expando.py +393 -0
  164. wx/lib/fancytext.py +494 -0
  165. wx/lib/filebrowsebutton.py +461 -0
  166. wx/lib/flashwin.py +262 -0
  167. wx/lib/flashwin_old.py +651 -0
  168. wx/lib/floatcanvas/FCEvents.py +53 -0
  169. wx/lib/floatcanvas/FCObjects.py +2910 -0
  170. wx/lib/floatcanvas/FloatCanvas.py +1025 -0
  171. wx/lib/floatcanvas/GUIMode.py +396 -0
  172. wx/lib/floatcanvas/NavCanvas.py +162 -0
  173. wx/lib/floatcanvas/Resources.py +319 -0
  174. wx/lib/floatcanvas/ScreenShot.py +1788 -0
  175. wx/lib/floatcanvas/Utilities/BBox.py +313 -0
  176. wx/lib/floatcanvas/Utilities/Colors.py +137 -0
  177. wx/lib/floatcanvas/Utilities/GUI.py +91 -0
  178. wx/lib/floatcanvas/Utilities/__init__.py +7 -0
  179. wx/lib/floatcanvas/__init__.py +124 -0
  180. wx/lib/foldmenu.py +89 -0
  181. wx/lib/gestures.py +310 -0
  182. wx/lib/gizmos/__init__.py +18 -0
  183. wx/lib/gizmos/dynamicsash.py +1202 -0
  184. wx/lib/gizmos/ledctrl.py +299 -0
  185. wx/lib/gizmos/treelistctrl.py +87 -0
  186. wx/lib/graphics.py +1942 -0
  187. wx/lib/gridmovers.py +516 -0
  188. wx/lib/iewin.py +249 -0
  189. wx/lib/iewin_old.py +894 -0
  190. wx/lib/imagebrowser.py +853 -0
  191. wx/lib/imageutils.py +163 -0
  192. wx/lib/infoframe.py +490 -0
  193. wx/lib/inspection.py +1254 -0
  194. wx/lib/intctrl.py +990 -0
  195. wx/lib/itemspicker.py +256 -0
  196. wx/lib/langlistctrl.py +480 -0
  197. wx/lib/layoutf.py +271 -0
  198. wx/lib/masked/__init__.py +27 -0
  199. wx/lib/masked/combobox.py +839 -0
  200. wx/lib/masked/ctrl.py +108 -0
  201. wx/lib/masked/ipaddrctrl.py +241 -0
  202. wx/lib/masked/maskededit.py +7262 -0
  203. wx/lib/masked/numctrl.py +2000 -0
  204. wx/lib/masked/textctrl.py +465 -0
  205. wx/lib/masked/timectrl.py +1465 -0
  206. wx/lib/mixins/__init__.py +17 -0
  207. wx/lib/mixins/grid.py +47 -0
  208. wx/lib/mixins/gridlabelrenderer.py +277 -0
  209. wx/lib/mixins/imagelist.py +77 -0
  210. wx/lib/mixins/inspection.py +184 -0
  211. wx/lib/mixins/listctrl.py +893 -0
  212. wx/lib/mixins/rubberband.py +403 -0
  213. wx/lib/mixins/treemixin.py +678 -0
  214. wx/lib/msgpanel.py +95 -0
  215. wx/lib/multisash.py +746 -0
  216. wx/lib/myole4ax.idl +178 -0
  217. wx/lib/myole4ax.tlb +0 -0
  218. wx/lib/newevent.py +229 -0
  219. wx/lib/newevent.pyi +25 -0
  220. wx/lib/nvdlg.py +156 -0
  221. wx/lib/ogl/__init__.py +13 -0
  222. wx/lib/ogl/basic.py +3989 -0
  223. wx/lib/ogl/bmpshape.py +86 -0
  224. wx/lib/ogl/canvas.py +467 -0
  225. wx/lib/ogl/composit.py +1576 -0
  226. wx/lib/ogl/diagram.py +230 -0
  227. wx/lib/ogl/divided.py +482 -0
  228. wx/lib/ogl/drawn.py +898 -0
  229. wx/lib/ogl/lines.py +1809 -0
  230. wx/lib/ogl/oglmisc.py +607 -0
  231. wx/lib/pdfviewer/__init__.py +113 -0
  232. wx/lib/pdfviewer/bitmaps/ArrowLeft.png +0 -0
  233. wx/lib/pdfviewer/bitmaps/ArrowRight.png +0 -0
  234. wx/lib/pdfviewer/bitmaps/DirectionH.png +0 -0
  235. wx/lib/pdfviewer/bitmaps/DirectionV.png +0 -0
  236. wx/lib/pdfviewer/bitmaps/PlayerFirst.png +0 -0
  237. wx/lib/pdfviewer/bitmaps/PlayerLast.png +0 -0
  238. wx/lib/pdfviewer/bitmaps/PlayerNext.png +0 -0
  239. wx/lib/pdfviewer/bitmaps/PlayerPrev.png +0 -0
  240. wx/lib/pdfviewer/bitmaps/Printer.png +0 -0
  241. wx/lib/pdfviewer/bitmaps/ReadMe.txt +28 -0
  242. wx/lib/pdfviewer/bitmaps/Save.png +0 -0
  243. wx/lib/pdfviewer/bitmaps/ZoomIn.png +0 -0
  244. wx/lib/pdfviewer/bitmaps/ZoomOut.png +0 -0
  245. wx/lib/pdfviewer/bitmaps/encode_bitmaps.py +37 -0
  246. wx/lib/pdfviewer/buttonpanel.py +285 -0
  247. wx/lib/pdfviewer/images.py +240 -0
  248. wx/lib/pdfviewer/viewer.py +1118 -0
  249. wx/lib/pdfwin.py +295 -0
  250. wx/lib/pdfwin_old.py +789 -0
  251. wx/lib/platebtn.py +789 -0
  252. wx/lib/plot/CHANGELOG.md +150 -0
  253. wx/lib/plot/README.md +16 -0
  254. wx/lib/plot/__init__.py +46 -0
  255. wx/lib/plot/__main__.py +5 -0
  256. wx/lib/plot/examples/__init__.py +0 -0
  257. wx/lib/plot/examples/demo.py +1010 -0
  258. wx/lib/plot/examples/simple_example.py +56 -0
  259. wx/lib/plot/plotcanvas.py +2985 -0
  260. wx/lib/plot/polyobjects.py +1524 -0
  261. wx/lib/plot/utils.py +334 -0
  262. wx/lib/popupctl.py +251 -0
  263. wx/lib/printout.py +1155 -0
  264. wx/lib/progressindicator.py +151 -0
  265. wx/lib/pubsub/LICENSE_BSD_Simple.txt +23 -0
  266. wx/lib/pubsub/README_WxPython.txt +22 -0
  267. wx/lib/pubsub/RELEASE_NOTES.txt +71 -0
  268. wx/lib/pubsub/__init__.py +25 -0
  269. wx/lib/pubsub/core/__init__.py +92 -0
  270. wx/lib/pubsub/core/arg1/__init__.py +16 -0
  271. wx/lib/pubsub/core/arg1/listenerimpl.py +97 -0
  272. wx/lib/pubsub/core/arg1/publisher.py +40 -0
  273. wx/lib/pubsub/core/arg1/publishermixin.py +34 -0
  274. wx/lib/pubsub/core/arg1/topicargspecimpl.py +66 -0
  275. wx/lib/pubsub/core/arg1/topicmgrimpl.py +19 -0
  276. wx/lib/pubsub/core/callables.py +198 -0
  277. wx/lib/pubsub/core/imp2.py +62 -0
  278. wx/lib/pubsub/core/itopicdefnprovider.py +0 -0
  279. wx/lib/pubsub/core/kwargs/__init__.py +16 -0
  280. wx/lib/pubsub/core/kwargs/datamsg.py +27 -0
  281. wx/lib/pubsub/core/kwargs/listenerimpl.py +93 -0
  282. wx/lib/pubsub/core/kwargs/publisher.py +77 -0
  283. wx/lib/pubsub/core/kwargs/publishermixin.py +65 -0
  284. wx/lib/pubsub/core/kwargs/topicargspecimpl.py +216 -0
  285. wx/lib/pubsub/core/kwargs/topicmgrimpl.py +13 -0
  286. wx/lib/pubsub/core/listener.py +40 -0
  287. wx/lib/pubsub/core/listenerbase.py +185 -0
  288. wx/lib/pubsub/core/notificationmgr.py +185 -0
  289. wx/lib/pubsub/core/publisherbase.py +189 -0
  290. wx/lib/pubsub/core/topicargspec.py +77 -0
  291. wx/lib/pubsub/core/topicdefnprovider.py +631 -0
  292. wx/lib/pubsub/core/topicexc.py +72 -0
  293. wx/lib/pubsub/core/topicmgr.py +454 -0
  294. wx/lib/pubsub/core/topicobj.py +472 -0
  295. wx/lib/pubsub/core/topictreetraverser.py +143 -0
  296. wx/lib/pubsub/core/topicutils.py +119 -0
  297. wx/lib/pubsub/core/treeconfig.py +21 -0
  298. wx/lib/pubsub/core/validatedefnargs.py +29 -0
  299. wx/lib/pubsub/core/weakmethod.py +102 -0
  300. wx/lib/pubsub/policies.py +24 -0
  301. wx/lib/pubsub/pub.py +199 -0
  302. wx/lib/pubsub/setuparg1.py +47 -0
  303. wx/lib/pubsub/setupkwargs.py +29 -0
  304. wx/lib/pubsub/utils/__init__.py +27 -0
  305. wx/lib/pubsub/utils/exchandling.py +100 -0
  306. wx/lib/pubsub/utils/misc.py +99 -0
  307. wx/lib/pubsub/utils/notification.py +331 -0
  308. wx/lib/pubsub/utils/topictreeprinter.py +195 -0
  309. wx/lib/pubsub/utils/xmltopicdefnprovider.py +286 -0
  310. wx/lib/pydocview.py +3300 -0
  311. wx/lib/rcsizer.py +227 -0
  312. wx/lib/resizewidget.py +357 -0
  313. wx/lib/scrolledpanel.py +243 -0
  314. wx/lib/sheet.py +350 -0
  315. wx/lib/sized_controls.py +691 -0
  316. wx/lib/softwareupdate.py +355 -0
  317. wx/lib/splitter.py +925 -0
  318. wx/lib/statbmp.py +199 -0
  319. wx/lib/stattext.py +321 -0
  320. wx/lib/throbber.py +424 -0
  321. wx/lib/ticker.py +306 -0
  322. wx/lib/ticker_xrc.py +48 -0
  323. wx/lib/utils.py +89 -0
  324. wx/lib/wordwrap.py +97 -0
  325. wx/lib/wxcairo/__init__.py +139 -0
  326. wx/lib/wxcairo/wx_cairocffi.py +200 -0
  327. wx/lib/wxcairo/wx_pycairo.py +455 -0
  328. wx/lib/wxpTag.py +274 -0
  329. wx/libcairo-2.dll +0 -0
  330. wx/locale/af/LC_MESSAGES/wxstd.mo +0 -0
  331. wx/locale/an/LC_MESSAGES/wxstd.mo +0 -0
  332. wx/locale/ar/LC_MESSAGES/wxstd.mo +0 -0
  333. wx/locale/ca/LC_MESSAGES/wxstd.mo +0 -0
  334. wx/locale/ca@valencia/LC_MESSAGES/wxstd.mo +0 -0
  335. wx/locale/co/LC_MESSAGES/wxstd.mo +0 -0
  336. wx/locale/cs/LC_MESSAGES/wxstd.mo +0 -0
  337. wx/locale/da/LC_MESSAGES/wxstd.mo +0 -0
  338. wx/locale/de/LC_MESSAGES/wxstd.mo +0 -0
  339. wx/locale/el/LC_MESSAGES/wxstd.mo +0 -0
  340. wx/locale/es/LC_MESSAGES/wxstd.mo +0 -0
  341. wx/locale/eu/LC_MESSAGES/wxstd.mo +0 -0
  342. wx/locale/fa_IR/LC_MESSAGES/wxstd.mo +0 -0
  343. wx/locale/fi/LC_MESSAGES/wxstd.mo +0 -0
  344. wx/locale/fr/LC_MESSAGES/wxstd.mo +0 -0
  345. wx/locale/gl_ES/LC_MESSAGES/wxstd.mo +0 -0
  346. wx/locale/hi/LC_MESSAGES/wxstd.mo +0 -0
  347. wx/locale/hr/LC_MESSAGES/wxstd.mo +0 -0
  348. wx/locale/hu/LC_MESSAGES/wxstd.mo +0 -0
  349. wx/locale/id/LC_MESSAGES/wxstd.mo +0 -0
  350. wx/locale/it/LC_MESSAGES/wxstd.mo +0 -0
  351. wx/locale/ja/LC_MESSAGES/wxstd.mo +0 -0
  352. wx/locale/ka/LC_MESSAGES/wxstd.mo +0 -0
  353. wx/locale/ko_KR/LC_MESSAGES/wxstd.mo +0 -0
  354. wx/locale/lt/LC_MESSAGES/wxstd.mo +0 -0
  355. wx/locale/lv/LC_MESSAGES/wxstd.mo +0 -0
  356. wx/locale/ms/LC_MESSAGES/wxstd.mo +0 -0
  357. wx/locale/nb/LC_MESSAGES/wxstd.mo +0 -0
  358. wx/locale/ne/LC_MESSAGES/wxstd.mo +0 -0
  359. wx/locale/nl/LC_MESSAGES/wxstd.mo +0 -0
  360. wx/locale/pl/LC_MESSAGES/wxstd.mo +0 -0
  361. wx/locale/pt/LC_MESSAGES/wxstd.mo +0 -0
  362. wx/locale/pt_BR/LC_MESSAGES/wxstd.mo +0 -0
  363. wx/locale/ro/LC_MESSAGES/wxstd.mo +0 -0
  364. wx/locale/ru/LC_MESSAGES/wxstd.mo +0 -0
  365. wx/locale/sk/LC_MESSAGES/wxstd.mo +0 -0
  366. wx/locale/sl/LC_MESSAGES/wxstd.mo +0 -0
  367. wx/locale/sq/LC_MESSAGES/wxstd.mo +0 -0
  368. wx/locale/sr/LC_MESSAGES/wxstd.mo +0 -0
  369. wx/locale/sv/LC_MESSAGES/wxstd.mo +0 -0
  370. wx/locale/ta/LC_MESSAGES/wxstd.mo +0 -0
  371. wx/locale/tr/LC_MESSAGES/wxstd.mo +0 -0
  372. wx/locale/uk/LC_MESSAGES/wxstd.mo +0 -0
  373. wx/locale/vi/LC_MESSAGES/wxstd.mo +0 -0
  374. wx/locale/zh_CN/LC_MESSAGES/wxstd.mo +0 -0
  375. wx/locale/zh_TW/LC_MESSAGES/wxstd.mo +0 -0
  376. wx/media.py +30 -0
  377. wx/media.pyi +272 -0
  378. wx/msw.py +16 -0
  379. wx/msw.pyi +91 -0
  380. wx/propgrid.py +498 -0
  381. wx/propgrid.pyi +7427 -0
  382. wx/py/CHANGES.txt +796 -0
  383. wx/py/Py.ico +0 -0
  384. wx/py/PyAlaCarte.py +34 -0
  385. wx/py/PyAlaMode.py +34 -0
  386. wx/py/PyAlaModeTest.py +33 -0
  387. wx/py/PyCrust.ico +0 -0
  388. wx/py/PyCrust.py +78 -0
  389. wx/py/PyCrust_16.png +0 -0
  390. wx/py/PyCrust_32.png +0 -0
  391. wx/py/PyFilling.py +35 -0
  392. wx/py/PyShell.py +78 -0
  393. wx/py/PySlices.ico +0 -0
  394. wx/py/PySlices.py +98 -0
  395. wx/py/PySlicesShell.py +94 -0
  396. wx/py/PySlices_16.png +0 -0
  397. wx/py/PySlices_32.png +0 -0
  398. wx/py/PyWrap.py +52 -0
  399. wx/py/README.txt +77 -0
  400. wx/py/__init__.py +20 -0
  401. wx/py/buffer.py +136 -0
  402. wx/py/crust.py +403 -0
  403. wx/py/crustslices.py +403 -0
  404. wx/py/dispatcher.py +259 -0
  405. wx/py/document.py +37 -0
  406. wx/py/editor.py +844 -0
  407. wx/py/editwindow.py +316 -0
  408. wx/py/filling.py +358 -0
  409. wx/py/frame.py +976 -0
  410. wx/py/images.py +212 -0
  411. wx/py/interpreter.py +161 -0
  412. wx/py/introspect.py +402 -0
  413. wx/py/magic.py +98 -0
  414. wx/py/parse.py +134 -0
  415. wx/py/path.py +36 -0
  416. wx/py/pseudo.py +99 -0
  417. wx/py/shell.py +1579 -0
  418. wx/py/sliceshell.py +3805 -0
  419. wx/py/tests/test_interpreter.py +71 -0
  420. wx/py/tests/test_introspect.py +810 -0
  421. wx/py/tests/test_pseudo.py +70 -0
  422. wx/py/tests/test_version.py +36 -0
  423. wx/py/tests/testall.py +22 -0
  424. wx/py/version.py +7 -0
  425. wx/py.typed +0 -0
  426. wx/ribbon.py +48 -0
  427. wx/ribbon.pyi +3099 -0
  428. wx/richtext.py +141 -0
  429. wx/richtext.pyi +13581 -0
  430. wx/siplib.cp315-win_amd64.pyd +0 -0
  431. wx/siplib.pyi +19 -0
  432. wx/stc.py +59 -0
  433. wx/stc.pyi +9918 -0
  434. wx/svg/__init__.py +363 -0
  435. wx/svg/_nanosvg.cp315-win_amd64.pyd +0 -0
  436. wx/tools/__init__.py +18 -0
  437. wx/tools/dbg.py +268 -0
  438. wx/tools/genaxmodule.py +50 -0
  439. wx/tools/helpviewer.py +92 -0
  440. wx/tools/img2img.py +85 -0
  441. wx/tools/img2png.py +54 -0
  442. wx/tools/img2py.py +306 -0
  443. wx/tools/img2xpm.py +54 -0
  444. wx/tools/pywxrc.py +951 -0
  445. wx/tools/wxget.py +254 -0
  446. wx/tools/wxget_docs_demo.py +183 -0
  447. wx/wxbase334u_net_vc140_x64.dll +0 -0
  448. wx/wxbase334u_vc140_x64.dll +0 -0
  449. wx/wxbase334u_xml_vc140_x64.dll +0 -0
  450. wx/wxmsw334u_adv_vc140_x64.dll +0 -0
  451. wx/wxmsw334u_aui_vc140_x64.dll +0 -0
  452. wx/wxmsw334u_core_vc140_x64.dll +0 -0
  453. wx/wxmsw334u_gl_vc140_x64.dll +0 -0
  454. wx/wxmsw334u_html_vc140_x64.dll +0 -0
  455. wx/wxmsw334u_media_vc140_x64.dll +0 -0
  456. wx/wxmsw334u_propgrid_vc140_x64.dll +0 -0
  457. wx/wxmsw334u_qa_vc140_x64.dll +0 -0
  458. wx/wxmsw334u_ribbon_vc140_x64.dll +0 -0
  459. wx/wxmsw334u_richtext_vc140_x64.dll +0 -0
  460. wx/wxmsw334u_stc_vc140_x64.dll +0 -0
  461. wx/wxmsw334u_webview_vc140_x64.dll +0 -0
  462. wx/wxmsw334u_xrc_vc140_x64.dll +0 -0
  463. wx/xml.py +18 -0
  464. wx/xml.pyi +728 -0
  465. wx/xrc.py +68 -0
  466. wx/xrc.pyi +896 -0
  467. wxpython-4.3.2.dist-info/METADATA +71 -0
  468. wxpython-4.3.2.dist-info/RECORD +472 -0
  469. wxpython-4.3.2.dist-info/WHEEL +5 -0
  470. wxpython-4.3.2.dist-info/entry_points.txt +13 -0
  471. wxpython-4.3.2.dist-info/licenses/LICENSE.txt +610 -0
  472. wxpython-4.3.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1283 @@
1
+ # -*- coding: utf-8 -*-
2
+ #----------------------------------------------------------------------------
3
+ # Name: art_aui.py
4
+ # Purpose:
5
+ #
6
+ # Author: Andrea Gavana <andrea.gavana@gmail.com>
7
+ #
8
+ # Created:
9
+ # Version:
10
+ # Date:
11
+ # Licence: wxWindows license
12
+ # Tags: phoenix-port, unittest, documented, py3-port
13
+ #----------------------------------------------------------------------------
14
+ """
15
+ `art_aui` is responsible for drawing all the components of the ribbon
16
+ interface using an AUI-compatible appearance.
17
+
18
+
19
+ Description
20
+ ===========
21
+
22
+ This allows a ribbon bar to have a pluggable look-and-feel, while retaining the same
23
+ underlying behaviour. As a single art provider is used for all ribbon components, a
24
+ ribbon bar usually has a consistent (though unique) appearance.
25
+
26
+ By default, a :class:`~wx.lib.agw.ribbon.bar.RibbonBar` uses an instance of a class called
27
+ :class:`~wx.lib.agw.ribbon.art_default.RibbonDefaultArtProvider`,
28
+ which resolves to :class:`~wx.lib.agw.ribbon.art_aui.RibbonAUIArtProvider`,
29
+ :class:`~wx.lib.agw.ribbon.art_msw.RibbonMSWArtProvider`, or
30
+ :class:`~wx.lib.agw.ribbon.art_osx.RibbonOSXArtProvider` - whichever is most appropriate
31
+ to the current platform. These art providers are all
32
+ slightly configurable with regard to colours and fonts, but for larger modifications,
33
+ you can derive from one of these classes, or write a completely new art provider class.
34
+
35
+ Call :meth:`RibbonBar.SetArtProvider() <lib.agw.ribbon.bar.RibbonBar.SetArtProvider>` to change the art provider being used.
36
+
37
+
38
+ See Also
39
+ ========
40
+
41
+ :class:`~wx.lib.agw.ribbon.bar.RibbonBar`
42
+ """
43
+
44
+ import wx
45
+
46
+ from math import cos
47
+ from math import pi as M_PI
48
+
49
+ from .art_msw import RibbonMSWArtProvider
50
+ from .art_internal import RibbonHSLColour, RibbonShiftLuminance, RibbonInterpolateColour
51
+
52
+ from . import bar as BAR, panel as PANEL
53
+
54
+ from .art import *
55
+
56
+ if wx.Platform == "__WXMAC__":
57
+ try:
58
+ import Carbon.Appearance
59
+ except ImportError:
60
+ CARBON = False
61
+ else:
62
+ CARBON = True
63
+
64
+
65
+ def FontFromFont(original):
66
+
67
+ newFont = wx.Font(original.GetPointSize(), original.GetFamily(),
68
+ original.GetStyle(), original.GetWeight(), original.GetUnderlined(),
69
+ original.GetFaceName(), original.GetEncoding())
70
+
71
+ return newFont
72
+
73
+
74
+ class RibbonAUIArtProvider(RibbonMSWArtProvider):
75
+
76
+ def __init__(self):
77
+
78
+ RibbonMSWArtProvider.__init__(self)
79
+
80
+ if wx.Platform == "__WXMAC__":
81
+ k = Carbon.Appearance.kThemeBrushToolbarBackground if CARBON else 52
82
+ if hasattr(wx, 'MacThemeColour'):
83
+ base_colour = wx.MacThemeColour(k)
84
+ else:
85
+ brush = wx.Brush(wx.BLACK)
86
+ brush.MacSetTheme(k)
87
+ base_colour = brush.GetColour()
88
+ else:
89
+
90
+ base_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE)
91
+
92
+ self.SetColourScheme(base_colour, wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT),
93
+ wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT))
94
+
95
+ self._tab_active_label_font = FontFromFont(self._tab_label_font)
96
+ self._tab_active_label_font.SetWeight(wx.FONTWEIGHT_BOLD)
97
+
98
+ self._page_border_left = 1
99
+ self._page_border_right = 1
100
+ self._page_border_top = 1
101
+ self._page_border_bottom = 2
102
+ self._tab_separation_size = 0
103
+
104
+ self._gallery_bitmap_padding_left_size = 3
105
+ self._gallery_bitmap_padding_right_size = 3
106
+ self._gallery_bitmap_padding_top_size = 3
107
+ self._gallery_bitmap_padding_bottom_size = 3
108
+
109
+
110
+ def Clone(self):
111
+ """
112
+ Create a new art provider which is a clone of this one.
113
+ """
114
+
115
+ copy = RibbonAUIArtProvider()
116
+ self.CloneTo(copy)
117
+
118
+ copy._tab_ctrl_background_colour = self._tab_ctrl_background_colour
119
+ copy._tab_ctrl_background_gradient_colour = self._tab_ctrl_background_gradient_colour
120
+ copy._panel_label_background_colour = self._panel_label_background_colour
121
+ copy._panel_label_background_gradient_colour = self._panel_label_background_gradient_colour
122
+ copy._panel_hover_label_background_colour = self._panel_hover_label_background_colour
123
+ copy._panel_hover_label_background_gradient_colour = self._panel_hover_label_background_gradient_colour
124
+
125
+ copy._background_brush = self._background_brush
126
+ copy._tab_active_top_background_brush = self._tab_active_top_background_brush
127
+ copy._tab_hover_background_brush = self._tab_hover_background_brush
128
+ copy._button_bar_hover_background_brush = self._button_bar_hover_background_brush
129
+ copy._button_bar_active_background_brush = self._button_bar_active_background_brush
130
+ copy._gallery_button_active_background_brush = self._gallery_button_active_background_brush
131
+ copy._gallery_button_hover_background_brush = self._gallery_button_hover_background_brush
132
+ copy._gallery_button_disabled_background_brush = self._gallery_button_disabled_background_brush
133
+
134
+ copy._toolbar_hover_borden_pen = self._toolbar_hover_borden_pen
135
+ copy._tool_hover_background_brush = self._tool_hover_background_brush
136
+ copy._tool_active_background_brush = self._tool_active_background_brush
137
+
138
+ return copy
139
+
140
+
141
+ def SetFont(self, id, font):
142
+ """
143
+ Set the value of a certain font setting to the value.
144
+
145
+ can be one of the font values of `RibbonArtSetting`.
146
+
147
+ :param `id`: the font id;
148
+ :param `font`: MISSING DESCRIPTION.
149
+
150
+ """
151
+
152
+ RibbonMSWArtProvider.SetFont(self, id, font)
153
+
154
+ if id == RIBBON_ART_TAB_LABEL_FONT:
155
+ self._tab_active_label_font = FontFromFont(self._tab_label_font)
156
+ self._tab_active_label_font.SetWeight(wx.FONTWEIGHT_BOLD)
157
+
158
+
159
+ def GetColour(self, id):
160
+ """
161
+ Get the value of a certain colour setting.
162
+
163
+ can be one of the colour values of `RibbonArtSetting`.
164
+
165
+ :param `id`: the colour id.
166
+
167
+ """
168
+
169
+ if id in [RIBBON_ART_PAGE_BACKGROUND_COLOUR, RIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR]:
170
+ return self._background_brush.GetColour()
171
+ elif id == RIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR:
172
+ return self._tab_ctrl_background_colour
173
+ elif id == RIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR:
174
+ return self._tab_ctrl_background_gradient_colour
175
+ elif id in [RIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR, RIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR]:
176
+ return self._tab_active_top_background_brush.GetColour()
177
+ elif id in [RIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR, RIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR]:
178
+ return self._tab_hover_background_brush.GetColour()
179
+ elif id == RIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR:
180
+ return self._panel_label_background_colour
181
+ elif id == RIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR:
182
+ return self._panel_label_background_gradient_colour
183
+ elif id == RIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR:
184
+ return self._panel_hover_label_background_colour
185
+ elif id == RIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR:
186
+ return self._panel_hover_label_background_gradient_colour
187
+ elif id in [RIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR, RIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR]:
188
+ return self._button_bar_hover_background_brush.GetColour()
189
+ elif id in [RIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR, RIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR]:
190
+ return self._gallery_button_hover_background_brush.GetColour()
191
+ elif id in [RIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR, RIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR]:
192
+ return self._gallery_button_active_background_brush.GetColour()
193
+ elif id in [RIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR, RIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR]:
194
+ return self._gallery_button_disabled_background_brush.GetColour()
195
+ else:
196
+ return RibbonMSWArtProvider.GetColour(self, id)
197
+
198
+
199
+ def SetColour(self, id, colour):
200
+ """
201
+ Set the value of a certain colour setting to the value.
202
+
203
+ can be one of the colour values of `RibbonArtSetting`, though not all colour
204
+ settings will have an affect on every art provider.
205
+
206
+ :param `id`: the colour id;
207
+ :param `colour`: MISSING DESCRIPTION.
208
+
209
+ :see: :meth:`~RibbonAUIArtProvider.SetColourScheme`
210
+ """
211
+
212
+ if id in [RIBBON_ART_PAGE_BACKGROUND_COLOUR, RIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR]:
213
+ self._background_brush.SetColour(colour)
214
+ elif id == RIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR:
215
+ self._tab_ctrl_background_colour = colour
216
+ elif id == RIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR:
217
+ self._tab_ctrl_background_gradient_colour = colour
218
+ elif id in [RIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR, RIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR]:
219
+ self._tab_active_top_background_brush.SetColour(colour)
220
+ elif id in [RIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR, RIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR]:
221
+ self._tab_hover_background_brush.SetColour(colour)
222
+ elif id == RIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR:
223
+ self._panel_label_background_colour = colour
224
+ elif id == RIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR:
225
+ self._panel_label_background_gradient_colour = colour
226
+ elif id in [RIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR, RIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR]:
227
+ self._button_bar_hover_background_brush.SetColour(colour)
228
+ elif id in [RIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR, RIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR]:
229
+ self._gallery_button_hover_background_brush.SetColour(colour)
230
+ elif id in [RIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR, RIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR]:
231
+ self._gallery_button_active_background_brush.SetColour(colour)
232
+ elif id in [RIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR, RIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR]:
233
+ self._gallery_button_disabled_background_brush.SetColour(colour)
234
+ else:
235
+ RibbonMSWArtProvider.SetColour(self, id, colour)
236
+
237
+
238
+ def SetColourScheme(self, primary, secondary, tertiary):
239
+ """
240
+ Set all applicable colour settings from a few base colours.
241
+
242
+ Uses any or all of the three given colours to create a colour scheme, and then
243
+ sets all colour settings which are relevant to the art provider using that
244
+ scheme. Note that some art providers may not use the tertiary colour for
245
+ anything, and some may not use the secondary colour either.
246
+
247
+ :param `primary`: MISSING DESCRIPTION;
248
+ :param `secondary`: MISSING DESCRIPTION;
249
+ :param `tertiary`: MISSING DESCRIPTION.
250
+
251
+ :see: :meth:`~RibbonAUIArtProvider.SetColour`, :meth:`RibbonMSWArtProvider.GetColourScheme() <lib.agw.ribbon.art_msw.RibbonMSWArtProvider.GetColourScheme>`
252
+ """
253
+
254
+ primary_hsl = RibbonHSLColour(primary)
255
+ secondary_hsl = RibbonHSLColour(secondary)
256
+ tertiary_hsl = RibbonHSLColour(tertiary)
257
+
258
+ # Map primary & secondary luminance from [0, 1] to [0.15, 0.85]
259
+ primary_hsl.luminance = cos(primary_hsl.luminance * M_PI) * -0.35 + 0.5
260
+ secondary_hsl.luminance = cos(secondary_hsl.luminance * M_PI) * -0.35 + 0.5
261
+
262
+ # TODO: Remove next line once this provider stops piggybacking MSW
263
+ RibbonMSWArtProvider.SetColourScheme(self, primary, secondary, tertiary)
264
+
265
+ self._tab_ctrl_background_colour = RibbonShiftLuminance(primary_hsl, 0.9).ToRGB()
266
+ self._tab_ctrl_background_gradient_colour = RibbonShiftLuminance(primary_hsl, 1.7).ToRGB()
267
+ self._tab_border_pen = wx.Pen(RibbonShiftLuminance(primary_hsl, 0.75).ToRGB())
268
+ self._tab_label_colour = RibbonShiftLuminance(primary_hsl, 0.1).ToRGB()
269
+ self._tab_hover_background_top_colour = primary_hsl.ToRGB()
270
+ self._tab_hover_background_top_gradient_colour = RibbonShiftLuminance(primary_hsl, 1.6).ToRGB()
271
+ self._tab_hover_background_brush = wx.Brush(self._tab_hover_background_top_colour)
272
+ self._tab_active_background_colour = self._tab_ctrl_background_gradient_colour
273
+ self._tab_active_background_gradient_colour = primary_hsl.ToRGB()
274
+ self._tab_active_top_background_brush = wx.Brush(self._tab_active_background_colour)
275
+ self._panel_label_colour = self._tab_label_colour
276
+ self._panel_minimised_label_colour = self._panel_label_colour
277
+ self._panel_hover_label_colour = tertiary_hsl.ToRGB()
278
+ self._page_border_pen = self._tab_border_pen
279
+ self._panel_border_pen = self._tab_border_pen
280
+ self._background_brush = wx.Brush(primary_hsl.ToRGB())
281
+ self._page_hover_background_colour = RibbonShiftLuminance(primary_hsl, 1.5).ToRGB()
282
+ self._page_hover_background_gradient_colour = RibbonShiftLuminance(primary_hsl, 0.9).ToRGB()
283
+ self._panel_label_background_colour = RibbonShiftLuminance(primary_hsl, 0.85).ToRGB()
284
+ self._panel_label_background_gradient_colour = RibbonShiftLuminance(primary_hsl, 0.97).ToRGB()
285
+ self._panel_hover_label_background_gradient_colour = secondary_hsl.ToRGB()
286
+ self._panel_hover_label_background_colour = secondary_hsl.Lighter(0.2).ToRGB()
287
+ self._button_bar_hover_border_pen = wx.Pen(secondary_hsl.ToRGB())
288
+ self._button_bar_hover_background_brush = wx.Brush(RibbonShiftLuminance(secondary_hsl, 1.7).ToRGB())
289
+ self._button_bar_active_background_brush = wx.Brush(RibbonShiftLuminance(secondary_hsl, 1.4).ToRGB())
290
+ self._button_bar_label_colour = self._tab_label_colour
291
+ self._gallery_border_pen = self._tab_border_pen
292
+ self._gallery_item_border_pen = self._button_bar_hover_border_pen
293
+ self._gallery_hover_background_brush = wx.Brush(RibbonShiftLuminance(primary_hsl, 1.2).ToRGB())
294
+ self._gallery_button_background_colour = self._page_hover_background_colour
295
+ self._gallery_button_background_gradient_colour = self._page_hover_background_gradient_colour
296
+ self._gallery_button_hover_background_brush = self._button_bar_hover_background_brush
297
+ self._gallery_button_active_background_brush = self._button_bar_active_background_brush
298
+ self._gallery_button_disabled_background_brush = wx.Brush(primary_hsl.Desaturated(0.15).ToRGB())
299
+ self.SetColour(RIBBON_ART_GALLERY_BUTTON_FACE_COLOUR, RibbonShiftLuminance(primary_hsl, 0.1).ToRGB())
300
+ self.SetColour(RIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR, wx.Colour(128, 128, 128))
301
+ self.SetColour(RIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR, RibbonShiftLuminance(secondary_hsl, 0.1).ToRGB())
302
+ self.SetColour(RIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR, RibbonShiftLuminance(secondary_hsl, 0.1).ToRGB())
303
+ self._toolbar_border_pen = self._tab_border_pen
304
+ self.SetColour(RIBBON_ART_TOOLBAR_FACE_COLOUR, RibbonShiftLuminance(primary_hsl, 0.1).ToRGB())
305
+ self._tool_background_colour = self._page_hover_background_colour
306
+ self._tool_background_gradient_colour = self._page_hover_background_gradient_colour
307
+ self._toolbar_hover_borden_pen = self._button_bar_hover_border_pen
308
+ self._tool_hover_background_brush = self._button_bar_hover_background_brush
309
+ self._tool_active_background_brush = self._button_bar_active_background_brush
310
+
311
+
312
+ def DrawTabCtrlBackground(self, dc, wnd, rect):
313
+ """
314
+ Draw the background of the tab region of a ribbon bar.
315
+
316
+ :param `dc`: The device context to draw onto;
317
+ :param `wnd`: The window which is being drawn onto;
318
+ :param `rect`: The rectangle within which to draw.
319
+
320
+ """
321
+
322
+ gradient_rect = wx.Rect(*rect)
323
+ gradient_rect.height -= 1
324
+ dc.GradientFillLinear(gradient_rect, self._tab_ctrl_background_colour, self._tab_ctrl_background_gradient_colour, wx.SOUTH)
325
+ dc.SetPen(self._tab_border_pen)
326
+ dc.DrawLine(rect.x, rect.GetBottom(), rect.GetRight()+1, rect.GetBottom())
327
+
328
+
329
+ def GetTabCtrlHeight(self, dc, wnd, pages):
330
+ """
331
+ Calculate the height (in pixels) of the tab region of a ribbon bar.
332
+
333
+ Note that as the tab region can contain scroll buttons, the height should be
334
+ greater than or equal to the minimum height for a tab scroll button.
335
+
336
+ :param `dc`: A device context to use when one is required for size calculations;
337
+ :param `wnd`: The window onto which the tabs will eventually be drawn;
338
+ :param `pages`: The tabs which will acquire the returned height.
339
+
340
+ """
341
+
342
+ text_height = 0
343
+ icon_height = 0
344
+
345
+ if len(pages) <= 1 and (self._flags & RIBBON_BAR_ALWAYS_SHOW_TABS) == 0:
346
+ # To preserve space, a single tab need not be displayed. We still need
347
+ # one pixel of border though.
348
+ return 1
349
+
350
+ if self._flags & RIBBON_BAR_SHOW_PAGE_LABELS:
351
+ dc.SetFont(self._tab_active_label_font)
352
+ text_height = dc.GetTextExtent("ABCDEFXj")[1]
353
+
354
+ if self._flags & RIBBON_BAR_SHOW_PAGE_ICONS:
355
+ for info in pages:
356
+ if info.page.GetIcon().IsOk():
357
+ icon_height = max(icon_height, info.page.GetIcon().GetHeight())
358
+
359
+ return max(text_height, icon_height) + 10
360
+
361
+
362
+ def DrawTab(self, dc, wnd, tab):
363
+ """
364
+ Draw a single tab in the tab region of a ribbon bar.
365
+
366
+ :param `dc`: The device context to draw onto;
367
+ :param `wnd`: The window which is being drawn onto (not the :class:`~wx.lib.agw.ribbon.page.RibbonPage`
368
+ associated with the tab being drawn);
369
+ :param `tab`: The rectangle within which to draw, and also the tab label,
370
+ icon, and state (active and/or hovered). The drawing rectangle will be
371
+ entirely within a rectangle on the same device context previously painted
372
+ with :meth:`~RibbonAUIArtProvider.DrawTabCtrlBackground`. The rectangle's width will be at least the
373
+ minimum value returned by :meth:`~RibbonAUIArtProvider.GetBarTabWidth`, and height will be the value
374
+ returned by :meth:`~RibbonAUIArtProvider.GetTabCtrlHeight`.
375
+
376
+ """
377
+
378
+ if tab.rect.height <= 1:
379
+ return
380
+
381
+ dc.SetFont(self._tab_label_font)
382
+ dc.SetPen(wx.TRANSPARENT_PEN)
383
+
384
+ if tab.active or tab.hovered:
385
+ if tab.active:
386
+ dc.SetFont(self._tab_active_label_font)
387
+ dc.SetBrush(self._background_brush)
388
+ dc.DrawRectangle(tab.rect.x, tab.rect.y + tab.rect.height - 1, tab.rect.width - 1, 1)
389
+
390
+ grad_rect = wx.Rect(*tab.rect)
391
+ grad_rect.height -= 4
392
+ grad_rect.width -= 1
393
+ grad_rect.height //= 2
394
+ grad_rect.y = grad_rect.y + tab.rect.height - grad_rect.height - 1
395
+ dc.SetBrush(self._tab_active_top_background_brush)
396
+ dc.DrawRectangle(tab.rect.x, tab.rect.y + 3, tab.rect.width - 1, grad_rect.y - tab.rect.y - 3)
397
+ dc.GradientFillLinear(grad_rect, self._tab_active_background_colour, self._tab_active_background_gradient_colour, wx.SOUTH)
398
+
399
+ else:
400
+
401
+ btm_rect = wx.Rect(*tab.rect)
402
+ btm_rect.height -= 4
403
+ btm_rect.width -= 1
404
+ btm_rect.height //= 2
405
+ btm_rect.y = btm_rect.y + tab.rect.height - btm_rect.height - 1
406
+ dc.SetBrush(self._tab_hover_background_brush)
407
+ dc.DrawRectangle(btm_rect.x, btm_rect.y, btm_rect.width, btm_rect.height)
408
+ grad_rect = wx.Rect(*tab.rect)
409
+ grad_rect.width -= 1
410
+ grad_rect.y += 3
411
+ grad_rect.height = btm_rect.y - grad_rect.y
412
+ dc.GradientFillLinear(grad_rect, self._tab_hover_background_top_colour, self._tab_hover_background_top_gradient_colour, wx.SOUTH)
413
+
414
+ border_points = [wx.Point() for i in range(5)]
415
+ border_points[0] = wx.Point(0, 3)
416
+ border_points[1] = wx.Point(1, 2)
417
+ border_points[2] = wx.Point(tab.rect.width - 3, 2)
418
+ border_points[3] = wx.Point(tab.rect.width - 1, 4)
419
+ border_points[4] = wx.Point(tab.rect.width - 1, tab.rect.height - 1)
420
+
421
+ dc.SetPen(self._tab_border_pen)
422
+ dc.DrawLines(border_points, tab.rect.x, tab.rect.y)
423
+
424
+ old_clip = dc.GetClippingRect()
425
+ is_first_tab = False
426
+
427
+ bar = tab.page.GetParent()
428
+ icon = wx.NullBitmap
429
+
430
+ if isinstance(bar, BAR.RibbonBar) and bar.GetPage(0) == tab.page:
431
+ is_first_tab = True
432
+
433
+ if self._flags & RIBBON_BAR_SHOW_PAGE_ICONS:
434
+ icon = tab.page.GetIcon()
435
+ if self._flags & RIBBON_BAR_SHOW_PAGE_LABELS == 0:
436
+ if icon.IsOk():
437
+ x = tab.rect.x + (tab.rect.width - icon.GetWidth()) // 2
438
+ dc.DrawBitmap(icon, x, tab.rect.y + 1 + (tab.rect.height - 1 - icon.GetHeight()) // 2, True)
439
+
440
+ if self._flags & RIBBON_BAR_SHOW_PAGE_LABELS:
441
+ label = tab.page.GetLabel()
442
+
443
+ if label.strip():
444
+ dc.SetTextForeground(self._tab_label_colour)
445
+ dc.SetBackgroundMode(wx.TRANSPARENT)
446
+
447
+ offset = 0
448
+
449
+ if icon.IsOk():
450
+ offset += icon.GetWidth() + 2
451
+
452
+ text_width, text_height = dc.GetTextExtent(label)
453
+ x = (tab.rect.width - 2 - text_width - offset) // 2
454
+ if x > 8:
455
+ x = 8
456
+ elif x < 1:
457
+ x = 1
458
+
459
+ width = tab.rect.width - x - 2
460
+ x += tab.rect.x + offset
461
+ y = tab.rect.y + (tab.rect.height - text_height) // 2
462
+
463
+ if icon.IsOk():
464
+ dc.DrawBitmap(icon, x - offset, tab.rect.y + (tab.rect.height - icon.GetHeight()) / 2, True)
465
+
466
+ dc.SetClippingRegion(x, tab.rect.y, width, tab.rect.height)
467
+ dc.DrawText(label, x, y)
468
+
469
+ # Draw the left hand edge of the tab only for the first tab (subsequent
470
+ # tabs use the right edge of the prior tab as their left edge). As this is
471
+ # outside the rectangle for the tab, only draw it if the leftmost part of
472
+ # the tab is within the clip rectangle (the clip region has to be cleared
473
+ # to draw outside the tab).
474
+ if is_first_tab and old_clip.x <= tab.rect.x and tab.rect.x < old_clip.x + old_clip.width:
475
+ dc.DestroyClippingRegion()
476
+ dc.DrawLine(tab.rect.x - 1, tab.rect.y + 4, tab.rect.x - 1, tab.rect.y + tab.rect.height - 1)
477
+
478
+
479
+ def GetBarTabWidth(self, dc, wnd, label, bitmap, ideal=None, small_begin_need_separator=None,
480
+ small_must_have_separator=None, minimum=None):
481
+ """
482
+ Calculate the ideal and minimum width (in pixels) of a tab in a ribbon bar.
483
+
484
+ :param `dc`: A device context to use when one is required for size calculations;
485
+ :param `wnd`: The window onto which the tab will eventually be drawn;
486
+ :param `label`: The tab's label (or an empty string if it has none);
487
+ :param `bitmap`: The tab's icon (or :class:`NullBitmap` if it has none);
488
+ :param `ideal`: The ideal width (in pixels) of the tab;
489
+ :param `small_begin_need_separator`: A size less than the size, at which a tab
490
+ separator should begin to be drawn (i.e. drawn, but still fairly transparent);
491
+ :param `small_must_have_separator`: A size less than the size, at which a tab
492
+ separator must be drawn (i.e. drawn at full opacity);
493
+ :param `minimum`: A size less than the size, and greater than or equal to zero,
494
+ which is the minimum pixel width for the tab.
495
+
496
+ """
497
+
498
+ width = mini = 0
499
+
500
+ if self._flags & RIBBON_BAR_SHOW_PAGE_LABELS and label.strip():
501
+ dc.SetFont(self._tab_active_label_font)
502
+ width += dc.GetTextExtent(label)[0]
503
+ mini += min(30, width) # enough for a few chars
504
+
505
+ if bitmap.IsOk():
506
+ # gap between label and bitmap
507
+ width += 4
508
+ mini += 2
509
+
510
+ if self._flags & RIBBON_BAR_SHOW_PAGE_ICONS and bitmap.IsOk():
511
+ width += bitmap.GetWidth()
512
+ mini += bitmap.GetWidth()
513
+
514
+ ideal = width + 16
515
+ small_begin_need_separator = mini
516
+ small_must_have_separator = mini
517
+ minimum = mini
518
+
519
+ return ideal, small_begin_need_separator, small_must_have_separator, minimum
520
+
521
+
522
+ def DrawTabSeparator(self, dc, wnd, rect, visibility):
523
+ """
524
+ Draw a separator between two tabs in a ribbon bar.
525
+
526
+ :param `dc`: The device context to draw onto;
527
+ :param `wnd`: The window which is being drawn onto;
528
+ :param `rect`: The rectangle within which to draw, which will be entirely
529
+ within a rectangle on the same device context previously painted with
530
+ :meth:`~RibbonAUIArtProvider.DrawTabCtrlBackground`;
531
+ :param `visibility`: The opacity with which to draw the separator. Values
532
+ are in the range [0, 1], with 0 being totally transparent, and 1 being totally
533
+ opaque.
534
+
535
+ """
536
+
537
+ # No explicit separators between tabs
538
+ pass
539
+
540
+
541
+ def DrawPageBackground(self, dc, wnd, rect):
542
+ """
543
+ Draw the background of a ribbon page.
544
+
545
+ :param `dc`: The device context to draw onto;
546
+ :param `wnd`: The window which is being drawn onto (which is commonly the
547
+ :class:`~wx.lib.agw.ribbon.page.RibbonPage` whose background is being drawn, but doesn't have to be);
548
+ :param `rect`: The rectangle within which to draw.
549
+
550
+ :see: :meth:`RibbonMSWArtProvider.GetPageBackgroundRedrawArea() <lib.agw.ribbon.art_msw.RibbonMSWArtProvider.GetPageBackgroundRedrawArea>`
551
+ """
552
+
553
+ dc.SetPen(wx.TRANSPARENT_PEN)
554
+ dc.SetBrush(self._background_brush)
555
+ dc.DrawRectangle(rect.x + 1, rect.y, rect.width - 2, rect.height - 1)
556
+
557
+ dc.SetPen(self._page_border_pen)
558
+ dc.DrawLine(rect.x, rect.y, rect.x, rect.y + rect.height)
559
+ dc.DrawLine(rect.GetRight(), rect.y, rect.GetRight(), rect.y +rect.height)
560
+ dc.DrawLine(rect.x, rect.GetBottom(), rect.GetRight()+1, rect.GetBottom())
561
+
562
+
563
+ def GetScrollButtonMinimumSize(self, dc, wnd, style):
564
+ """
565
+ Calculate the minimum size (in pixels) of a scroll button.
566
+
567
+ :param `dc`: A device context to use when one is required for size calculations;
568
+ :param `wnd`: The window onto which the scroll button will eventually be drawn;
569
+ :param `style`: A combination of flags from `RibbonScrollButtonStyle`, including
570
+ a direction, and a for flag (state flags may be given too, but should be ignored,
571
+ as a button should retain a constant size, regardless of its state).
572
+
573
+ """
574
+
575
+ return wx.Size(11, 11)
576
+
577
+
578
+ def DrawScrollButton(self, dc, wnd, rect, style):
579
+ """
580
+ Draw a ribbon-style scroll button.
581
+
582
+ :param `dc`: The device context to draw onto;
583
+ :param `wnd`: The window which is being drawn onto;
584
+ :param `rect`: The rectangle within which to draw. The size of this rectangle
585
+ will be at least the size returned by :meth:`~RibbonAUIArtProvider.GetScrollButtonMinimumSize` for a
586
+ scroll button with the same style. For tab scroll buttons, this rectangle
587
+ will be entirely within a rectangle on the same device context previously
588
+ painted with :meth:`~RibbonAUIArtProvider.DrawTabCtrlBackground`, but this is not guaranteed for other
589
+ types of button (for example, page scroll buttons will not be painted on
590
+ an area previously painted with :meth:`~RibbonAUIArtProvider.DrawPageBackground`);
591
+ :param `style`: A combination of flags from `RibbonScrollButtonStyle`,
592
+ including a direction, a for flag, and one or more states.
593
+
594
+ """
595
+
596
+ true_rect = wx.Rect(*rect)
597
+ arrow_points = [wx.Point() for i in range(3)]
598
+
599
+ if style & RIBBON_SCROLL_BTN_FOR_MASK == RIBBON_SCROLL_BTN_FOR_TABS:
600
+ true_rect.y += 2
601
+ true_rect.height -= 2
602
+ dc.SetPen(self._tab_border_pen)
603
+ else:
604
+ dc.SetPen(wx.TRANSPARENT_PEN)
605
+ dc.SetBrush(self._background_brush)
606
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
607
+ dc.SetPen(self._page_border_pen)
608
+
609
+ result = style & RIBBON_SCROLL_BTN_DIRECTION_MASK
610
+
611
+ if result == RIBBON_SCROLL_BTN_LEFT:
612
+ dc.DrawLine(true_rect.GetRight(), true_rect.y, true_rect.GetRight(), true_rect.y + true_rect.height)
613
+ arrow_points[0] = wx.Point(int(rect.width / 2 - 2), int(rect.height / 2))
614
+ arrow_points[1] = arrow_points[0] + wx.Point(5, -5)
615
+ arrow_points[2] = arrow_points[0] + wx.Point(5, 5)
616
+
617
+ elif result == RIBBON_SCROLL_BTN_RIGHT:
618
+ dc.DrawLine(true_rect.x, true_rect.y, true_rect.x, true_rect.y + true_rect.height)
619
+ arrow_points[0] = wx.Point(int(rect.width / 2 + 3), int(rect.height / 2))
620
+ arrow_points[1] = arrow_points[0] - wx.Point(5, -5)
621
+ arrow_points[2] = arrow_points[0] - wx.Point(5, 5)
622
+
623
+ elif result == RIBBON_SCROLL_BTN_DOWN:
624
+ dc.DrawLine(true_rect.x, true_rect.y, true_rect.x + true_rect.width, true_rect.y)
625
+ arrow_points[0] = wx.Point(int(rect.width / 2), int(rect.height / 2 + 3))
626
+ arrow_points[1] = arrow_points[0] - wx.Point( 5, 5)
627
+ arrow_points[2] = arrow_points[0] - wx.Point(-5, 5)
628
+
629
+ elif result == RIBBON_SCROLL_BTN_UP:
630
+ dc.DrawLine(true_rect.x, true_rect.GetBottom(), true_rect.x + true_rect.width, true_rect.GetBottom())
631
+ arrow_points[0] = wx.Point(int(rect.width / 2), int(rect.height / 2 - 2))
632
+ arrow_points[1] = arrow_points[0] + wx.Point( 5, 5)
633
+ arrow_points[2] = arrow_points[0] + wx.Point(-5, 5)
634
+
635
+ else:
636
+ return
637
+
638
+ x = rect.x
639
+ y = rect.y
640
+
641
+ if style & RIBBON_SCROLL_BTN_ACTIVE:
642
+ x += 1
643
+ y += 1
644
+
645
+ dc.SetPen(wx.TRANSPARENT_PEN)
646
+ B = wx.Brush(self._tab_label_colour)
647
+ dc.SetBrush(B)
648
+ dc.DrawPolygon(arrow_points, x, y)
649
+
650
+
651
+ def GetPanelSize(self, dc, wnd, client_size, client_offset=None):
652
+ """
653
+ Calculate the size of a panel for a given client size.
654
+
655
+ This should increment the given size by enough to fit the panel label and other
656
+ chrome.
657
+
658
+ :param `dc`: A device context to use if one is required for size calculations;
659
+ :param `wnd`: The ribbon panel in question;
660
+ :param `client_size`: The client size;
661
+ :param `client_offset`: The offset where the client rectangle begins within
662
+ the panel (may be ``None``).
663
+
664
+ :see: :meth:`~RibbonAUIArtProvider.GetPanelClientSize`
665
+ """
666
+
667
+ dc.SetFont(self._panel_label_font)
668
+ label_size = wx.Size(*dc.GetTextExtent(wnd.GetLabel()))
669
+ label_height = label_size.GetHeight() + 5
670
+
671
+ if self._flags & RIBBON_BAR_FLOW_VERTICAL:
672
+ client_size.IncBy(4, label_height + 6)
673
+ if client_offset is not None:
674
+ client_offset = wx.Point(2, label_height + 3)
675
+
676
+ else:
677
+ client_size.IncBy(6, label_height + 4)
678
+ if client_offset is not None:
679
+ client_offset = wx.Point(3, label_height + 2)
680
+
681
+ return client_size
682
+
683
+
684
+ def GetPanelClientSize(self, dc, wnd, size, client_offset=None):
685
+ """
686
+ Calculate the client size of a panel for a given overall size.
687
+
688
+ This should act as the inverse to :meth:`~RibbonAUIArtProvider.GetPanelSize`, and decrement the given size
689
+ by enough to fit the panel label and other chrome.
690
+
691
+ :param `dc`: A device context to use if one is required for size calculations;
692
+ :param `wnd`: The ribbon panel in question;
693
+ :param `size`: The overall size to calculate client size for;
694
+ :param `client_offset`: The offset where the returned client size begins within
695
+ the given (may be ``None``).
696
+
697
+ :see: :meth:`~RibbonAUIArtProvider.GetPanelSize`
698
+ """
699
+
700
+ dc.SetFont(self._panel_label_font)
701
+ label_size = wx.Size(*dc.GetTextExtent(wnd.GetLabel()))
702
+ label_height = label_size.GetHeight() + 5
703
+
704
+ if self._flags & RIBBON_BAR_FLOW_VERTICAL:
705
+ size.DecBy(4, label_height + 6)
706
+ if client_offset is not None:
707
+ client_offset = wx.Point(2, label_height + 3)
708
+
709
+ else:
710
+ size.DecBy(6, label_height + 4)
711
+ if client_offset is not None:
712
+ client_offset = wx.Point(3, label_height + 2)
713
+
714
+ if size.x < 0:
715
+ size.x = 0
716
+ if size.y < 0:
717
+ size.y = 0
718
+
719
+ return size, client_offset
720
+
721
+
722
+ def GetPanelExtButtonArea(self, dc, wnd, rect):
723
+ """
724
+ Retrieve the extension button area rectangle.
725
+
726
+ :param `dc`: The device context used to measure text extents;
727
+ :param `wnd`: The panel where the extension button resides;
728
+ :param `rect`: The panel client rectangle.
729
+ """
730
+
731
+ true_rect = wx.Rect(rect)
732
+ true_rect = self.RemovePanelPadding(true_rect)
733
+
734
+ true_rect.x += 1
735
+ true_rect.width -= 2
736
+ true_rect.y += 1
737
+
738
+ dc.SetFont(self._panel_label_font)
739
+ label_size = dc.GetTextExtent(wnd.GetLabel())
740
+ label_height = label_size[1] + 5
741
+ label_rect = wx.Rect(*true_rect)
742
+ label_rect.height = label_height - 1
743
+
744
+ rect = wx.Rect(label_rect.GetRight()-13, label_rect.GetBottom()-13, 13, 13)
745
+ return rect
746
+
747
+
748
+ def DrawPanelBackground(self, dc, wnd, rect):
749
+ """
750
+ Draw the background and chrome for a ribbon panel.
751
+
752
+ This should draw the border, background, label, and any other items of a panel
753
+ which are outside the client area of a panel. Note that when a panel is
754
+ minimised, this function is not called - only :meth:`~RibbonAUIArtProvider.DrawMinimisedPanel` is called,
755
+ so a background should be explicitly painted by that if required.
756
+
757
+ :param `dc`: The device context to draw onto;
758
+ :param `wnd`: The window which is being drawn onto, which is always the panel
759
+ whose background and chrome is being drawn. The panel label and other panel
760
+ attributes can be obtained by querying this;
761
+ :param `rect`: The rectangle within which to draw.
762
+
763
+ """
764
+
765
+ dc.SetPen(wx.TRANSPARENT_PEN)
766
+ dc.SetBrush(self._background_brush)
767
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
768
+
769
+ true_rect = wx.Rect(*rect)
770
+ true_rect = self.RemovePanelPadding(true_rect)
771
+
772
+ dc.SetPen(self._panel_border_pen)
773
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
774
+ dc.DrawRectangle(true_rect.x, true_rect.y, true_rect.width, true_rect.height)
775
+
776
+ true_rect.x += 1
777
+ true_rect.width -= 2
778
+ true_rect.y += 1
779
+
780
+ dc.SetFont(self._panel_label_font)
781
+ label_size = wx.Size(*dc.GetTextExtent(wnd.GetLabel()))
782
+ label_height = label_size.GetHeight() + 5
783
+ label_rect = wx.Rect(*true_rect)
784
+ label_rect.height = label_height - 1
785
+
786
+ dc.DrawLine(label_rect.x, label_rect.y + label_rect.height, label_rect.x + label_rect.width, label_rect.y + label_rect.height)
787
+
788
+ label_bg_colour = self._panel_label_background_colour
789
+ label_bg_grad_colour = self._panel_label_background_gradient_colour
790
+
791
+ if wnd.IsHovered():
792
+ label_bg_colour = self._panel_hover_label_background_colour
793
+ label_bg_grad_colour = self._panel_hover_label_background_gradient_colour
794
+ dc.SetTextForeground(self._panel_hover_label_colour)
795
+ else:
796
+ dc.SetTextForeground(self._panel_label_colour)
797
+
798
+ if wx.Platform == "__WXMAC__":
799
+ dc.GradientFillLinear(label_rect, label_bg_grad_colour, label_bg_colour, wx.SOUTH)
800
+ else:
801
+ dc.GradientFillLinear(label_rect, label_bg_colour, label_bg_grad_colour, wx.SOUTH)
802
+
803
+ dc.SetFont(self._panel_label_font)
804
+ dc.DrawText(wnd.GetLabel(), label_rect.x + 3, label_rect.y + 2)
805
+
806
+ if wnd.IsHovered():
807
+
808
+ gradient_rect = wx.Rect(*true_rect)
809
+ gradient_rect.y += label_rect.height + 1
810
+ gradient_rect.height = true_rect.height - label_rect.height - 3
811
+ if wx.Platform == "__WXMAC__":
812
+ colour = self._page_hover_background_gradient_colour
813
+ gradient = self._page_hover_background_colour
814
+ else:
815
+ colour = self._page_hover_background_colour
816
+ gradient = self._page_hover_background_gradient_colour
817
+
818
+ dc.GradientFillLinear(gradient_rect, colour, gradient, wx.SOUTH)
819
+
820
+ if wnd.HasExtButton():
821
+ if wnd.IsExtButtonHovered():
822
+ dc.SetPen(self._panel_hover_button_border_pen)
823
+ dc.SetBrush(self._panel_hover_button_background_brush)
824
+ dc.DrawRoundedRectangle(label_rect.GetRight() - 13, label_rect.GetBottom() - 13, 13, 13, 1)
825
+ dc.DrawBitmap(self._panel_extension_bitmap[1], label_rect.GetRight() - 10, label_rect.GetBottom() - 10, True)
826
+
827
+ else:
828
+ dc.DrawBitmap(self._panel_extension_bitmap[0], label_rect.GetRight() - 10, label_rect.GetBottom() - 10, True)
829
+
830
+
831
+ def DrawMinimisedPanel(self, dc, wnd, rect, bitmap):
832
+ """
833
+ Draw a minimised ribbon panel.
834
+
835
+ :param `dc`: The device context to draw onto;
836
+ :param `wnd`: The window which is being drawn onto, which is always the panel
837
+ which is minimised. The panel label can be obtained from this window. The
838
+ minimised icon obtained from querying the window may not be the size requested
839
+ by :meth:`RibbonMSWArtProvider.GetMinimisedPanelMinimumSize() <lib.agw.ribbon.art_msw.RibbonMSWArtProvider.GetMinimisedPanelMinimumSize>` - the argument contains the icon in the
840
+ requested size;
841
+ :param `rect`: The rectangle within which to draw. The size of the rectangle
842
+ will be at least the size returned by :meth:`RibbonMSWArtProvider.GetMinimisedPanelMinimumSize() <lib.agw.ribbon.art_msw.RibbonMSWArtProvider.GetMinimisedPanelMinimumSize>`;
843
+ :param `bitmap`: A copy of the panel's minimised bitmap rescaled to the size
844
+ returned by :meth:`RibbonMSWArtProvider.GetMinimisedPanelMinimumSize() <lib.agw.ribbon.art_msw.RibbonMSWArtProvider.GetMinimisedPanelMinimumSize>`.
845
+
846
+ """
847
+
848
+ dc.SetPen(wx.TRANSPARENT_PEN)
849
+ dc.SetBrush(self._background_brush)
850
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
851
+
852
+ true_rect = wx.Rect(*rect)
853
+ true_rect = self.RemovePanelPadding(true_rect)
854
+
855
+ dc.SetPen(self._panel_border_pen)
856
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
857
+ dc.DrawRectangle(true_rect.x, true_rect.y, true_rect.width, true_rect.height)
858
+ true_rect.Deflate(1, 1)
859
+
860
+ if wnd.IsHovered() or wnd.GetExpandedPanel():
861
+ colour = self._page_hover_background_colour
862
+ gradient = self._page_hover_background_gradient_colour
863
+ if (wx.Platform == "__WXMAC__" and not wnd.GetExpandedPanel()) or \
864
+ (wx.Platform != "__WXMAC__" and wnd.GetExpandedPanel()):
865
+ temp = colour
866
+ colour = gradient
867
+ gradient = temp
868
+
869
+ dc.GradientFillLinear(true_rect, colour, gradient, wx.SOUTH)
870
+
871
+ preview = self.DrawMinimisedPanelCommon(dc, wnd, true_rect)
872
+
873
+ dc.SetPen(self._panel_border_pen)
874
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
875
+ dc.DrawRectangle(preview.x, preview.y, preview.width, preview.height)
876
+ preview.Deflate(1, 1)
877
+
878
+ preview_caption_rect = wx.Rect(*preview)
879
+ preview_caption_rect.height = 7
880
+ preview.y += preview_caption_rect.height
881
+ preview.height -= preview_caption_rect.height
882
+
883
+ if wx.Platform == "__WXMAC__":
884
+ dc.GradientFillLinear(preview_caption_rect, self._panel_hover_label_background_gradient_colour,
885
+ self._panel_hover_label_background_colour, wx.SOUTH)
886
+ dc.GradientFillLinear(preview, self._page_hover_background_gradient_colour,
887
+ self._page_hover_background_colour, wx.SOUTH)
888
+ else:
889
+ dc.GradientFillLinear(preview_caption_rect, self._panel_hover_label_background_colour,
890
+ self._panel_hover_label_background_gradient_colour, wx.SOUTH)
891
+ dc.GradientFillLinear(preview, self._page_hover_background_colour,
892
+ self._page_hover_background_gradient_colour, wx.SOUTH)
893
+
894
+ if bitmap.IsOk():
895
+ dc.DrawBitmap(bitmap, preview.x + (preview.width - bitmap.GetWidth()) // 2,
896
+ preview.y + (preview.height - bitmap.GetHeight()) // 2, True)
897
+
898
+
899
+ def DrawPartialPanelBackground(self, dc, wnd, rect):
900
+
901
+ dc.SetPen(wx.TRANSPARENT_PEN)
902
+ dc.SetBrush(self._background_brush)
903
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
904
+
905
+ offset = wx.Point(*wnd.GetPosition())
906
+ parent = wnd.GetParent()
907
+ panel = None
908
+
909
+ while 1:
910
+ panel = parent
911
+ if isinstance(panel, PANEL.RibbonPanel):
912
+ if not panel.IsHovered():
913
+ return
914
+ break
915
+
916
+ offset += parent.GetPosition()
917
+ parent = panel.GetParent()
918
+
919
+ if panel is None:
920
+ return
921
+
922
+ background = wx.Rect(0, 0, *panel.GetSize())
923
+ background = self.RemovePanelPadding(background)
924
+
925
+ background.x += 1
926
+ background.width -= 2
927
+ dc.SetFont(self._panel_label_font)
928
+ caption_height = dc.GetTextExtent(panel.GetLabel())[1] + 7
929
+ background.y += caption_height - 1
930
+ background.height -= caption_height
931
+
932
+ paint_rect = wx.Rect(*rect)
933
+ paint_rect.x += offset.x
934
+ paint_rect.y += offset.y
935
+
936
+ if wx.Platform == "__WXMAC__":
937
+ bg_grad_clr = self._page_hover_background_colour
938
+ bg_clr = self._page_hover_background_gradient_colour
939
+ else:
940
+ bg_clr = self._page_hover_background_colour
941
+ bg_grad_clr = self._page_hover_background_gradient_colour
942
+
943
+ paint_rect.Intersect(background)
944
+
945
+ if not paint_rect.IsEmpty():
946
+ starting_colour = RibbonInterpolateColour(bg_clr, bg_grad_clr, paint_rect.y, background.y, background.y + background.height)
947
+ ending_colour = RibbonInterpolateColour(bg_clr, bg_grad_clr, paint_rect.y + paint_rect.height, background.y, background.y + background.height)
948
+ paint_rect.x -= offset.x
949
+ paint_rect.y -= offset.y
950
+ dc.GradientFillLinear(paint_rect, starting_colour, ending_colour, wx.SOUTH)
951
+
952
+
953
+ def DrawGalleryBackground(self, dc, wnd, rect):
954
+ """
955
+ Draw the background and chrome for a :class:`~wx.lib.agw.ribbon.gallery.RibbonGallery` control.
956
+
957
+ This should draw the border, background, scroll buttons, extension button, and
958
+ any other UI elements which are not attached to a specific gallery item.
959
+
960
+ :param `dc`: The device context to draw onto;
961
+ :param `wnd`: The window which is being drawn onto, which is always the gallery
962
+ whose background and chrome is being drawn. Attributes used during drawing like
963
+ the gallery hover state and individual button states can be queried from this
964
+ parameter by :meth:`RibbonGallery.IsHovered() <lib.agw.ribbon.gallery.RibbonGallery.IsHovered>`,
965
+ :meth:`RibbonGallery.GetExtensionButtonState() <lib.agw.ribbon.gallery.RibbonGallery.GetExtensionButtonState>`,
966
+ :meth:`RibbonGallery.GetUpButtonState() <lib.agw.ribbon.gallery.RibbonGallery.GetUpButtonState>`, and
967
+ :meth:`RibbonGallery.GetDownButtonState() <lib.agw.ribbon.gallery.RibbonGallery.GetDownButtonState>`;
968
+ :param `rect`: The rectangle within which to draw. This rectangle is the entire
969
+ area of the gallery control, not just the client rectangle.
970
+
971
+ """
972
+
973
+ self.DrawPartialPanelBackground(dc, wnd, rect)
974
+
975
+ if wnd.IsHovered():
976
+ dc.SetPen(wx.TRANSPARENT_PEN)
977
+ dc.SetBrush(self._gallery_hover_background_brush)
978
+
979
+ if self._flags & RIBBON_BAR_FLOW_VERTICAL:
980
+ dc.DrawRectangle(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 16)
981
+ else:
982
+ dc.DrawRectangle(rect.x + 1, rect.y + 1, rect.width - 16, rect.height - 2)
983
+
984
+ dc.SetPen(self._gallery_border_pen)
985
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
986
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
987
+
988
+ self.DrawGalleryBackgroundCommon(dc, wnd, rect)
989
+
990
+
991
+ def DrawGalleryButton(self, dc, rect, state, bitmaps):
992
+
993
+ extra_height = 0
994
+ extra_width = 0
995
+ reduced_rect = wx.Rect(*rect)
996
+ reduced_rect.Deflate(1, 1)
997
+
998
+ if self._flags & RIBBON_BAR_FLOW_VERTICAL:
999
+ reduced_rect.width += 1
1000
+ extra_width = 1
1001
+ else:
1002
+ reduced_rect.height += 1
1003
+ extra_height = 1
1004
+
1005
+ if state == RIBBON_GALLERY_BUTTON_NORMAL:
1006
+ dc.GradientFillLinear(reduced_rect, self._gallery_button_background_colour, self._gallery_button_background_gradient_colour, wx.SOUTH)
1007
+ btn_bitmap = bitmaps[0]
1008
+
1009
+ elif state == RIBBON_GALLERY_BUTTON_HOVERED:
1010
+ dc.SetPen(self._gallery_item_border_pen)
1011
+ dc.SetBrush(self._gallery_button_hover_background_brush)
1012
+ dc.DrawRectangle(rect.x, rect.y, rect.width + extra_width, rect.height + extra_height)
1013
+ btn_bitmap = bitmaps[1]
1014
+
1015
+ elif state == RIBBON_GALLERY_BUTTON_ACTIVE:
1016
+ dc.SetPen(self._gallery_item_border_pen)
1017
+ dc.SetBrush(self._gallery_button_active_background_brush)
1018
+ dc.DrawRectangle(rect.x, rect.y, rect.width + extra_width, rect.height + extra_height)
1019
+ btn_bitmap = bitmaps[2]
1020
+
1021
+ elif state == RIBBON_GALLERY_BUTTON_DISABLED:
1022
+ dc.SetPen(wx.TRANSPARENT_PEN)
1023
+ dc.SetBrush(self._gallery_button_disabled_background_brush)
1024
+ dc.DrawRectangle(reduced_rect.x, reduced_rect.y, reduced_rect.width, reduced_rect.height)
1025
+ btn_bitmap = bitmaps[3]
1026
+
1027
+ dc.DrawBitmap(btn_bitmap, reduced_rect.x + reduced_rect.width // 2 - 2, (rect.y + rect.height // 2) - 2, True)
1028
+
1029
+
1030
+ def DrawGalleryItemBackground(self, dc, wnd, rect, item):
1031
+ """
1032
+ Draw the background of a single item in a :class:`~wx.lib.agw.ribbon.gallery.RibbonGallery` control.
1033
+
1034
+ This is painted on top of a gallery background, and behind the items bitmap.
1035
+ Unlike :meth:`~RibbonAUIArtProvider.DrawButtonBarButton` and :meth:`~RibbonAUIArtProvider.DrawTool`, it is not expected to draw the
1036
+ item bitmap - that is done by the gallery control itself.
1037
+
1038
+ :param `dc`: The device context to draw onto;
1039
+ :param `wnd`: The window which is being drawn onto, which is always the gallery
1040
+ which contains the item being drawn;
1041
+ :param `rect`: The rectangle within which to draw. The size of this rectangle
1042
+ will be the size of the item's bitmap, expanded by gallery item padding values
1043
+ (``RIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE``, ``RIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE``,
1044
+ ``RIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE``, and ``RIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE``).
1045
+ The drawing rectangle will be entirely within a rectangle on the same device
1046
+ context previously painted with :meth:`~RibbonAUIArtProvider.DrawGalleryBackground`;
1047
+ :param `item`: The item whose background is being painted. Typically the
1048
+ background will vary if the item is hovered, active, or selected;
1049
+ :meth:`RibbonGallery.GetSelection() <lib.agw.ribbon.gallery.RibbonGallery.GetSelection>`,
1050
+ :meth:`RibbonGallery.GetActiveItem() <lib.agw.ribbon.gallery.RibbonGallery.GetActiveItem>`, and
1051
+ :meth:`RibbonGallery.GetHoveredItem() <lib.agw.ribbon.gallery.RibbonGallery.GetHoveredItem>`
1052
+ can be called to test if the given item is in one of these states.
1053
+
1054
+ """
1055
+
1056
+ if wnd.GetHoveredItem() != item and wnd.GetActiveItem() != item and wnd.GetSelection() != item:
1057
+ return
1058
+
1059
+ dc.SetPen(self._gallery_item_border_pen)
1060
+
1061
+ if wnd.GetActiveItem() == item or wnd.GetSelection() == item:
1062
+ dc.SetBrush(self._gallery_button_active_background_brush)
1063
+ else:
1064
+ dc.SetBrush(self._gallery_button_hover_background_brush)
1065
+
1066
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
1067
+
1068
+
1069
+ def DrawButtonBarBackground(self, dc, wnd, rect):
1070
+ """
1071
+ Draw the background for a :class:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar` control.
1072
+
1073
+ :param `dc`: The device context to draw onto;
1074
+ :param `wnd`: The window which is being drawn onto (which will typically
1075
+ be the button bar itself, though this is not guaranteed);
1076
+ :param `rect`: The rectangle within which to draw.
1077
+
1078
+ """
1079
+
1080
+ self.DrawPartialPanelBackground(dc, wnd, rect)
1081
+
1082
+
1083
+ def DrawButtonBarButton(self, dc, wnd, rect, kind, state, label, bitmap_large, bitmap_small):
1084
+ """
1085
+ Draw a single button for a :class:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar` control.
1086
+
1087
+ :param `dc`: The device context to draw onto;
1088
+ :param `wnd`: The window which is being drawn onto;
1089
+ :param `rect`: The rectangle within which to draw. The size of this rectangle
1090
+ will be a size previously returned by :meth:`RibbonMSWArtProvider.GetButtonBarButtonSize() <lib.agw.ribbon.art_msw.RibbonMSWArtProvider.GetButtonBarButtonSize>`, and the
1091
+ rectangle will be entirely within a rectangle on the same device context
1092
+ previously painted with :meth:`~RibbonAUIArtProvider.DrawButtonBarBackground`;
1093
+ :param `kind`: The kind of button to draw (normal, dropdown or hybrid);
1094
+ :param `state`: Combination of a size flag and state flags from the
1095
+ `RibbonButtonBarButtonState` enumeration;
1096
+ :param `label`: The label of the button;
1097
+ :param `bitmap_large`: The large bitmap of the button (or the large disabled
1098
+ bitmap when ``RIBBON_BUTTONBAR_BUTTON_DISABLED`` is set in );
1099
+ :param `bitmap_small`: The small bitmap of the button (or the small disabled
1100
+ bitmap when ``RIBBON_BUTTONBAR_BUTTON_DISABLED`` is set in ).
1101
+
1102
+ """
1103
+
1104
+ if kind == RIBBON_BUTTON_TOGGLE:
1105
+ kind = RIBBON_BUTTON_NORMAL
1106
+ if state & RIBBON_BUTTONBAR_BUTTON_TOGGLED:
1107
+ state ^= RIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
1108
+
1109
+ if state & (RIBBON_BUTTONBAR_BUTTON_HOVER_MASK | RIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK):
1110
+ dc.SetPen(self._button_bar_hover_border_pen)
1111
+ bg_rect = wx.Rect(*rect)
1112
+ bg_rect.Deflate(1, 1)
1113
+
1114
+ if kind == RIBBON_BUTTON_HYBRID:
1115
+ result = state & RIBBON_BUTTONBAR_BUTTON_SIZE_MASK
1116
+
1117
+ if result == RIBBON_BUTTONBAR_BUTTON_LARGE:
1118
+ iYBorder = rect.y + bitmap_large.GetHeight() + 4
1119
+ partial_bg = wx.Rect(*rect)
1120
+
1121
+ if state & RIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED:
1122
+ partial_bg.SetBottom(iYBorder - 1)
1123
+ else:
1124
+ partial_bg.height -= (iYBorder - partial_bg.y + 1)
1125
+ partial_bg.y = iYBorder + 1
1126
+
1127
+ dc.DrawLine(rect.x, iYBorder, rect.x + rect.width, iYBorder)
1128
+ bg_rect.Intersect(partial_bg)
1129
+
1130
+ elif result == RIBBON_BUTTONBAR_BUTTON_MEDIUM:
1131
+ iArrowWidth = 9
1132
+
1133
+ if state & RIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED:
1134
+ bg_rect.width -= iArrowWidth
1135
+ dc.DrawLine(bg_rect.x + bg_rect.width, rect.y, bg_rect.x + bg_rect.width, rect.y + rect.height)
1136
+ else:
1137
+ iArrowWidth -= 1
1138
+ bg_rect.x += bg_rect.width - iArrowWidth
1139
+ bg_rect.width = iArrowWidth
1140
+ dc.DrawLine(bg_rect.x - 1, rect.y, bg_rect.x - 1, rect.y + rect.height)
1141
+
1142
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
1143
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
1144
+
1145
+ dc.SetPen(wx.TRANSPARENT_PEN)
1146
+
1147
+ if state & RIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK:
1148
+ dc.SetBrush(self._button_bar_active_background_brush)
1149
+ else:
1150
+ dc.SetBrush(self._button_bar_hover_background_brush)
1151
+
1152
+ dc.DrawRectangle(bg_rect.x, bg_rect.y, bg_rect.width, bg_rect.height)
1153
+
1154
+ dc.SetFont(self._button_bar_label_font)
1155
+ dc.SetTextForeground(self._button_bar_label_colour)
1156
+ self.DrawButtonBarButtonForeground(dc, rect, kind, state, label, bitmap_large, bitmap_small)
1157
+
1158
+
1159
+ def DrawToolBarBackground(self, dc, wnd, rect):
1160
+ """
1161
+ Draw the background for a :class:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar` control.
1162
+
1163
+ :param `dc`: The device context to draw onto;
1164
+ :param `wnd`: The which is being drawn onto. In most cases this will be
1165
+ a :class:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar`, but it doesn't have to be;
1166
+ :param `rect`: The rectangle within which to draw. Some of this rectangle
1167
+ will later be drawn over using :meth:`~RibbonAUIArtProvider.DrawToolGroupBackground` and :meth:`~RibbonAUIArtProvider.DrawTool`,
1168
+ but not all of it will (unless there is only a single group of tools).
1169
+
1170
+ """
1171
+
1172
+ self.DrawPartialPanelBackground(dc, wnd, rect)
1173
+
1174
+
1175
+ def DrawToolGroupBackground(self, dc, wnd, rect):
1176
+ """
1177
+ Draw the background for a group of tools on a :class:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar` control.
1178
+
1179
+ :param `dc`: The device context to draw onto;
1180
+ :param `wnd`: The window which is being drawn onto. In most cases this will
1181
+ be a :class:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar`, but it doesn't have to be;
1182
+ :param `rect`: The rectangle within which to draw. This rectangle is a union
1183
+ of the individual tools' rectangles. As there are no gaps between tools, this
1184
+ rectangle will be painted over exactly once by calls to :meth:`~RibbonAUIArtProvider.DrawTool`. The
1185
+ group background could therefore be painted by :meth:`~RibbonAUIArtProvider.DrawTool`, though it can be
1186
+ conceptually easier and more efficient to draw it all at once here. The
1187
+ rectangle will be entirely within a rectangle on the same device context
1188
+ previously painted with :meth:`~RibbonAUIArtProvider.DrawToolBarBackground`.
1189
+
1190
+ """
1191
+
1192
+ dc.SetPen(self._toolbar_border_pen)
1193
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
1194
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
1195
+ bg_rect = wx.Rect(*rect)
1196
+ bg_rect.Deflate(1, 1)
1197
+ dc.GradientFillLinear(bg_rect, self._tool_background_colour, self._tool_background_gradient_colour, wx.SOUTH)
1198
+
1199
+
1200
+ def DrawTool(self, dc, wnd, rect, bitmap, kind, state):
1201
+ """
1202
+ Draw a single tool (for a :class:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar` control).
1203
+
1204
+ :param `dc`: The device context to draw onto;
1205
+ :param `wnd`: The window which is being drawn onto. In most cases this will
1206
+ be a :class:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar`, but it doesn't have to be;
1207
+ :param `rect`: The rectangle within which to draw. The size of this rectangle
1208
+ will at least the size returned by :meth:`RibbonMSWArtProvider.GetToolSize() <lib.agw.ribbon.art_msw.RibbonMSWArtProvider.GetToolSize>`,
1209
+ and the height of it will
1210
+ be equal for all tools within the same group. The rectangle will be entirely
1211
+ within a rectangle on the same device context previously painted with
1212
+ :meth:`~RibbonAUIArtProvider.DrawToolGroupBackground`;
1213
+ :param `bitmap`: The bitmap to use as the tool's foreground. If the tool is a
1214
+ hybrid or dropdown tool, then the foreground should also contain a standard
1215
+ dropdown button;
1216
+ :param `kind`: The kind of tool to draw (normal, dropdown, or hybrid);
1217
+ :param `state`: A combination of `RibbonToolBarToolState` flags giving the
1218
+ state of the tool and it's relative position within a tool group.
1219
+
1220
+ """
1221
+
1222
+ if kind == RIBBON_BUTTON_TOGGLE:
1223
+ if state & RIBBON_TOOLBAR_TOOL_TOGGLED:
1224
+ state ^= RIBBON_TOOLBAR_TOOL_ACTIVE_MASK
1225
+
1226
+ bg_rect = wx.Rect(*rect)
1227
+ bg_rect.Deflate(1, 1)
1228
+
1229
+ if state & RIBBON_TOOLBAR_TOOL_LAST == 0:
1230
+ bg_rect.width += 1
1231
+
1232
+ is_custom_bg = (state & (RIBBON_TOOLBAR_TOOL_HOVER_MASK | RIBBON_TOOLBAR_TOOL_ACTIVE_MASK)) != 0
1233
+ is_split_hybrid = kind == RIBBON_BUTTON_HYBRID and is_custom_bg
1234
+
1235
+ # Background
1236
+ if is_custom_bg:
1237
+ dc.SetPen(wx.TRANSPARENT_PEN)
1238
+ dc.SetBrush(self._tool_hover_background_brush)
1239
+ dc.DrawRectangle(bg_rect.x, bg_rect.y, bg_rect.width, bg_rect.height)
1240
+
1241
+ if state & RIBBON_TOOLBAR_TOOL_ACTIVE_MASK:
1242
+ active_rect = wx.Rect(*bg_rect)
1243
+
1244
+ if kind == RIBBON_BUTTON_HYBRID:
1245
+ active_rect.width -= 8
1246
+
1247
+ if state & RIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE:
1248
+ active_rect.x += active_rect.width
1249
+ active_rect.width = 8
1250
+
1251
+ dc.SetBrush(self._tool_active_background_brush)
1252
+ dc.DrawRectangle(active_rect.x, active_rect.y, active_rect.width, active_rect.height)
1253
+
1254
+ # Border
1255
+ if is_custom_bg:
1256
+ dc.SetPen(self._toolbar_hover_borden_pen)
1257
+ else:
1258
+ dc.SetPen(self._toolbar_border_pen)
1259
+
1260
+ if state & RIBBON_TOOLBAR_TOOL_FIRST == 0:
1261
+ existing = dc.GetPixel(rect.x, rect.y + 1)
1262
+
1263
+ if existing == wx.NullColour or existing != self._toolbar_hover_borden_pen.GetColour():
1264
+ dc.DrawLine(rect.x, rect.y + 1, rect.x, rect.y + rect.height - 1)
1265
+
1266
+ if is_custom_bg:
1267
+ border_rect = wx.Rect(*bg_rect)
1268
+ border_rect.Inflate(1, 1)
1269
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
1270
+ dc.DrawRectangle(border_rect.x, border_rect.y, border_rect.width, border_rect.height)
1271
+
1272
+ # Foreground
1273
+ avail_width = bg_rect.GetWidth()
1274
+
1275
+ if kind & RIBBON_BUTTON_DROPDOWN:
1276
+ avail_width -= 8
1277
+ if is_split_hybrid:
1278
+ dc.DrawLine(rect.x + avail_width + 1, rect.y, rect.x + avail_width + 1, rect.y + rect.height)
1279
+
1280
+ dc.DrawBitmap(self._toolbar_drop_bitmap, bg_rect.x + avail_width + 2, bg_rect.y + (bg_rect.height // 2) - 2, True)
1281
+
1282
+ dc.DrawBitmap(bitmap, bg_rect.x + (avail_width - bitmap.GetWidth()) // 2, bg_rect.y + (bg_rect.height - bitmap.GetHeight()) // 2, True)
1283
+