wxPython-zombie 3.1.5.8__cp313-cp313-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.
- wx/__init__.py +22 -0
- wx/__version__.py +9 -0
- wx/_adv.cp313-win_amd64.pyd +0 -0
- wx/_aui.cp313-win_amd64.pyd +0 -0
- wx/_core.cp313-win_amd64.pyd +0 -0
- wx/_dataview.cp313-win_amd64.pyd +0 -0
- wx/_glcanvas.cp313-win_amd64.pyd +0 -0
- wx/_grid.cp313-win_amd64.pyd +0 -0
- wx/_html.cp313-win_amd64.pyd +0 -0
- wx/_html2.cp313-win_amd64.pyd +0 -0
- wx/_media.cp313-win_amd64.pyd +0 -0
- wx/_msw.cp313-win_amd64.pyd +0 -0
- wx/_propgrid.cp313-win_amd64.pyd +0 -0
- wx/_ribbon.cp313-win_amd64.pyd +0 -0
- wx/_richtext.cp313-win_amd64.pyd +0 -0
- wx/_stc.cp313-win_amd64.pyd +0 -0
- wx/_xml.cp313-win_amd64.pyd +0 -0
- wx/_xrc.cp313-win_amd64.pyd +0 -0
- wx/adv.py +124 -0
- wx/adv.pyi +5182 -0
- wx/aui.py +77 -0
- wx/aui.pyi +3655 -0
- wx/core.py +3540 -0
- wx/core.pyi +50592 -0
- wx/dataview.py +173 -0
- wx/dataview.pyi +3491 -0
- wx/demo/AUI_DockingWindowMgr.py +1154 -0
- wx/demo/AUI_MDI.py +117 -0
- wx/demo/AUI_Notebook.py +58 -0
- wx/demo/About.py +75 -0
- wx/demo/AboutBox.py +75 -0
- wx/demo/ActiveXWrapper_Acrobat.py +132 -0
- wx/demo/ActiveXWrapper_IE.py +187 -0
- wx/demo/ActiveX_FlashWindow.py +107 -0
- wx/demo/ActiveX_IEHtmlWindow.py +242 -0
- wx/demo/ActiveX_PDFWindow.py +204 -0
- wx/demo/ActivityIndicator.py +80 -0
- wx/demo/AddPrivateFont.py +116 -0
- wx/demo/AdjustChannels.py +178 -0
- wx/demo/AlphaDrawing.py +77 -0
- wx/demo/AnalogClock.py +144 -0
- wx/demo/AnimationCtrl.py +104 -0
- wx/demo/ArtProvider.py +893 -0
- wx/demo/BannerWindow.py +1 -0
- wx/demo/BitmapButton.py +87 -0
- wx/demo/BitmapComboBox.py +63 -0
- wx/demo/BitmapFromBuffer.py +140 -0
- wx/demo/Button.py +77 -0
- wx/demo/Cairo.py +197 -0
- wx/demo/Cairo_Snippets.py +135 -0
- wx/demo/Calendar.py +660 -0
- wx/demo/CalendarCtrl.py +122 -0
- wx/demo/CheckBox.py +74 -0
- wx/demo/CheckListBox.py +79 -0
- wx/demo/CheckListCtrl.py +99 -0
- wx/demo/Choice.py +55 -0
- wx/demo/Choicebook.py +80 -0
- wx/demo/CollapsibleHeaderCtrl.py +85 -0
- wx/demo/CollapsiblePane.py +126 -0
- wx/demo/ColorPanel.py +19 -0
- wx/demo/ColourDB.py +203 -0
- wx/demo/ColourDialog.py +76 -0
- wx/demo/ColourSelect.py +119 -0
- wx/demo/ComboBox.py +111 -0
- wx/demo/ComboCtrl.py +153 -0
- wx/demo/ComboTreeBox.py +71 -0
- wx/demo/CommandLinkButton.py +50 -0
- wx/demo/ContextHelp.py +112 -0
- wx/demo/Cursor.py +336 -0
- wx/demo/CustomDragAndDrop.py +353 -0
- wx/demo/DVC_CustomRenderer.py +204 -0
- wx/demo/DVC_DataViewModel.py +365 -0
- wx/demo/DVC_IndexListModel.py +257 -0
- wx/demo/DVC_ListCtrl.py +69 -0
- wx/demo/DVC_TreeCtrl.py +76 -0
- wx/demo/DatePickerCtrl.py +68 -0
- wx/demo/DelayedResult.py +239 -0
- wx/demo/Dialog.py +169 -0
- wx/demo/DialogUnits.py +128 -0
- wx/demo/DirDialog.py +58 -0
- wx/demo/DragAndDrop.py +265 -0
- wx/demo/DragImage.py +316 -0
- wx/demo/DragScroller.py +59 -0
- wx/demo/DrawXXXList.py +436 -0
- wx/demo/DynamicSashWindow.py +177 -0
- wx/demo/EditableListBox.py +101 -0
- wx/demo/Editor.py +70 -0
- wx/demo/EventManager.py +291 -0
- wx/demo/ExpandoTextCtrl.py +164 -0
- wx/demo/FancyText.py +83 -0
- wx/demo/FileBrowseButton.py +100 -0
- wx/demo/FileCtrl.py +97 -0
- wx/demo/FileDialog.py +144 -0
- wx/demo/FileHistory.py +140 -0
- wx/demo/FindReplaceDialog.py +123 -0
- wx/demo/FloatCanvas.py +1959 -0
- wx/demo/FontDialog.py +142 -0
- wx/demo/FontEnumerator.py +82 -0
- wx/demo/Frame.py +85 -0
- wx/demo/GLCanvas.py +371 -0
- wx/demo/Gauge.py +66 -0
- wx/demo/GenericButtons.py +185 -0
- wx/demo/GenericCheckBox.py +65 -0
- wx/demo/GenericDirCtrl.py +74 -0
- wx/demo/GetMouseState.py +159 -0
- wx/demo/GraphicsContext.py +236 -0
- wx/demo/GraphicsGradient.py +281 -0
- wx/demo/Grid.py +95 -0
- wx/demo/GridBagSizer.py +170 -0
- wx/demo/GridCustEditor.py +247 -0
- wx/demo/GridCustTable.py +170 -0
- wx/demo/GridDragAndDrop.py +102 -0
- wx/demo/GridDragable.py +206 -0
- wx/demo/GridEnterHandler.py +66 -0
- wx/demo/GridHugeTable.py +89 -0
- wx/demo/GridLabelRenderer.py +114 -0
- wx/demo/GridSimple.py +270 -0
- wx/demo/GridStdEdRend.py +186 -0
- wx/demo/Grid_MegaExample.py +490 -0
- wx/demo/HTML2_WebView.py +183 -0
- wx/demo/HtmlWindow.py +232 -0
- wx/demo/I18N.py +237 -0
- wx/demo/Image.py +338 -0
- wx/demo/ImageAlpha.py +87 -0
- wx/demo/ImageBrowser.py +70 -0
- wx/demo/ImageFromStream.py +49 -0
- wx/demo/Img2PyArtProvider.py +99 -0
- wx/demo/InfoBar.py +127 -0
- wx/demo/IntCtrl.py +343 -0
- wx/demo/ItemsPicker.py +108 -0
- wx/demo/Joystick.py +1083 -0
- wx/demo/KeyEvents.py +428 -0
- wx/demo/LEDNumberCtrl.py +121 -0
- wx/demo/LayoutAnchors.py +258 -0
- wx/demo/LayoutConstraints.py +149 -0
- wx/demo/Layoutf.py +69 -0
- wx/demo/ListBox.py +164 -0
- wx/demo/ListCtrl.py +538 -0
- wx/demo/ListCtrl_edit.py +155 -0
- wx/demo/ListCtrl_virtual.py +145 -0
- wx/demo/Listbook.py +104 -0
- wx/demo/MDIDemo.py +86 -0
- wx/demo/MDISashDemo.py +152 -0
- wx/demo/MDIWindows.py +66 -0
- wx/demo/Main.py +2768 -0
- wx/demo/Mask.py +137 -0
- wx/demo/MaskedEditControls.py +648 -0
- wx/demo/MaskedNumCtrl.py +359 -0
- wx/demo/MediaCtrl.py +190 -0
- wx/demo/Menu.py +322 -0
- wx/demo/MessageDialog.py +54 -0
- wx/demo/MimeTypesManager.py +354 -0
- wx/demo/MiniFrame.py +67 -0
- wx/demo/MouseGestures.py +198 -0
- wx/demo/MultiChoiceDialog.py +59 -0
- wx/demo/MultiSash.py +95 -0
- wx/demo/MultiSplitterWindow.py +168 -0
- wx/demo/MultipleChoiceDialog.py +101 -0
- wx/demo/Notebook.py +134 -0
- wx/demo/NotificationMessage.py +61 -0
- wx/demo/OGL.py +433 -0
- wx/demo/Overlay.py +209 -0
- wx/demo/OwnerDrawnComboBox.py +152 -0
- wx/demo/PDFViewer.py +109 -0
- wx/demo/PageSetupDialog.py +70 -0
- wx/demo/PenAndBrushStyles.py +208 -0
- wx/demo/Pickers.py +120 -0
- wx/demo/PlateButton.py +430 -0
- wx/demo/PopupControl.py +99 -0
- wx/demo/PopupMenu.py +156 -0
- wx/demo/PopupWindow.py +227 -0
- wx/demo/PrintDialog.py +60 -0
- wx/demo/PrintFramework.py +227 -0
- wx/demo/Process.py +168 -0
- wx/demo/ProgressDialog.py +87 -0
- wx/demo/PropertyGrid.py +1045 -0
- wx/demo/PropertySheetDialog.py +231 -0
- wx/demo/PseudoDC.py +350 -0
- wx/demo/PyColourChooser.py +60 -0
- wx/demo/PyCrust.py +21 -0
- wx/demo/PyPlot.py +83 -0
- wx/demo/PyShell.py +22 -0
- wx/demo/PythonEvents.py +109 -0
- wx/demo/README.txt +7 -0
- wx/demo/RadioBox.py +67 -0
- wx/demo/RadioButton.py +127 -0
- wx/demo/RawBitmapAccess.py +208 -0
- wx/demo/RearrangeDialog.py +160 -0
- wx/demo/RendererNative.py +170 -0
- wx/demo/ResizeWidget.py +76 -0
- wx/demo/RichMessageDialog.py +85 -0
- wx/demo/RichTextCtrl.py +732 -0
- wx/demo/RichToolTip.py +145 -0
- wx/demo/SVGImage_Bitmap.py +130 -0
- wx/demo/SVGImage_Render.py +138 -0
- wx/demo/SashWindow.py +151 -0
- wx/demo/ScrolledMessageDialog.py +52 -0
- wx/demo/ScrolledPanel.py +124 -0
- wx/demo/ScrolledWindow.py +260 -0
- wx/demo/SearchCtrl.py +115 -0
- wx/demo/ShapedWindow.py +145 -0
- wx/demo/Simplebook.py +202 -0
- wx/demo/SingleChoiceDialog.py +56 -0
- wx/demo/SizedControls.py +433 -0
- wx/demo/Sizers.py +609 -0
- wx/demo/Slider.py +52 -0
- wx/demo/Sound.py +95 -0
- wx/demo/SpinButton.py +63 -0
- wx/demo/SpinCtrl.py +56 -0
- wx/demo/SpinCtrlDouble.py +42 -0
- wx/demo/SplitTree.py +146 -0
- wx/demo/SplitterWindow.py +62 -0
- wx/demo/StandardPaths.py +113 -0
- wx/demo/StaticBitmap.py +55 -0
- wx/demo/StaticBox.py +62 -0
- wx/demo/StaticText.py +69 -0
- wx/demo/StatusBar.py +144 -0
- wx/demo/StockButtons.py +113 -0
- wx/demo/StyledTextCtrl_1.py +303 -0
- wx/demo/StyledTextCtrl_2.py +410 -0
- wx/demo/SystemSettings.py +333 -0
- wx/demo/TablePrint.py +215 -0
- wx/demo/TestTable.txt +38 -0
- wx/demo/TextCtrl.py +187 -0
- wx/demo/TextEntryDialog.py +57 -0
- wx/demo/Threads.py +258 -0
- wx/demo/Throbber.py +250 -0
- wx/demo/Ticker.py +147 -0
- wx/demo/TimeCtrl.py +240 -0
- wx/demo/TimePickerCtrl.py +60 -0
- wx/demo/Timer.py +275 -0
- wx/demo/ToggleButton.py +54 -0
- wx/demo/ToolBar.py +249 -0
- wx/demo/ToolTip.py +71 -0
- wx/demo/Toolbook.py +111 -0
- wx/demo/TreeCtrl.py +199 -0
- wx/demo/TreeListCtrl.py +121 -0
- wx/demo/TreeMixin.py +269 -0
- wx/demo/Treebook.py +117 -0
- wx/demo/UIActionSimulator.py +151 -0
- wx/demo/URLDragAndDrop.py +130 -0
- wx/demo/Unicode.py +146 -0
- wx/demo/VListBox.py +176 -0
- wx/demo/Validator.py +237 -0
- wx/demo/Wizard.py +248 -0
- wx/demo/WrapSizer.py +115 -0
- wx/demo/XmlResource.py +80 -0
- wx/demo/XmlResourceHandler.py +199 -0
- wx/demo/XmlResourceSubclass.py +119 -0
- wx/demo/__init__.py +9 -0
- wx/demo/agw/AGWInfoBar.py +175 -0
- wx/demo/agw/AUI.py +3058 -0
- wx/demo/agw/AdvancedSplash.py +59 -0
- wx/demo/agw/AquaButton.py +146 -0
- wx/demo/agw/BalloonTip.py +378 -0
- wx/demo/agw/ButtonPanel.py +890 -0
- wx/demo/agw/CubeColourDialog.py +83 -0
- wx/demo/agw/CustomTreeCtrl.py +2167 -0
- wx/demo/agw/Example1 +67 -0
- wx/demo/agw/Example2 +49 -0
- wx/demo/agw/FlatMenu.py +876 -0
- wx/demo/agw/FlatNotebook.py +994 -0
- wx/demo/agw/FloatSpin.py +475 -0
- wx/demo/agw/FoldPanelBar.py +953 -0
- wx/demo/agw/FourWaySplitter.py +300 -0
- wx/demo/agw/GenericMessageDialog.py +207 -0
- wx/demo/agw/GradientButton.py +156 -0
- wx/demo/agw/HyperLinkCtrl.py +144 -0
- wx/demo/agw/HyperTreeList.py +2660 -0
- wx/demo/agw/KnobCtrl.py +186 -0
- wx/demo/agw/LabelBook.py +567 -0
- wx/demo/agw/MacLargeDemo.py +360 -0
- wx/demo/agw/MultiDirDialog.py +117 -0
- wx/demo/agw/PeakMeter.py +194 -0
- wx/demo/agw/PersistentControls.py +589 -0
- wx/demo/agw/PieCtrl.py +206 -0
- wx/demo/agw/PyBusyInfo.py +64 -0
- wx/demo/agw/PyCollapsiblePane.py +308 -0
- wx/demo/agw/PyGauge.py +162 -0
- wx/demo/agw/PyProgress.py +155 -0
- wx/demo/agw/RibbonBar.py +925 -0
- wx/demo/agw/RulerCtrl.py +454 -0
- wx/demo/agw/ScrolledThumbnail.py +128 -0
- wx/demo/agw/ShapedButton.py +603 -0
- wx/demo/agw/ShortcutEditor.py +397 -0
- wx/demo/agw/SpeedMeter.py +668 -0
- wx/demo/agw/SuperToolTip.py +396 -0
- wx/demo/agw/ThumbDemoConfig.py +603 -0
- wx/demo/agw/ThumbnailCtrl.py +149 -0
- wx/demo/agw/ToasterBox.py +410 -0
- wx/demo/agw/UltimateListCtrl.py +80 -0
- wx/demo/agw/UltimateListIconDemo.py +908 -0
- wx/demo/agw/UltimateListListDemo.py +124 -0
- wx/demo/agw/UltimateReportDemo.py +1146 -0
- wx/demo/agw/UltimateVirtualDemo.py +207 -0
- wx/demo/agw/Windows7Explorer_Contents.py +368 -0
- wx/demo/agw/XLSGrid.py +238 -0
- wx/demo/agw/ZoomBar.py +230 -0
- wx/demo/agw/__demo__.py +183 -0
- wx/demo/agw/bitmaps/Explorer96.png +0 -0
- wx/demo/agw/bitmaps/Explorer96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Folder96.png +0 -0
- wx/demo/agw/bitmaps/Folder96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Monitor96.png +0 -0
- wx/demo/agw/bitmaps/Monitor96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Music96.png +0 -0
- wx/demo/agw/bitmaps/Music96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Photo96.png +0 -0
- wx/demo/agw/bitmaps/Photo96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Search96.png +0 -0
- wx/demo/agw/bitmaps/Search96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Wizard96.png +0 -0
- wx/demo/agw/bitmaps/Wizard96Flip40.png +0 -0
- wx/demo/agw/bitmaps/advancedsplash.png +0 -0
- wx/demo/agw/bitmaps/aquabutton.png +0 -0
- wx/demo/agw/bitmaps/aquachecked.ico +0 -0
- wx/demo/agw/bitmaps/aquaflagged.ico +0 -0
- wx/demo/agw/bitmaps/aquanotchecked.ico +0 -0
- wx/demo/agw/bitmaps/aquanotflagged.ico +0 -0
- wx/demo/agw/bitmaps/canada.gif +0 -0
- wx/demo/agw/bitmaps/checked.ico +0 -0
- wx/demo/agw/bitmaps/columns.png +0 -0
- wx/demo/agw/bitmaps/contexthelp-16.png +0 -0
- wx/demo/agw/bitmaps/contexthelp.png +0 -0
- wx/demo/agw/bitmaps/copy.png +0 -0
- wx/demo/agw/bitmaps/cut.png +0 -0
- wx/demo/agw/bitmaps/editcopy.png +0 -0
- wx/demo/agw/bitmaps/editcut.png +0 -0
- wx/demo/agw/bitmaps/editpaste.png +0 -0
- wx/demo/agw/bitmaps/empty_icon.png +0 -0
- wx/demo/agw/bitmaps/exit-16.png +0 -0
- wx/demo/agw/bitmaps/exit.ico +0 -0
- wx/demo/agw/bitmaps/ffwd.png +0 -0
- wx/demo/agw/bitmaps/ffwddisabled.png +0 -0
- wx/demo/agw/bitmaps/field-16.png +0 -0
- wx/demo/agw/bitmaps/filenew.png +0 -0
- wx/demo/agw/bitmaps/fileopen.png +0 -0
- wx/demo/agw/bitmaps/filesave.png +0 -0
- wx/demo/agw/bitmaps/flagged.ico +0 -0
- wx/demo/agw/bitmaps/folder.png +0 -0
- wx/demo/agw/bitmaps/folder_new.png +0 -0
- wx/demo/agw/bitmaps/ghost.png +0 -0
- wx/demo/agw/bitmaps/gradientbutton.png +0 -0
- wx/demo/agw/bitmaps/help-16.png +0 -0
- wx/demo/agw/bitmaps/help.ico +0 -0
- wx/demo/agw/bitmaps/italy.gif +0 -0
- wx/demo/agw/bitmaps/lbadd.png +0 -0
- wx/demo/agw/bitmaps/lbcharge.png +0 -0
- wx/demo/agw/bitmaps/lbdecrypted.png +0 -0
- wx/demo/agw/bitmaps/lbnews.png +0 -0
- wx/demo/agw/bitmaps/lbroll.png +0 -0
- wx/demo/agw/bitmaps/minus1.ico +0 -0
- wx/demo/agw/bitmaps/minus2.ico +0 -0
- wx/demo/agw/bitmaps/minus3.ico +0 -0
- wx/demo/agw/bitmaps/minus4.ico +0 -0
- wx/demo/agw/bitmaps/minus5.ico +0 -0
- wx/demo/agw/bitmaps/month-16.png +0 -0
- wx/demo/agw/bitmaps/new_file.png +0 -0
- wx/demo/agw/bitmaps/new_folder.png +0 -0
- wx/demo/agw/bitmaps/notchecked.ico +0 -0
- wx/demo/agw/bitmaps/notflagged.ico +0 -0
- wx/demo/agw/bitmaps/ok-16.png +0 -0
- wx/demo/agw/bitmaps/open_folder.png +0 -0
- wx/demo/agw/bitmaps/paste.png +0 -0
- wx/demo/agw/bitmaps/pause.png +0 -0
- wx/demo/agw/bitmaps/pausedisabled.png +0 -0
- wx/demo/agw/bitmaps/play.png +0 -0
- wx/demo/agw/bitmaps/playdisabled.png +0 -0
- wx/demo/agw/bitmaps/plus1.ico +0 -0
- wx/demo/agw/bitmaps/plus2.ico +0 -0
- wx/demo/agw/bitmaps/plus3.ico +0 -0
- wx/demo/agw/bitmaps/plus4.ico +0 -0
- wx/demo/agw/bitmaps/plus5.ico +0 -0
- wx/demo/agw/bitmaps/record.png +0 -0
- wx/demo/agw/bitmaps/recorddisabled.png +0 -0
- wx/demo/agw/bitmaps/recording.gif +0 -0
- wx/demo/agw/bitmaps/rewind.png +0 -0
- wx/demo/agw/bitmaps/rewinddisabled.png +0 -0
- wx/demo/agw/bitmaps/round.png +0 -0
- wx/demo/agw/bitmaps/save.png +0 -0
- wx/demo/agw/bitmaps/separator.gif +0 -0
- wx/demo/agw/bitmaps/separatorflip.png +0 -0
- wx/demo/agw/bitmaps/smfuel.ico +0 -0
- wx/demo/agw/bitmaps/smpi.ico +0 -0
- wx/demo/agw/bitmaps/smtemp.ico +0 -0
- wx/demo/agw/bitmaps/stop.png +0 -0
- wx/demo/agw/bitmaps/stopdisabled.png +0 -0
- wx/demo/agw/bitmaps/sttbutton.png +0 -0
- wx/demo/agw/bitmaps/sttfont.png +0 -0
- wx/demo/agw/bitmaps/sttheader.png +0 -0
- wx/demo/agw/bitmaps/stthelp.png +0 -0
- wx/demo/agw/bitmaps/view1.png +0 -0
- wx/demo/agw/bitmaps/view2.png +0 -0
- wx/demo/agw/bitmaps/view_choose.png +0 -0
- wx/demo/agw/bitmaps/view_detailed.png +0 -0
- wx/demo/agw/bitmaps/view_icon.png +0 -0
- wx/demo/agw/bitmaps/view_multicolumn.png +0 -0
- wx/demo/agw/bitmaps/viewmag-16.png +0 -0
- wx/demo/agw/bitmaps/viewmag-m-16.png +0 -0
- wx/demo/agw/bitmaps/viewmag-p-16.png +0 -0
- wx/demo/agw/bitmaps/viewmagfit-16.png +0 -0
- wx/demo/agw/data/Example_1.xls +0 -0
- wx/demo/agw/images.py +6714 -0
- wx/demo/bitmaps/AG00028_.gif +0 -0
- wx/demo/bitmaps/AG00039_.gif +0 -0
- wx/demo/bitmaps/AG00178_.gif +0 -0
- wx/demo/bitmaps/AG00183_.gif +0 -0
- wx/demo/bitmaps/AG00185_.gif +0 -0
- wx/demo/bitmaps/BD13656_.gif +0 -0
- wx/demo/bitmaps/advancedsplash.png +0 -0
- wx/demo/bitmaps/aquabutton.png +0 -0
- wx/demo/bitmaps/aquachecked.ico +0 -0
- wx/demo/bitmaps/aquaflagged.ico +0 -0
- wx/demo/bitmaps/aquanotchecked.ico +0 -0
- wx/demo/bitmaps/aquanotflagged.ico +0 -0
- wx/demo/bitmaps/canada.gif +0 -0
- wx/demo/bitmaps/checked.ico +0 -0
- wx/demo/bitmaps/columns.png +0 -0
- wx/demo/bitmaps/contexthelp-16.png +0 -0
- wx/demo/bitmaps/contexthelp.png +0 -0
- wx/demo/bitmaps/copy.png +0 -0
- wx/demo/bitmaps/cropshot24x20.png +0 -0
- wx/demo/bitmaps/cut.png +0 -0
- wx/demo/bitmaps/editcopy.png +0 -0
- wx/demo/bitmaps/editcut.png +0 -0
- wx/demo/bitmaps/editpaste.png +0 -0
- wx/demo/bitmaps/exit-16.png +0 -0
- wx/demo/bitmaps/exit.ico +0 -0
- wx/demo/bitmaps/ffwd.png +0 -0
- wx/demo/bitmaps/ffwddisabled.png +0 -0
- wx/demo/bitmaps/field-16.png +0 -0
- wx/demo/bitmaps/filenew.png +0 -0
- wx/demo/bitmaps/fileopen.png +0 -0
- wx/demo/bitmaps/filesave.png +0 -0
- wx/demo/bitmaps/flagged.ico +0 -0
- wx/demo/bitmaps/folder_new.png +0 -0
- wx/demo/bitmaps/ghost.png +0 -0
- wx/demo/bitmaps/gradientbutton.png +0 -0
- wx/demo/bitmaps/help-16.png +0 -0
- wx/demo/bitmaps/help.ico +0 -0
- wx/demo/bitmaps/honeycomb300.png +0 -0
- wx/demo/bitmaps/image.bmp +0 -0
- wx/demo/bitmaps/image.gif +0 -0
- wx/demo/bitmaps/image.ico +0 -0
- wx/demo/bitmaps/image.jpg +0 -0
- wx/demo/bitmaps/image.png +0 -0
- wx/demo/bitmaps/image.tif +0 -0
- wx/demo/bitmaps/italy.gif +0 -0
- wx/demo/bitmaps/lbadd.png +0 -0
- wx/demo/bitmaps/lbcharge.png +0 -0
- wx/demo/bitmaps/lbdecrypted.png +0 -0
- wx/demo/bitmaps/lbnews.png +0 -0
- wx/demo/bitmaps/lbroll.png +0 -0
- wx/demo/bitmaps/minus1.ico +0 -0
- wx/demo/bitmaps/minus2.ico +0 -0
- wx/demo/bitmaps/minus3.ico +0 -0
- wx/demo/bitmaps/minus4.ico +0 -0
- wx/demo/bitmaps/minus5.ico +0 -0
- wx/demo/bitmaps/month-16.png +0 -0
- wx/demo/bitmaps/new_file.png +0 -0
- wx/demo/bitmaps/new_folder.png +0 -0
- wx/demo/bitmaps/notchecked.ico +0 -0
- wx/demo/bitmaps/notflagged.ico +0 -0
- wx/demo/bitmaps/ok-16.png +0 -0
- wx/demo/bitmaps/open_folder.png +0 -0
- wx/demo/bitmaps/paste.png +0 -0
- wx/demo/bitmaps/pause.png +0 -0
- wx/demo/bitmaps/pausedisabled.png +0 -0
- wx/demo/bitmaps/phoenix_title.png +0 -0
- wx/demo/bitmaps/phoenix_top.png +0 -0
- wx/demo/bitmaps/play.png +0 -0
- wx/demo/bitmaps/playdisabled.png +0 -0
- wx/demo/bitmaps/plus1.ico +0 -0
- wx/demo/bitmaps/plus2.ico +0 -0
- wx/demo/bitmaps/plus3.ico +0 -0
- wx/demo/bitmaps/plus4.ico +0 -0
- wx/demo/bitmaps/plus5.ico +0 -0
- wx/demo/bitmaps/record.png +0 -0
- wx/demo/bitmaps/recorddisabled.png +0 -0
- wx/demo/bitmaps/rewind.png +0 -0
- wx/demo/bitmaps/rewinddisabled.png +0 -0
- wx/demo/bitmaps/round.png +0 -0
- wx/demo/bitmaps/save.png +0 -0
- wx/demo/bitmaps/smfuel.ico +0 -0
- wx/demo/bitmaps/smpi.ico +0 -0
- wx/demo/bitmaps/smtemp.ico +0 -0
- wx/demo/bitmaps/snakey_render.png +0 -0
- wx/demo/bitmaps/splash.png +0 -0
- wx/demo/bitmaps/stop.png +0 -0
- wx/demo/bitmaps/stopdisabled.png +0 -0
- wx/demo/bitmaps/sttbutton.png +0 -0
- wx/demo/bitmaps/sttfont.png +0 -0
- wx/demo/bitmaps/sttheader.png +0 -0
- wx/demo/bitmaps/stthelp.png +0 -0
- wx/demo/bitmaps/toucan.png +0 -0
- wx/demo/bitmaps/view1.png +0 -0
- wx/demo/bitmaps/view2.png +0 -0
- wx/demo/bitmaps/view_choose.png +0 -0
- wx/demo/bitmaps/view_detailed.png +0 -0
- wx/demo/bitmaps/view_icon.png +0 -0
- wx/demo/bitmaps/view_multicolumn.png +0 -0
- wx/demo/bitmaps/viewmag-16.png +0 -0
- wx/demo/bitmaps/viewmag-m-16.png +0 -0
- wx/demo/bitmaps/viewmag-p-16.png +0 -0
- wx/demo/bitmaps/viewmagfit-16.png +0 -0
- wx/demo/bmp_source/001.png +0 -0
- wx/demo/bmp_source/002.png +0 -0
- wx/demo/bmp_source/003.png +0 -0
- wx/demo/bmp_source/004.png +0 -0
- wx/demo/bmp_source/005.png +0 -0
- wx/demo/bmp_source/006.png +0 -0
- wx/demo/bmp_source/007.png +0 -0
- wx/demo/bmp_source/008.png +0 -0
- wx/demo/bmp_source/009.png +0 -0
- wx/demo/bmp_source/010.png +0 -0
- wx/demo/bmp_source/011.png +0 -0
- wx/demo/bmp_source/012.png +0 -0
- wx/demo/bmp_source/013.png +0 -0
- wx/demo/bmp_source/014.png +0 -0
- wx/demo/bmp_source/015.png +0 -0
- wx/demo/bmp_source/016.png +0 -0
- wx/demo/bmp_source/017.png +0 -0
- wx/demo/bmp_source/018.png +0 -0
- wx/demo/bmp_source/019.png +0 -0
- wx/demo/bmp_source/020.png +0 -0
- wx/demo/bmp_source/021.png +0 -0
- wx/demo/bmp_source/022.png +0 -0
- wx/demo/bmp_source/023.png +0 -0
- wx/demo/bmp_source/024.png +0 -0
- wx/demo/bmp_source/025.png +0 -0
- wx/demo/bmp_source/026.png +0 -0
- wx/demo/bmp_source/027.png +0 -0
- wx/demo/bmp_source/028.png +0 -0
- wx/demo/bmp_source/029.png +0 -0
- wx/demo/bmp_source/030.png +0 -0
- wx/demo/bmp_source/DbDec.bmp +0 -0
- wx/demo/bmp_source/DbInc.bmp +0 -0
- wx/demo/bmp_source/Dec.bmp +0 -0
- wx/demo/bmp_source/FRM_0.png +0 -0
- wx/demo/bmp_source/FRM_1.png +0 -0
- wx/demo/bmp_source/FRM_2.png +0 -0
- wx/demo/bmp_source/FRM_3.png +0 -0
- wx/demo/bmp_source/FRM_4.png +0 -0
- wx/demo/bmp_source/FRM_5.png +0 -0
- wx/demo/bmp_source/FRM_6.png +0 -0
- wx/demo/bmp_source/FRM_7.png +0 -0
- wx/demo/bmp_source/FRM_8.png +0 -0
- wx/demo/bmp_source/GridBG.gif +0 -0
- wx/demo/bmp_source/Inc.bmp +0 -0
- wx/demo/bmp_source/LB01.png +0 -0
- wx/demo/bmp_source/LB02.png +0 -0
- wx/demo/bmp_source/LB03.png +0 -0
- wx/demo/bmp_source/LB04.png +0 -0
- wx/demo/bmp_source/LB05.png +0 -0
- wx/demo/bmp_source/LB06.png +0 -0
- wx/demo/bmp_source/LB07.png +0 -0
- wx/demo/bmp_source/LB08.png +0 -0
- wx/demo/bmp_source/LB09.png +0 -0
- wx/demo/bmp_source/LB10.png +0 -0
- wx/demo/bmp_source/LB11.png +0 -0
- wx/demo/bmp_source/LB12.png +0 -0
- wx/demo/bmp_source/Pt.bmp +0 -0
- wx/demo/bmp_source/Vippi.png +0 -0
- wx/demo/bmp_source/backgrnd.png +0 -0
- wx/demo/bmp_source/book.png +0 -0
- wx/demo/bmp_source/book_blue.png +0 -0
- wx/demo/bmp_source/book_green.png +0 -0
- wx/demo/bmp_source/book_red.png +0 -0
- wx/demo/bmp_source/bp_btn1.png +0 -0
- wx/demo/bmp_source/bp_btn2.png +0 -0
- wx/demo/bmp_source/bp_btn3.png +0 -0
- wx/demo/bmp_source/bp_btn4.png +0 -0
- wx/demo/bmp_source/bulb1.bmp +0 -0
- wx/demo/bmp_source/bulb2.bmp +0 -0
- wx/demo/bmp_source/carrot.png +0 -0
- wx/demo/bmp_source/clipboard.png +0 -0
- wx/demo/bmp_source/code.png +0 -0
- wx/demo/bmp_source/core.png +0 -0
- wx/demo/bmp_source/custom.png +0 -0
- wx/demo/bmp_source/customcontrol.png +0 -0
- wx/demo/bmp_source/deletedocs.png +0 -0
- wx/demo/bmp_source/deleteperspective.png +0 -0
- wx/demo/bmp_source/demo.png +0 -0
- wx/demo/bmp_source/dialog.png +0 -0
- wx/demo/bmp_source/exit.png +0 -0
- wx/demo/bmp_source/expansion.png +0 -0
- wx/demo/bmp_source/find.png +0 -0
- wx/demo/bmp_source/findnext.png +0 -0
- wx/demo/bmp_source/floatcanvas.png +0 -0
- wx/demo/bmp_source/frame.png +0 -0
- wx/demo/bmp_source/images.png +0 -0
- wx/demo/bmp_source/inspect.png +0 -0
- wx/demo/bmp_source/layout.png +0 -0
- wx/demo/bmp_source/logo.png +0 -0
- wx/demo/bmp_source/miscellaneous.png +0 -0
- wx/demo/bmp_source/modifiedexists.png +0 -0
- wx/demo/bmp_source/mondrian.ico +0 -0
- wx/demo/bmp_source/morecontrols.png +0 -0
- wx/demo/bmp_source/moredialog.png +0 -0
- wx/demo/bmp_source/noicon.png +0 -0
- wx/demo/bmp_source/overview.png +0 -0
- wx/demo/bmp_source/pencil.png +0 -0
- wx/demo/bmp_source/pointy.png +0 -0
- wx/demo/bmp_source/process.png +0 -0
- wx/demo/bmp_source/pyshell.png +0 -0
- wx/demo/bmp_source/recent.png +0 -0
- wx/demo/bmp_source/rest.png +0 -0
- wx/demo/bmp_source/robin.jpg +0 -0
- wx/demo/bmp_source/rt_alignleft.xpm +24 -0
- wx/demo/bmp_source/rt_alignright.xpm +24 -0
- wx/demo/bmp_source/rt_bold.xpm +24 -0
- wx/demo/bmp_source/rt_centre.xpm +24 -0
- wx/demo/bmp_source/rt_colour.xpm +59 -0
- wx/demo/bmp_source/rt_copy.xpm +44 -0
- wx/demo/bmp_source/rt_cut.xpm +46 -0
- wx/demo/bmp_source/rt_font.xpm +25 -0
- wx/demo/bmp_source/rt_idea.xpm +47 -0
- wx/demo/bmp_source/rt_indentless.xpm +25 -0
- wx/demo/bmp_source/rt_indentmore.xpm +25 -0
- wx/demo/bmp_source/rt_italic.xpm +25 -0
- wx/demo/bmp_source/rt_open.xpm +57 -0
- wx/demo/bmp_source/rt_paste.xpm +46 -0
- wx/demo/bmp_source/rt_redo.xpm +58 -0
- wx/demo/bmp_source/rt_sample.xpm +44 -0
- wx/demo/bmp_source/rt_save.xpm +42 -0
- wx/demo/bmp_source/rt_smiley.xpm +42 -0
- wx/demo/bmp_source/rt_underline.xpm +25 -0
- wx/demo/bmp_source/rt_undo.xpm +58 -0
- wx/demo/bmp_source/rt_zebra.xpm +409 -0
- wx/demo/bmp_source/saveperspective.png +0 -0
- wx/demo/bmp_source/sm_down.bmp +0 -0
- wx/demo/bmp_source/sm_up.bmp +0 -0
- wx/demo/bmp_source/smiles2.bmp +0 -0
- wx/demo/bmp_source/test2.bmp +0 -0
- wx/demo/bmp_source/testmask.bmp +0 -0
- wx/demo/bmp_source/teststar.png +0 -0
- wx/demo/bmp_source/thekid.png +0 -0
- wx/demo/bmp_source/tog1.bmp +0 -0
- wx/demo/bmp_source/tog2.bmp +0 -0
- wx/demo/bmp_source/wiztest1.bmp +0 -0
- wx/demo/bmp_source/wiztest2.bmp +0 -0
- wx/demo/bmp_source/wxpdemo.ico +0 -0
- wx/demo/cursors/paperairplane_arrow_blue.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_blue_fadeout80.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_colorshift.ani +0 -0
- wx/demo/cursors/paperairplane_arrow_dark.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_grey.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_red.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_white.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_white24.png +0 -0
- wx/demo/data/0-tiger.svg +725 -0
- wx/demo/data/Asteroid_blaster.swf +0 -0
- wx/demo/data/SIL_OPEN_FONT_LICENSE.txt +97 -0
- wx/demo/data/SourceCodePro-Regular.ttf +0 -0
- wx/demo/data/accessories-calculator.svg +636 -0
- wx/demo/data/accessories-text-editor.svg +554 -0
- wx/demo/data/anykey.wav +0 -0
- wx/demo/data/applications-internet.svg +623 -0
- wx/demo/data/desktop-accessibility.svg +245 -0
- wx/demo/data/desktop-keyboard-shortcuts.svg +839 -0
- wx/demo/data/desktop-locale.svg +878 -0
- wx/demo/data/desktop-remote-desktop.svg +1479 -0
- wx/demo/data/desktop-theme.svg +882 -0
- wx/demo/data/desktop-wallpaper.svg +747 -0
- wx/demo/data/echo.py +25 -0
- wx/demo/data/imagemap.htm +20 -0
- wx/demo/data/imagemap.png +0 -0
- wx/demo/data/internet-group-chat.svg +312 -0
- wx/demo/data/internet-mail.svg +440 -0
- wx/demo/data/locale/af/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale/de/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale/es/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale/fr/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale/it/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale-src/af.po +23 -0
- wx/demo/data/locale-src/de.po +23 -0
- wx/demo/data/locale-src/es.po +22 -0
- wx/demo/data/locale-src/fr.po +22 -0
- wx/demo/data/locale-src/install +15 -0
- wx/demo/data/locale-src/it.po +23 -0
- wx/demo/data/locale-src/wxpydemo.po +21 -0
- wx/demo/data/office-calendar.svg +316 -0
- wx/demo/data/pic.png +0 -0
- wx/demo/data/pic2.bmp +0 -0
- wx/demo/data/plan.wav +0 -0
- wx/demo/data/proclamation.txt +115 -0
- wx/demo/data/resource.wdr +0 -0
- wx/demo/data/resource_wdr.xrc +146 -0
- wx/demo/data/romedalen.png +0 -0
- wx/demo/data/stc.h.html +3544 -0
- wx/demo/data/system-session.svg +510 -0
- wx/demo/data/system-users.svg +539 -0
- wx/demo/data/tables.htm +116 -0
- wx/demo/data/test-gradient-pen.svg +14 -0
- wx/demo/data/test-opacity.svg +7 -0
- wx/demo/data/test.htm +253 -0
- wx/demo/data/testmovie.mpg +0 -0
- wx/demo/data/testtable.txt +38 -0
- wx/demo/data/tips.txt +73 -0
- wx/demo/data/utilities-system-monitor.svg +435 -0
- wx/demo/data/utilities-terminal.svg +500 -0
- wx/demo/data/widgetTest.htm +70 -0
- wx/demo/data/world.dat +24055 -0
- wx/demo/demo.py +4 -0
- wx/demo/demo.pyw +4 -0
- wx/demo/demodata.py +310 -0
- wx/demo/encode_bitmaps.py +181 -0
- wx/demo/images.py +6812 -0
- wx/demo/infoframe.py +149 -0
- wx/demo/run.py +171 -0
- wx/demo/snippets/__init__.py +13 -0
- wx/demo/snippets/arc.py +21 -0
- wx/demo/snippets/arc_negative.py +21 -0
- wx/demo/snippets/clip.py +13 -0
- wx/demo/snippets/clip_image.py +13 -0
- wx/demo/snippets/curve_rectangle.py +53 -0
- wx/demo/snippets/curve_to.py +17 -0
- wx/demo/snippets/dash.py +18 -0
- wx/demo/snippets/ellipse.py +33 -0
- wx/demo/snippets/fill_and_stroke.py +12 -0
- wx/demo/snippets/fill_and_stroke2.py +18 -0
- wx/demo/snippets/fill_style.py +31 -0
- wx/demo/snippets/glyph_path.py +21 -0
- wx/demo/snippets/gradient.py +16 -0
- wx/demo/snippets/gradient_mask.py +12 -0
- wx/demo/snippets/group.py +16 -0
- wx/demo/snippets/image.py +14 -0
- wx/demo/snippets/imagepattern.py +23 -0
- wx/demo/snippets/path.py +7 -0
- wx/demo/snippets/set_line_cap.py +19 -0
- wx/demo/snippets/set_line_join.py +21 -0
- wx/demo/snippets/show_glyphs.py +15 -0
- wx/demo/snippets/text.py +22 -0
- wx/demo/snippets/text_align_center.py +26 -0
- wx/demo/snippets/text_extents.py +27 -0
- wx/demo/template.py +36 -0
- wx/demo/throbImages.py +1277 -0
- wx/demo/version.py +3 -0
- wx/demo/widgetTest.py +72 -0
- wx/demo/wxpdemo.ico +0 -0
- wx/glcanvas.py +10 -0
- wx/glcanvas.pyi +458 -0
- wx/grid.py +229 -0
- wx/grid.pyi +4959 -0
- wx/html.py +35 -0
- wx/html.pyi +2965 -0
- wx/html2.py +40 -0
- wx/html2.pyi +772 -0
- wx/lib/CDate.py +202 -0
- wx/lib/ClickableHtmlWindow.py +57 -0
- wx/lib/__init__.py +0 -0
- wx/lib/activex.py +178 -0
- wx/lib/activexwrapper.py +153 -0
- wx/lib/agw/__init__.py +128 -0
- wx/lib/agw/advancedsplash.py +564 -0
- wx/lib/agw/aquabutton.py +1127 -0
- wx/lib/agw/artmanager.py +2110 -0
- wx/lib/agw/aui/__init__.py +295 -0
- wx/lib/agw/aui/aui_constants.py +2628 -0
- wx/lib/agw/aui/aui_switcherdialog.py +1227 -0
- wx/lib/agw/aui/aui_utilities.py +672 -0
- wx/lib/agw/aui/auibar.py +4031 -0
- wx/lib/agw/aui/auibook.py +6289 -0
- wx/lib/agw/aui/dockart.py +1198 -0
- wx/lib/agw/aui/framemanager.py +10409 -0
- wx/lib/agw/aui/tabart.py +2771 -0
- wx/lib/agw/aui/tabmdi.py +679 -0
- wx/lib/agw/balloontip.py +1158 -0
- wx/lib/agw/buttonpanel.py +2823 -0
- wx/lib/agw/cubecolourdialog.py +3529 -0
- wx/lib/agw/customtreectrl.py +8963 -0
- wx/lib/agw/data/ShortcutEditor_1.png +0 -0
- wx/lib/agw/data/ShortcutEditor_1_thumb.png +0 -0
- wx/lib/agw/data/ShortcutEditor_2.png +0 -0
- wx/lib/agw/data/ShortcutEditor_2_thumb.png +0 -0
- wx/lib/agw/data/ShortcutEditor_3.png +0 -0
- wx/lib/agw/data/ShortcutEditor_3_thumb.png +0 -0
- wx/lib/agw/data/ShortcutEditor_4.png +0 -0
- wx/lib/agw/data/ShortcutEditor_4_thumb.png +0 -0
- wx/lib/agw/data/default_help_text.html +105 -0
- wx/lib/agw/flatmenu.py +7333 -0
- wx/lib/agw/flatnotebook.py +6672 -0
- wx/lib/agw/floatspin.py +1823 -0
- wx/lib/agw/fmcustomizedlg.py +540 -0
- wx/lib/agw/fmresources.py +407 -0
- wx/lib/agw/foldpanelbar.py +2282 -0
- wx/lib/agw/fourwaysplitter.py +1130 -0
- wx/lib/agw/genericmessagedialog.py +1549 -0
- wx/lib/agw/gradientbutton.py +732 -0
- wx/lib/agw/hyperlink.py +664 -0
- wx/lib/agw/hypertreelist.py +5374 -0
- wx/lib/agw/infobar.py +885 -0
- wx/lib/agw/knobctrl.py +945 -0
- wx/lib/agw/labelbook.py +3029 -0
- wx/lib/agw/multidirdialog.py +615 -0
- wx/lib/agw/peakmeter.py +1029 -0
- wx/lib/agw/persist/__init__.py +188 -0
- wx/lib/agw/persist/persist_constants.py +284 -0
- wx/lib/agw/persist/persist_handlers.py +2614 -0
- wx/lib/agw/persist/persistencemanager.py +864 -0
- wx/lib/agw/piectrl.py +1082 -0
- wx/lib/agw/pybusyinfo.py +399 -0
- wx/lib/agw/pycollapsiblepane.py +940 -0
- wx/lib/agw/pygauge.py +570 -0
- wx/lib/agw/pyprogress.py +917 -0
- wx/lib/agw/ribbon/__init__.py +198 -0
- wx/lib/agw/ribbon/art.py +219 -0
- wx/lib/agw/ribbon/art_aui.py +1284 -0
- wx/lib/agw/ribbon/art_default.py +81 -0
- wx/lib/agw/ribbon/art_internal.py +244 -0
- wx/lib/agw/ribbon/art_msw.py +2736 -0
- wx/lib/agw/ribbon/art_osx.py +52 -0
- wx/lib/agw/ribbon/bar.py +1261 -0
- wx/lib/agw/ribbon/buttonbar.py +1320 -0
- wx/lib/agw/ribbon/control.py +205 -0
- wx/lib/agw/ribbon/gallery.py +974 -0
- wx/lib/agw/ribbon/page.py +946 -0
- wx/lib/agw/ribbon/panel.py +1170 -0
- wx/lib/agw/ribbon/toolbar.py +1442 -0
- wx/lib/agw/rulerctrl.py +1887 -0
- wx/lib/agw/scrolledthumbnail.py +2119 -0
- wx/lib/agw/shapedbutton.py +1809 -0
- wx/lib/agw/shortcuteditor.py +2634 -0
- wx/lib/agw/speedmeter.py +1801 -0
- wx/lib/agw/supertooltip.py +1444 -0
- wx/lib/agw/thumbnailctrl.py +529 -0
- wx/lib/agw/toasterbox.py +1327 -0
- wx/lib/agw/ultimatelistctrl.py +13666 -0
- wx/lib/agw/xlsgrid.py +2113 -0
- wx/lib/agw/zoombar.py +1339 -0
- wx/lib/analogclock/__init__.py +140 -0
- wx/lib/analogclock/analogclock.py +631 -0
- wx/lib/analogclock/helpers.py +991 -0
- wx/lib/analogclock/lib_setup/__init__.py +0 -0
- wx/lib/analogclock/lib_setup/buttontreectrlpanel.py +297 -0
- wx/lib/analogclock/lib_setup/fontselect.py +57 -0
- wx/lib/analogclock/setup.py +490 -0
- wx/lib/analogclock/styles.py +47 -0
- wx/lib/anchors.py +103 -0
- wx/lib/art/__init__.py +4 -0
- wx/lib/art/flagart.py +1583 -0
- wx/lib/art/img2pyartprov.py +56 -0
- wx/lib/busy.py +146 -0
- wx/lib/buttons.py +1141 -0
- wx/lib/calendar.py +1597 -0
- wx/lib/checkbox.py +837 -0
- wx/lib/colourchooser/__init__.py +38 -0
- wx/lib/colourchooser/canvas.py +145 -0
- wx/lib/colourchooser/intl.py +24 -0
- wx/lib/colourchooser/pycolourbox.py +89 -0
- wx/lib/colourchooser/pycolourchooser.py +629 -0
- wx/lib/colourchooser/pycolourslider.py +100 -0
- wx/lib/colourchooser/pypalette.py +211 -0
- wx/lib/colourdb.py +740 -0
- wx/lib/colourselect.py +385 -0
- wx/lib/colourutils.py +118 -0
- wx/lib/combotreebox.py +944 -0
- wx/lib/delayedresult.py +420 -0
- wx/lib/dialogs.py +510 -0
- wx/lib/docview.py +3210 -0
- wx/lib/dragscroller.py +79 -0
- wx/lib/editor/README.txt +77 -0
- wx/lib/editor/__init__.py +24 -0
- wx/lib/editor/editor.py +974 -0
- wx/lib/editor/images.py +15 -0
- wx/lib/editor/selection.py +44 -0
- wx/lib/embeddedimage.py +76 -0
- wx/lib/eventStack.py +136 -0
- wx/lib/eventwatcher.py +440 -0
- wx/lib/evtmgr.py +521 -0
- wx/lib/expando.py +393 -0
- wx/lib/fancytext.py +505 -0
- wx/lib/filebrowsebutton.py +459 -0
- wx/lib/flashwin.py +262 -0
- wx/lib/flashwin_old.py +651 -0
- wx/lib/floatcanvas/FCEvents.py +53 -0
- wx/lib/floatcanvas/FCObjects.py +2923 -0
- wx/lib/floatcanvas/FloatCanvas.py +1027 -0
- wx/lib/floatcanvas/GUIMode.py +396 -0
- wx/lib/floatcanvas/NavCanvas.py +161 -0
- wx/lib/floatcanvas/Resources.py +319 -0
- wx/lib/floatcanvas/ScreenShot.py +1788 -0
- wx/lib/floatcanvas/Utilities/BBox.py +314 -0
- wx/lib/floatcanvas/Utilities/Colors.py +137 -0
- wx/lib/floatcanvas/Utilities/GUI.py +91 -0
- wx/lib/floatcanvas/Utilities/__init__.py +7 -0
- wx/lib/floatcanvas/__init__.py +124 -0
- wx/lib/foldmenu.py +89 -0
- wx/lib/gestures.py +310 -0
- wx/lib/gizmos/__init__.py +18 -0
- wx/lib/gizmos/dynamicsash.py +1202 -0
- wx/lib/gizmos/ledctrl.py +300 -0
- wx/lib/gizmos/treelistctrl.py +87 -0
- wx/lib/graphics.py +1939 -0
- wx/lib/gridmovers.py +511 -0
- wx/lib/iewin.py +249 -0
- wx/lib/iewin_old.py +894 -0
- wx/lib/imagebrowser.py +856 -0
- wx/lib/imageutils.py +163 -0
- wx/lib/infoframe.py +490 -0
- wx/lib/inspection.py +1255 -0
- wx/lib/intctrl.py +1001 -0
- wx/lib/itemspicker.py +256 -0
- wx/lib/langlistctrl.py +480 -0
- wx/lib/layoutf.py +271 -0
- wx/lib/masked/__init__.py +27 -0
- wx/lib/masked/combobox.py +839 -0
- wx/lib/masked/ctrl.py +108 -0
- wx/lib/masked/ipaddrctrl.py +242 -0
- wx/lib/masked/maskededit.py +7279 -0
- wx/lib/masked/numctrl.py +2001 -0
- wx/lib/masked/textctrl.py +465 -0
- wx/lib/masked/timectrl.py +1466 -0
- wx/lib/mixins/__init__.py +17 -0
- wx/lib/mixins/grid.py +47 -0
- wx/lib/mixins/gridlabelrenderer.py +251 -0
- wx/lib/mixins/imagelist.py +77 -0
- wx/lib/mixins/inspection.py +184 -0
- wx/lib/mixins/listctrl.py +894 -0
- wx/lib/mixins/rubberband.py +404 -0
- wx/lib/mixins/treemixin.py +678 -0
- wx/lib/msgpanel.py +95 -0
- wx/lib/multisash.py +747 -0
- wx/lib/myole4ax.idl +178 -0
- wx/lib/myole4ax.tlb +0 -0
- wx/lib/newevent.py +229 -0
- wx/lib/nvdlg.py +156 -0
- wx/lib/ogl/__init__.py +13 -0
- wx/lib/ogl/basic.py +3991 -0
- wx/lib/ogl/bmpshape.py +87 -0
- wx/lib/ogl/canvas.py +467 -0
- wx/lib/ogl/composit.py +1577 -0
- wx/lib/ogl/diagram.py +230 -0
- wx/lib/ogl/divided.py +483 -0
- wx/lib/ogl/drawn.py +900 -0
- wx/lib/ogl/lines.py +1811 -0
- wx/lib/ogl/oglmisc.py +608 -0
- wx/lib/pdfviewer/__init__.py +113 -0
- wx/lib/pdfviewer/bitmaps/ArrowLeft.png +0 -0
- wx/lib/pdfviewer/bitmaps/ArrowRight.png +0 -0
- wx/lib/pdfviewer/bitmaps/DirectionH.png +0 -0
- wx/lib/pdfviewer/bitmaps/DirectionV.png +0 -0
- wx/lib/pdfviewer/bitmaps/PlayerFirst.png +0 -0
- wx/lib/pdfviewer/bitmaps/PlayerLast.png +0 -0
- wx/lib/pdfviewer/bitmaps/PlayerNext.png +0 -0
- wx/lib/pdfviewer/bitmaps/PlayerPrev.png +0 -0
- wx/lib/pdfviewer/bitmaps/Printer.png +0 -0
- wx/lib/pdfviewer/bitmaps/ReadMe.txt +28 -0
- wx/lib/pdfviewer/bitmaps/Save.png +0 -0
- wx/lib/pdfviewer/bitmaps/ZoomIn.png +0 -0
- wx/lib/pdfviewer/bitmaps/ZoomOut.png +0 -0
- wx/lib/pdfviewer/bitmaps/encode_bitmaps.py +37 -0
- wx/lib/pdfviewer/buttonpanel.py +279 -0
- wx/lib/pdfviewer/images.py +240 -0
- wx/lib/pdfviewer/viewer.py +1077 -0
- wx/lib/pdfwin.py +295 -0
- wx/lib/pdfwin_old.py +789 -0
- wx/lib/platebtn.py +789 -0
- wx/lib/plot/CHANGELOG.md +150 -0
- wx/lib/plot/README.md +16 -0
- wx/lib/plot/__init__.py +46 -0
- wx/lib/plot/__main__.py +5 -0
- wx/lib/plot/examples/__init__.py +0 -0
- wx/lib/plot/examples/demo.py +1009 -0
- wx/lib/plot/examples/simple_example.py +54 -0
- wx/lib/plot/plotcanvas.py +2981 -0
- wx/lib/plot/polyobjects.py +1525 -0
- wx/lib/plot/utils.py +327 -0
- wx/lib/popupctl.py +250 -0
- wx/lib/printout.py +1157 -0
- wx/lib/progressindicator.py +151 -0
- wx/lib/pubsub/LICENSE_BSD_Simple.txt +23 -0
- wx/lib/pubsub/README_WxPython.txt +22 -0
- wx/lib/pubsub/RELEASE_NOTES.txt +71 -0
- wx/lib/pubsub/__init__.py +25 -0
- wx/lib/pubsub/core/__init__.py +92 -0
- wx/lib/pubsub/core/arg1/__init__.py +16 -0
- wx/lib/pubsub/core/arg1/listenerimpl.py +97 -0
- wx/lib/pubsub/core/arg1/publisher.py +40 -0
- wx/lib/pubsub/core/arg1/publishermixin.py +34 -0
- wx/lib/pubsub/core/arg1/topicargspecimpl.py +66 -0
- wx/lib/pubsub/core/arg1/topicmgrimpl.py +19 -0
- wx/lib/pubsub/core/callables.py +191 -0
- wx/lib/pubsub/core/imp2.py +63 -0
- wx/lib/pubsub/core/itopicdefnprovider.py +0 -0
- wx/lib/pubsub/core/kwargs/__init__.py +16 -0
- wx/lib/pubsub/core/kwargs/datamsg.py +27 -0
- wx/lib/pubsub/core/kwargs/listenerimpl.py +93 -0
- wx/lib/pubsub/core/kwargs/publisher.py +77 -0
- wx/lib/pubsub/core/kwargs/publishermixin.py +65 -0
- wx/lib/pubsub/core/kwargs/topicargspecimpl.py +217 -0
- wx/lib/pubsub/core/kwargs/topicmgrimpl.py +13 -0
- wx/lib/pubsub/core/listener.py +40 -0
- wx/lib/pubsub/core/listenerbase.py +185 -0
- wx/lib/pubsub/core/notificationmgr.py +185 -0
- wx/lib/pubsub/core/publisherbase.py +191 -0
- wx/lib/pubsub/core/topicargspec.py +77 -0
- wx/lib/pubsub/core/topicdefnprovider.py +632 -0
- wx/lib/pubsub/core/topicexc.py +72 -0
- wx/lib/pubsub/core/topicmgr.py +456 -0
- wx/lib/pubsub/core/topicobj.py +472 -0
- wx/lib/pubsub/core/topictreetraverser.py +143 -0
- wx/lib/pubsub/core/topicutils.py +118 -0
- wx/lib/pubsub/core/treeconfig.py +21 -0
- wx/lib/pubsub/core/validatedefnargs.py +29 -0
- wx/lib/pubsub/core/weakmethod.py +102 -0
- wx/lib/pubsub/policies.py +24 -0
- wx/lib/pubsub/pub.py +199 -0
- wx/lib/pubsub/py2and3.py +608 -0
- wx/lib/pubsub/setuparg1.py +47 -0
- wx/lib/pubsub/setupkwargs.py +29 -0
- wx/lib/pubsub/utils/__init__.py +27 -0
- wx/lib/pubsub/utils/exchandling.py +100 -0
- wx/lib/pubsub/utils/misc.py +100 -0
- wx/lib/pubsub/utils/notification.py +331 -0
- wx/lib/pubsub/utils/topictreeprinter.py +195 -0
- wx/lib/pubsub/utils/xmltopicdefnprovider.py +287 -0
- wx/lib/pydocview.py +3300 -0
- wx/lib/rcsizer.py +229 -0
- wx/lib/resizewidget.py +357 -0
- wx/lib/scrolledpanel.py +225 -0
- wx/lib/sheet.py +350 -0
- wx/lib/sized_controls.py +691 -0
- wx/lib/softwareupdate.py +361 -0
- wx/lib/splitter.py +925 -0
- wx/lib/statbmp.py +199 -0
- wx/lib/stattext.py +322 -0
- wx/lib/throbber.py +425 -0
- wx/lib/ticker.py +295 -0
- wx/lib/ticker_xrc.py +48 -0
- wx/lib/utils.py +89 -0
- wx/lib/wordwrap.py +97 -0
- wx/lib/wxcairo/__init__.py +124 -0
- wx/lib/wxcairo/wx_cairocffi.py +200 -0
- wx/lib/wxcairo/wx_pycairo.py +463 -0
- wx/lib/wxpTag.py +274 -0
- wx/locale/af/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/an/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ar/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ca/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ca@valencia/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/cs/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/da/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/de/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/el/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/es/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/eu/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/fa_IR/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/fi/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/fr/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/gl_ES/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/hi/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/hr/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/hu/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/id/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/it/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ja/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ka/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ko_KR/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/lt/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/lv/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ms/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/nb/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ne/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/nl/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/pl/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/pt/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/pt_BR/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ro/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ru/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/sk/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/sl/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/sq/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/sv/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ta/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/tr/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/uk/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/vi/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/zh_CN/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/zh_TW/LC_MESSAGES/wxstd.mo +0 -0
- wx/media.py +27 -0
- wx/media.pyi +223 -0
- wx/msw.py +13 -0
- wx/msw.pyi +65 -0
- wx/propgrid.py +1451 -0
- wx/propgrid.pyi +7914 -0
- wx/py/CHANGES.txt +796 -0
- wx/py/Py.ico +0 -0
- wx/py/PyAlaCarte.py +34 -0
- wx/py/PyAlaMode.py +34 -0
- wx/py/PyAlaModeTest.py +33 -0
- wx/py/PyCrust.ico +0 -0
- wx/py/PyCrust.py +78 -0
- wx/py/PyCrust_16.png +0 -0
- wx/py/PyCrust_32.png +0 -0
- wx/py/PyFilling.py +35 -0
- wx/py/PyShell.py +78 -0
- wx/py/PySlices.ico +0 -0
- wx/py/PySlices.py +98 -0
- wx/py/PySlicesShell.py +94 -0
- wx/py/PySlices_16.png +0 -0
- wx/py/PySlices_32.png +0 -0
- wx/py/PyWrap.py +52 -0
- wx/py/README.txt +77 -0
- wx/py/__init__.py +20 -0
- wx/py/buffer.py +136 -0
- wx/py/crust.py +403 -0
- wx/py/crustslices.py +403 -0
- wx/py/dispatcher.py +259 -0
- wx/py/document.py +37 -0
- wx/py/editor.py +844 -0
- wx/py/editwindow.py +299 -0
- wx/py/filling.py +357 -0
- wx/py/frame.py +978 -0
- wx/py/images.py +212 -0
- wx/py/interpreter.py +170 -0
- wx/py/introspect.py +393 -0
- wx/py/magic.py +98 -0
- wx/py/parse.py +134 -0
- wx/py/path.py +36 -0
- wx/py/pseudo.py +99 -0
- wx/py/shell.py +1588 -0
- wx/py/sliceshell.py +3814 -0
- wx/py/tests/test_interpreter.py +71 -0
- wx/py/tests/test_introspect.py +862 -0
- wx/py/tests/test_pseudo.py +70 -0
- wx/py/tests/test_version.py +36 -0
- wx/py/tests/testall.py +22 -0
- wx/py/version.py +7 -0
- wx/ribbon.py +45 -0
- wx/ribbon.pyi +2494 -0
- wx/richtext.py +142 -0
- wx/richtext.pyi +12113 -0
- wx/siplib.cp313-win_amd64.pyd +0 -0
- wx/stc.py +58 -0
- wx/stc.pyi +8463 -0
- wx/svg/__init__.py +364 -0
- wx/svg/_nanosvg.cp313-win_amd64.pyd +0 -0
- wx/tools/__init__.py +18 -0
- wx/tools/dbg.py +268 -0
- wx/tools/genaxmodule.py +50 -0
- wx/tools/helpviewer.py +92 -0
- wx/tools/img2img.py +85 -0
- wx/tools/img2png.py +54 -0
- wx/tools/img2py.py +309 -0
- wx/tools/img2xpm.py +54 -0
- wx/tools/pywxrc.py +949 -0
- wx/tools/wxget.py +254 -0
- wx/tools/wxget_docs_demo.py +186 -0
- wx/wxbase315u_net_vc140_x64.dll +0 -0
- wx/wxbase315u_vc140_x64.dll +0 -0
- wx/wxbase315u_xml_vc140_x64.dll +0 -0
- wx/wxmsw315u_adv_vc140_x64.dll +0 -0
- wx/wxmsw315u_aui_vc140_x64.dll +0 -0
- wx/wxmsw315u_core_vc140_x64.dll +0 -0
- wx/wxmsw315u_gl_vc140_x64.dll +0 -0
- wx/wxmsw315u_html_vc140_x64.dll +0 -0
- wx/wxmsw315u_media_vc140_x64.dll +0 -0
- wx/wxmsw315u_propgrid_vc140_x64.dll +0 -0
- wx/wxmsw315u_qa_vc140_x64.dll +0 -0
- wx/wxmsw315u_ribbon_vc140_x64.dll +0 -0
- wx/wxmsw315u_richtext_vc140_x64.dll +0 -0
- wx/wxmsw315u_stc_vc140_x64.dll +0 -0
- wx/wxmsw315u_webview_vc140_x64.dll +0 -0
- wx/wxmsw315u_xrc_vc140_x64.dll +0 -0
- wx/xml.py +15 -0
- wx/xml.pyi +575 -0
- wx/xrc.py +65 -0
- wx/xrc.pyi +742 -0
- wxPython_zombie-3.1.5.8.dist-info/LICENSE.txt +950 -0
- wxPython_zombie-3.1.5.8.dist-info/METADATA +107 -0
- wxPython_zombie-3.1.5.8.dist-info/RECORD +1175 -0
- wxPython_zombie-3.1.5.8.dist-info/WHEEL +5 -0
- wxPython_zombie-3.1.5.8.dist-info/entry_points.txt +2 -0
- wxPython_zombie-3.1.5.8.dist-info/top_level.txt +1 -0
wx/lib/agw/aui/tabart.py
ADDED
|
@@ -0,0 +1,2771 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#----------------------------------------------------------------------------
|
|
3
|
+
# Name: tabart.py
|
|
4
|
+
# Purpose:
|
|
5
|
+
#
|
|
6
|
+
# Author: Andrea Gavana <andrea.gavana@gmail.com>
|
|
7
|
+
#
|
|
8
|
+
# Created:
|
|
9
|
+
# Version:
|
|
10
|
+
# Date: 31 March 2009
|
|
11
|
+
# Licence: wxWindows license
|
|
12
|
+
# Tags: phoenix-port, unittest, documented, py3-port
|
|
13
|
+
#----------------------------------------------------------------------------
|
|
14
|
+
"""
|
|
15
|
+
Tab art provider code - a tab provider provides all drawing functionality to
|
|
16
|
+
the :class:`~wx.lib.agw.aui.auibook.AuiNotebook`. This allows the
|
|
17
|
+
:class:`~wx.lib.agw.aui.auibook.AuiNotebook` to have a plugable look-and-feel.
|
|
18
|
+
|
|
19
|
+
By default, a :class:`~wx.lib.agw.aui.auibook.AuiNotebook` uses an instance of this class
|
|
20
|
+
called :class:`AuiDefaultTabArt` which provides bitmap art and a colour scheme that is
|
|
21
|
+
adapted to the major platforms' look. You can either derive from that class to alter its
|
|
22
|
+
behaviour or write a completely new tab art class.
|
|
23
|
+
Call :meth:`AuiNotebook.SetArtProvider() <lib.agw.aui.auibook.AuiNotebook.SetArtProvider>`
|
|
24
|
+
to make use this new tab art.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
__author__ = "Andrea Gavana <andrea.gavana@gmail.com>"
|
|
28
|
+
__date__ = "31 March 2009"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
import wx
|
|
32
|
+
|
|
33
|
+
if wx.Platform == '__WXMAC__':
|
|
34
|
+
try:
|
|
35
|
+
import Carbon.Appearance
|
|
36
|
+
except ImportError:
|
|
37
|
+
CARBON = False
|
|
38
|
+
else:
|
|
39
|
+
CARBON = True
|
|
40
|
+
|
|
41
|
+
from .aui_utilities import BitmapFromBits, StepColour, IndentPressedBitmap, ChopText
|
|
42
|
+
from .aui_utilities import GetBaseColour, DrawMACCloseButton, LightColour, TakeScreenShot
|
|
43
|
+
from .aui_utilities import CopyAttributes
|
|
44
|
+
|
|
45
|
+
from .aui_constants import *
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# -- GUI helper classes and functions --
|
|
49
|
+
class AuiCommandCapture(wx.EvtHandler):
|
|
50
|
+
""" A class to handle the dropdown window menu. """
|
|
51
|
+
|
|
52
|
+
def __init__(self):
|
|
53
|
+
""" Default class constructor. """
|
|
54
|
+
|
|
55
|
+
wx.EvtHandler.__init__(self)
|
|
56
|
+
self._last_id = 0
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def GetCommandId(self):
|
|
60
|
+
""" Returns the event command identifier. """
|
|
61
|
+
|
|
62
|
+
return self._last_id
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def ProcessEvent(self, event):
|
|
66
|
+
"""
|
|
67
|
+
Processes an event, searching event tables and calling zero or more suitable
|
|
68
|
+
event handler function(s).
|
|
69
|
+
|
|
70
|
+
:param `event`: the event to process.
|
|
71
|
+
|
|
72
|
+
:note: Normally, your application would not call this function: it is called
|
|
73
|
+
in the wxPython implementation to dispatch incoming user interface events
|
|
74
|
+
to the framework (and application).
|
|
75
|
+
However, you might need to call it if implementing new functionality (such as
|
|
76
|
+
a new control) where you define new event types, as opposed to allowing the
|
|
77
|
+
user to override functions.
|
|
78
|
+
|
|
79
|
+
An instance where you might actually override the :meth:`ProcessEvent` function is where
|
|
80
|
+
you want to direct event processing to event handlers not normally noticed by
|
|
81
|
+
wxPython. For example, in the document/view architecture, documents and views
|
|
82
|
+
are potential event handlers. When an event reaches a frame, :meth:`ProcessEvent` will
|
|
83
|
+
need to be called on the associated document and view in case event handler
|
|
84
|
+
functions are associated with these objects.
|
|
85
|
+
|
|
86
|
+
The normal order of event table searching is as follows:
|
|
87
|
+
|
|
88
|
+
1. If the object is disabled (via a call to :meth:`EvtHandler.SetEvtHandlerEnabled`) the function
|
|
89
|
+
skips to step (6).
|
|
90
|
+
2. If the object is a :class:`wx.Window`, :meth:`ProcessEvent` is recursively called on the window's
|
|
91
|
+
:class:`wx.Validator`. If this returns ``True``, the function exits.
|
|
92
|
+
3. wxWidgets `SearchEventTable` is called for this event handler. If this fails, the
|
|
93
|
+
base class table is tried, and so on until no more tables exist or an appropriate
|
|
94
|
+
function was found, in which case the function exits.
|
|
95
|
+
4. The search is applied down the entire chain of event handlers (usually the chain
|
|
96
|
+
has a length of one). If this succeeds, the function exits.
|
|
97
|
+
5. If the object is a :class:`wx.Window` and the event is a :class:`CommandEvent`, :meth:`ProcessEvent` is
|
|
98
|
+
recursively applied to the parent window's event handler. If this returns ``True``,
|
|
99
|
+
the function exits.
|
|
100
|
+
6. Finally, :meth:`ProcessEvent` is called on the :class:`App` object.
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
if event.GetEventType() == wx.wxEVT_COMMAND_MENU_SELECTED:
|
|
104
|
+
self._last_id = event.GetId()
|
|
105
|
+
return True
|
|
106
|
+
|
|
107
|
+
if self.GetNextHandler():
|
|
108
|
+
return self.GetNextHandler().ProcessEvent(event)
|
|
109
|
+
|
|
110
|
+
return False
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class AuiDefaultTabArt(object):
|
|
114
|
+
"""
|
|
115
|
+
Tab art provider code - a tab provider provides all drawing functionality to the :class:`~wx.lib.agw.aui.auibook.AuiNotebook`.
|
|
116
|
+
This allows the :class:`~wx.lib.agw.aui.auibook.AuiNotebook` to have a plugable look-and-feel.
|
|
117
|
+
|
|
118
|
+
By default, a :class:`~wx.lib.agw.aui.auibook.AuiNotebook` uses an instance of this class called
|
|
119
|
+
:class:`AuiDefaultTabArt` which provides bitmap art and a colour scheme that is adapted to the major platforms'
|
|
120
|
+
look. You can either derive from that class to alter its behaviour or write a
|
|
121
|
+
completely new tab art class. Call :meth:`AuiNotebook.SetArtProvider() <lib.agw.aui.auibook.AuiNotebook.SetArtProvider>` to make use this
|
|
122
|
+
new tab art.
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
def __init__(self):
|
|
126
|
+
""" Default class constructor. """
|
|
127
|
+
|
|
128
|
+
self._normal_font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
|
|
129
|
+
self._selected_font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
|
|
130
|
+
self._selected_font.SetWeight(wx.FONTWEIGHT_BOLD)
|
|
131
|
+
self._measuring_font = self._selected_font
|
|
132
|
+
|
|
133
|
+
self._fixed_tab_width = 100
|
|
134
|
+
self._tab_ctrl_height = 0
|
|
135
|
+
self._buttonRect = wx.Rect()
|
|
136
|
+
|
|
137
|
+
self.SetDefaultColours()
|
|
138
|
+
|
|
139
|
+
active_colour, disabled_colour = wx.BLACK, wx.Colour(128, 128, 128)
|
|
140
|
+
|
|
141
|
+
if wx.Platform == "__WXMAC__":
|
|
142
|
+
bmp_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW)
|
|
143
|
+
self._active_close_bmp = DrawMACCloseButton(bmp_colour)
|
|
144
|
+
self._disabled_close_bmp = DrawMACCloseButton(disabled_colour)
|
|
145
|
+
else:
|
|
146
|
+
self._active_close_bmp = BitmapFromBits(nb_close_bits, 16, 16, active_colour)
|
|
147
|
+
self._disabled_close_bmp = BitmapFromBits(nb_close_bits, 16, 16, disabled_colour)
|
|
148
|
+
|
|
149
|
+
self._hover_close_bmp = self._active_close_bmp
|
|
150
|
+
self._pressed_close_bmp = self._active_close_bmp
|
|
151
|
+
|
|
152
|
+
self._active_left_bmp = BitmapFromBits(nb_left_bits, 16, 16, active_colour)
|
|
153
|
+
self._disabled_left_bmp = BitmapFromBits(nb_left_bits, 16, 16, disabled_colour)
|
|
154
|
+
|
|
155
|
+
self._active_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, active_colour)
|
|
156
|
+
self._disabled_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, disabled_colour)
|
|
157
|
+
|
|
158
|
+
self._active_windowlist_bmp = BitmapFromBits(nb_list_bits, 16, 16, active_colour)
|
|
159
|
+
self._disabled_windowlist_bmp = BitmapFromBits(nb_list_bits, 16, 16, disabled_colour)
|
|
160
|
+
|
|
161
|
+
if wx.Platform == "__WXMAC__":
|
|
162
|
+
k = Carbon.Appearance.kThemeBrushFocusHighlight if CARBON else 19
|
|
163
|
+
# Get proper highlight colour for focus rectangle from the
|
|
164
|
+
# current Mac theme. kThemeBrushFocusHighlight is
|
|
165
|
+
# available on Mac OS 8.5 and higher
|
|
166
|
+
if hasattr(wx, 'MacThemeColour'):
|
|
167
|
+
c = wx.MacThemeColour(k)
|
|
168
|
+
else:
|
|
169
|
+
brush = wx.Brush(active_colour)
|
|
170
|
+
brush.MacSetTheme(k)
|
|
171
|
+
c = brush.GetColour()
|
|
172
|
+
self._focusPen = wx.Pen(c, 2, wx.PENSTYLE_SOLID)
|
|
173
|
+
else:
|
|
174
|
+
self._focusPen = wx.Pen(active_colour, 1, wx.PENSTYLE_USER_DASH)
|
|
175
|
+
self._focusPen.SetDashes([1, 1])
|
|
176
|
+
self._focusPen.SetCap(wx.CAP_BUTT)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def SetBaseColour(self, base_colour):
|
|
180
|
+
"""
|
|
181
|
+
Sets a new base colour.
|
|
182
|
+
|
|
183
|
+
:param `base_colour`: an instance of :class:`wx.Colour`.
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
self._base_colour = base_colour
|
|
187
|
+
self._base_colour_pen = wx.Pen(self._base_colour)
|
|
188
|
+
self._base_colour_brush = wx.Brush(self._base_colour)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def SetDefaultColours(self, base_colour=None):
|
|
192
|
+
"""
|
|
193
|
+
Sets the default colours, which are calculated from the given base colour.
|
|
194
|
+
|
|
195
|
+
:param `base_colour`: an instance of :class:`wx.Colour`. If defaulted to ``None``, a colour
|
|
196
|
+
is generated accordingly to the platform and theme.
|
|
197
|
+
"""
|
|
198
|
+
|
|
199
|
+
if base_colour is None:
|
|
200
|
+
base_colour = GetBaseColour()
|
|
201
|
+
|
|
202
|
+
self.SetBaseColour(base_colour)
|
|
203
|
+
self._border_colour = StepColour(base_colour, 75)
|
|
204
|
+
self._border_pen = wx.Pen(self._border_colour)
|
|
205
|
+
|
|
206
|
+
self._background_top_colour = StepColour(base_colour, 90)
|
|
207
|
+
self._background_bottom_colour = StepColour(base_colour, 170)
|
|
208
|
+
|
|
209
|
+
self._tab_top_colour = base_colour
|
|
210
|
+
self._tab_bottom_colour = wx.WHITE
|
|
211
|
+
self._tab_gradient_highlight_colour = wx.WHITE
|
|
212
|
+
|
|
213
|
+
self._tab_inactive_top_colour = base_colour
|
|
214
|
+
self._tab_inactive_bottom_colour = StepColour(self._tab_inactive_top_colour, 160)
|
|
215
|
+
|
|
216
|
+
self._tab_text_colour = lambda page: page.text_colour
|
|
217
|
+
self._tab_disabled_text_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def Clone(self):
|
|
221
|
+
""" Clones the art object. """
|
|
222
|
+
|
|
223
|
+
art = type(self)()
|
|
224
|
+
art.SetNormalFont(self.GetNormalFont())
|
|
225
|
+
art.SetSelectedFont(self.GetSelectedFont())
|
|
226
|
+
art.SetMeasuringFont(self.GetMeasuringFont())
|
|
227
|
+
|
|
228
|
+
art = CopyAttributes(art, self)
|
|
229
|
+
return art
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def SetAGWFlags(self, agwFlags):
|
|
233
|
+
"""
|
|
234
|
+
Sets the tab art flags.
|
|
235
|
+
|
|
236
|
+
:param integer `agwFlags`: a combination of the following values:
|
|
237
|
+
|
|
238
|
+
==================================== ==================================
|
|
239
|
+
Flag name Description
|
|
240
|
+
==================================== ==================================
|
|
241
|
+
``AUI_NB_TOP`` With this style, tabs are drawn along the top of the notebook
|
|
242
|
+
``AUI_NB_LEFT`` With this style, tabs are drawn along the left of the notebook. Not implemented yet.
|
|
243
|
+
``AUI_NB_RIGHT`` With this style, tabs are drawn along the right of the notebook. Not implemented yet.
|
|
244
|
+
``AUI_NB_BOTTOM`` With this style, tabs are drawn along the bottom of the notebook
|
|
245
|
+
``AUI_NB_TAB_SPLIT`` Allows the tab control to be split by dragging a tab
|
|
246
|
+
``AUI_NB_TAB_MOVE`` Allows a tab to be moved horizontally by dragging
|
|
247
|
+
``AUI_NB_TAB_EXTERNAL_MOVE`` Allows a tab to be moved to another tab control
|
|
248
|
+
``AUI_NB_TAB_FIXED_WIDTH`` With this style, all tabs have the same width
|
|
249
|
+
``AUI_NB_SCROLL_BUTTONS`` With this style, left and right scroll buttons are displayed
|
|
250
|
+
``AUI_NB_WINDOWLIST_BUTTON`` With this style, a drop-down list of windows is available
|
|
251
|
+
``AUI_NB_CLOSE_BUTTON`` With this style, a close button is available on the tab bar
|
|
252
|
+
``AUI_NB_CLOSE_ON_ACTIVE_TAB`` With this style, a close button is available on the active tab
|
|
253
|
+
``AUI_NB_CLOSE_ON_ALL_TABS`` With this style, a close button is available on all tabs
|
|
254
|
+
``AUI_NB_MIDDLE_CLICK_CLOSE`` Allows to close :class:`~wx.lib.agw.aui.auibook.AuiNotebook` tabs by mouse middle button click
|
|
255
|
+
``AUI_NB_SUB_NOTEBOOK`` This style is used by :class:`~wx.lib.agw.aui.framemanager.AuiManager` to create automatic AuiNotebooks
|
|
256
|
+
``AUI_NB_HIDE_ON_SINGLE_TAB`` Hides the tab window if only one tab is present
|
|
257
|
+
``AUI_NB_SMART_TABS`` Use Smart Tabbing, like ``Alt`` + ``Tab`` on Windows
|
|
258
|
+
``AUI_NB_USE_IMAGES_DROPDOWN`` Uses images on dropdown window list menu instead of check items
|
|
259
|
+
``AUI_NB_CLOSE_ON_TAB_LEFT`` Draws the tab close button on the left instead of on the right (a la Camino browser)
|
|
260
|
+
``AUI_NB_TAB_FLOAT`` Allows the floating of single tabs. Known limitation: when the notebook is more or less
|
|
261
|
+
full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
|
|
262
|
+
``AUI_NB_DRAW_DND_TAB`` Draws an image representation of a tab while dragging (on by default)
|
|
263
|
+
``AUI_NB_ORDER_BY_ACCESS`` Tab navigation order by last access time for the tabs
|
|
264
|
+
``AUI_NB_NO_TAB_FOCUS`` Don't draw tab focus rectangle
|
|
265
|
+
==================================== ==================================
|
|
266
|
+
|
|
267
|
+
"""
|
|
268
|
+
|
|
269
|
+
self._agwFlags = agwFlags
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def GetAGWFlags(self):
|
|
273
|
+
"""
|
|
274
|
+
Returns the tab art flags.
|
|
275
|
+
|
|
276
|
+
:see: :meth:`~AuiDefaultTabArt.SetAGWFlags` for a list of possible return values.
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
return self._agwFlags
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def SetSizingInfo(self, tab_ctrl_size, tab_count, minMaxTabWidth):
|
|
283
|
+
"""
|
|
284
|
+
Sets the tab sizing information.
|
|
285
|
+
|
|
286
|
+
:param wx.Size `tab_ctrl_size`: the size of the tab control area;
|
|
287
|
+
:param integer `tab_count`: the number of tabs;
|
|
288
|
+
:param tuple `minMaxTabWidth`: a tuple containing the minimum and maximum tab widths
|
|
289
|
+
to be used when the ``AUI_NB_TAB_FIXED_WIDTH`` style is active.
|
|
290
|
+
"""
|
|
291
|
+
|
|
292
|
+
self._fixed_tab_width = 100
|
|
293
|
+
minTabWidth, maxTabWidth = minMaxTabWidth
|
|
294
|
+
|
|
295
|
+
tot_width = tab_ctrl_size.x - self.GetIndentSize() - 4
|
|
296
|
+
agwFlags = self.GetAGWFlags()
|
|
297
|
+
|
|
298
|
+
if agwFlags & AUI_NB_CLOSE_BUTTON:
|
|
299
|
+
tot_width -= self._active_close_bmp.GetWidth()
|
|
300
|
+
if agwFlags & AUI_NB_WINDOWLIST_BUTTON:
|
|
301
|
+
tot_width -= self._active_windowlist_bmp.GetWidth()
|
|
302
|
+
|
|
303
|
+
if tab_count > 0:
|
|
304
|
+
self._fixed_tab_width = tot_width//tab_count
|
|
305
|
+
|
|
306
|
+
if self._fixed_tab_width < 100:
|
|
307
|
+
self._fixed_tab_width = 100
|
|
308
|
+
|
|
309
|
+
if self._fixed_tab_width > tot_width//2:
|
|
310
|
+
self._fixed_tab_width = tot_width//2
|
|
311
|
+
|
|
312
|
+
if self._fixed_tab_width > 220:
|
|
313
|
+
self._fixed_tab_width = 220
|
|
314
|
+
|
|
315
|
+
if minTabWidth > -1:
|
|
316
|
+
self._fixed_tab_width = max(self._fixed_tab_width, minTabWidth)
|
|
317
|
+
if maxTabWidth > -1:
|
|
318
|
+
self._fixed_tab_width = min(self._fixed_tab_width, maxTabWidth)
|
|
319
|
+
|
|
320
|
+
self._tab_ctrl_height = tab_ctrl_size.y
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def DrawBackground(self, dc, wnd, rect):
|
|
324
|
+
"""
|
|
325
|
+
Draws the tab area background.
|
|
326
|
+
|
|
327
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
328
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
329
|
+
:param wx.Rect `rect`: the tab control rectangle.
|
|
330
|
+
"""
|
|
331
|
+
|
|
332
|
+
self._buttonRect = wx.Rect()
|
|
333
|
+
|
|
334
|
+
# draw background
|
|
335
|
+
agwFlags = self.GetAGWFlags()
|
|
336
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
337
|
+
r = wx.Rect(rect.x, rect.y, rect.width+2, rect.height)
|
|
338
|
+
|
|
339
|
+
# TODO: else if (agwFlags & AUI_NB_LEFT)
|
|
340
|
+
# TODO: else if (agwFlags & AUI_NB_RIGHT)
|
|
341
|
+
else: #for AUI_NB_TOP
|
|
342
|
+
r = wx.Rect(rect.x, rect.y, rect.width+2, rect.height-3)
|
|
343
|
+
|
|
344
|
+
dc.GradientFillLinear(r, self._background_top_colour, self._background_bottom_colour, wx.SOUTH)
|
|
345
|
+
|
|
346
|
+
# draw base lines
|
|
347
|
+
|
|
348
|
+
dc.SetPen(self._border_pen)
|
|
349
|
+
y = rect.GetHeight()
|
|
350
|
+
w = rect.GetWidth()
|
|
351
|
+
|
|
352
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
353
|
+
dc.SetBrush(wx.Brush(self._background_bottom_colour))
|
|
354
|
+
dc.DrawRectangle(-1, 0, w+2, 4)
|
|
355
|
+
|
|
356
|
+
# TODO: else if (agwFlags & AUI_NB_LEFT)
|
|
357
|
+
# TODO: else if (agwFlags & AUI_NB_RIGHT)
|
|
358
|
+
|
|
359
|
+
else: # for AUI_NB_TOP
|
|
360
|
+
dc.SetBrush(self._base_colour_brush)
|
|
361
|
+
dc.DrawRectangle(-1, y-4, w+2, 4)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=False):
|
|
365
|
+
"""
|
|
366
|
+
Draws a single tab.
|
|
367
|
+
|
|
368
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
369
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
370
|
+
:param `page`: the tab control page associated with the tab;
|
|
371
|
+
:param wx.Rect `in_rect`: rectangle the tab should be confined to;
|
|
372
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
373
|
+
:param bool `paint_control`: whether to draw the control inside a tab (if any) on a :class:`MemoryDC`.
|
|
374
|
+
"""
|
|
375
|
+
|
|
376
|
+
# if the caption is empty, measure some temporary text
|
|
377
|
+
caption = page.caption
|
|
378
|
+
if not caption:
|
|
379
|
+
caption = "Xj"
|
|
380
|
+
|
|
381
|
+
dc.SetFont(self._selected_font)
|
|
382
|
+
selected_textx, selected_texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
383
|
+
|
|
384
|
+
dc.SetFont(self._normal_font)
|
|
385
|
+
normal_textx, normal_texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
386
|
+
|
|
387
|
+
control = page.control
|
|
388
|
+
|
|
389
|
+
# figure out the size of the tab
|
|
390
|
+
tab_size, x_extent = self.GetTabSize(dc, wnd, page.caption, page.bitmap,
|
|
391
|
+
page.active, close_button_state, control)
|
|
392
|
+
|
|
393
|
+
tab_height = self._tab_ctrl_height - 3
|
|
394
|
+
tab_width = tab_size[0]
|
|
395
|
+
tab_x = in_rect.x
|
|
396
|
+
tab_y = in_rect.y + in_rect.height - tab_height
|
|
397
|
+
|
|
398
|
+
caption = page.caption
|
|
399
|
+
|
|
400
|
+
# select pen, brush and font for the tab to be drawn
|
|
401
|
+
|
|
402
|
+
if page.active:
|
|
403
|
+
|
|
404
|
+
dc.SetFont(self._selected_font)
|
|
405
|
+
textx, texty = selected_textx, selected_texty
|
|
406
|
+
|
|
407
|
+
else:
|
|
408
|
+
|
|
409
|
+
dc.SetFont(self._normal_font)
|
|
410
|
+
textx, texty = normal_textx, normal_texty
|
|
411
|
+
|
|
412
|
+
if not page.enabled:
|
|
413
|
+
dc.SetTextForeground(self._tab_disabled_text_colour)
|
|
414
|
+
pagebitmap = page.dis_bitmap
|
|
415
|
+
else:
|
|
416
|
+
dc.SetTextForeground(self._tab_text_colour(page))
|
|
417
|
+
pagebitmap = page.bitmap
|
|
418
|
+
|
|
419
|
+
# create points that will make the tab outline
|
|
420
|
+
|
|
421
|
+
clip_width = tab_width
|
|
422
|
+
if tab_x + clip_width > in_rect.x + in_rect.width:
|
|
423
|
+
clip_width = in_rect.x + in_rect.width - tab_x
|
|
424
|
+
|
|
425
|
+
# since the above code above doesn't play well with WXDFB or WXCOCOA,
|
|
426
|
+
# we'll just use a rectangle for the clipping region for now --
|
|
427
|
+
dc.SetClippingRegion(tab_x, tab_y, clip_width+1, tab_height-3)
|
|
428
|
+
|
|
429
|
+
agwFlags = self.GetAGWFlags()
|
|
430
|
+
|
|
431
|
+
wxPoint = wx.Point # local opt
|
|
432
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
433
|
+
|
|
434
|
+
border_points = [wxPoint(tab_x, tab_y),
|
|
435
|
+
wxPoint(tab_x, tab_y+tab_height-6),
|
|
436
|
+
wxPoint(tab_x+2, tab_y+tab_height-4),
|
|
437
|
+
wxPoint(tab_x+tab_width-2, tab_y+tab_height-4),
|
|
438
|
+
wxPoint(tab_x+tab_width, tab_y+tab_height-6),
|
|
439
|
+
wxPoint(tab_x+tab_width, tab_y)]
|
|
440
|
+
|
|
441
|
+
else: #if (agwFlags & AUI_NB_TOP)
|
|
442
|
+
|
|
443
|
+
border_points = [wxPoint(tab_x, tab_y+tab_height-4),
|
|
444
|
+
wxPoint(tab_x, tab_y+2),
|
|
445
|
+
wxPoint(tab_x+2, tab_y),
|
|
446
|
+
wxPoint(tab_x+tab_width-2, tab_y),
|
|
447
|
+
wxPoint(tab_x+tab_width, tab_y+2),
|
|
448
|
+
wxPoint(tab_x+tab_width, tab_y+tab_height-4)]
|
|
449
|
+
|
|
450
|
+
# TODO: else if (agwFlags & AUI_NB_LEFT)
|
|
451
|
+
# TODO: else if (agwFlags & AUI_NB_RIGHT)
|
|
452
|
+
|
|
453
|
+
drawn_tab_yoff = border_points[1].y
|
|
454
|
+
drawn_tab_height = border_points[0].y - border_points[1].y
|
|
455
|
+
|
|
456
|
+
if page.active:
|
|
457
|
+
|
|
458
|
+
# draw active tab
|
|
459
|
+
|
|
460
|
+
# draw base background colour
|
|
461
|
+
r = wx.Rect(tab_x, tab_y, tab_width, tab_height)
|
|
462
|
+
dc.SetPen(self._base_colour_pen)
|
|
463
|
+
dc.SetBrush(self._base_colour_brush)
|
|
464
|
+
dc.DrawRectangle(r.x+1, r.y+1, r.width-1, r.height-4)
|
|
465
|
+
|
|
466
|
+
# this white helps fill out the gradient at the top of the tab
|
|
467
|
+
dc.SetPen( wx.Pen(self._tab_gradient_highlight_colour) )
|
|
468
|
+
dc.SetBrush( wx.Brush(self._tab_gradient_highlight_colour) )
|
|
469
|
+
dc.DrawRectangle(r.x+2, r.y+1, r.width-3, r.height-4)
|
|
470
|
+
|
|
471
|
+
# these two points help the rounded corners appear more antialiased
|
|
472
|
+
dc.SetPen(self._base_colour_pen)
|
|
473
|
+
dc.DrawPoint(r.x+2, r.y+1)
|
|
474
|
+
dc.DrawPoint(r.x+r.width-2, r.y+1)
|
|
475
|
+
|
|
476
|
+
# set rectangle down a bit for gradient drawing
|
|
477
|
+
r.SetHeight(r.GetHeight()//2)
|
|
478
|
+
r.x += 2
|
|
479
|
+
r.width -= 2
|
|
480
|
+
r.y += r.height
|
|
481
|
+
r.y -= 2
|
|
482
|
+
|
|
483
|
+
# draw gradient background
|
|
484
|
+
top_colour = self._tab_bottom_colour
|
|
485
|
+
bottom_colour = self._tab_top_colour
|
|
486
|
+
dc.GradientFillLinear(r, bottom_colour, top_colour, wx.NORTH)
|
|
487
|
+
|
|
488
|
+
else:
|
|
489
|
+
|
|
490
|
+
# draw inactive tab
|
|
491
|
+
|
|
492
|
+
r = wx.Rect(tab_x, tab_y+1, tab_width, tab_height-3)
|
|
493
|
+
|
|
494
|
+
# start the gradent up a bit and leave the inside border inset
|
|
495
|
+
# by a pixel for a 3D look. Only the top half of the inactive
|
|
496
|
+
# tab will have a slight gradient
|
|
497
|
+
r.x += 3
|
|
498
|
+
r.y += 1
|
|
499
|
+
r.width -= 4
|
|
500
|
+
r.height //= 2
|
|
501
|
+
r.height -= 1
|
|
502
|
+
|
|
503
|
+
# -- draw top gradient fill for glossy look
|
|
504
|
+
top_colour = self._tab_inactive_top_colour
|
|
505
|
+
bottom_colour = self._tab_inactive_bottom_colour
|
|
506
|
+
dc.GradientFillLinear(r, bottom_colour, top_colour, wx.NORTH)
|
|
507
|
+
|
|
508
|
+
r.y += r.height
|
|
509
|
+
r.y -= 1
|
|
510
|
+
|
|
511
|
+
# -- draw bottom fill for glossy look
|
|
512
|
+
top_colour = self._tab_inactive_bottom_colour
|
|
513
|
+
bottom_colour = self._tab_inactive_bottom_colour
|
|
514
|
+
dc.GradientFillLinear(r, top_colour, bottom_colour, wx.SOUTH)
|
|
515
|
+
|
|
516
|
+
# draw tab outline
|
|
517
|
+
dc.SetPen(self._border_pen)
|
|
518
|
+
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
|
519
|
+
dc.DrawPolygon(border_points)
|
|
520
|
+
|
|
521
|
+
# there are two horizontal grey lines at the bottom of the tab control,
|
|
522
|
+
# this gets rid of the top one of those lines in the tab control
|
|
523
|
+
if page.active:
|
|
524
|
+
|
|
525
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
526
|
+
dc.SetPen(wx.Pen(self._background_bottom_colour))
|
|
527
|
+
|
|
528
|
+
# TODO: else if (agwFlags & AUI_NB_LEFT)
|
|
529
|
+
# TODO: else if (agwFlags & AUI_NB_RIGHT)
|
|
530
|
+
else: # for AUI_NB_TOP
|
|
531
|
+
dc.SetPen(self._base_colour_pen)
|
|
532
|
+
|
|
533
|
+
dc.DrawLine(border_points[0].x+1,
|
|
534
|
+
border_points[0].y,
|
|
535
|
+
border_points[5].x,
|
|
536
|
+
border_points[5].y)
|
|
537
|
+
|
|
538
|
+
text_offset = tab_x + 8
|
|
539
|
+
close_button_width = 0
|
|
540
|
+
|
|
541
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
542
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
543
|
+
|
|
544
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
545
|
+
text_offset += close_button_width - 5
|
|
546
|
+
|
|
547
|
+
bitmap_offset = 0
|
|
548
|
+
|
|
549
|
+
if pagebitmap.IsOk():
|
|
550
|
+
|
|
551
|
+
bitmap_offset = tab_x + 8
|
|
552
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT and close_button_width:
|
|
553
|
+
bitmap_offset += close_button_width - 5
|
|
554
|
+
|
|
555
|
+
# draw bitmap
|
|
556
|
+
dc.DrawBitmap(pagebitmap,
|
|
557
|
+
bitmap_offset,
|
|
558
|
+
drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2),
|
|
559
|
+
True)
|
|
560
|
+
|
|
561
|
+
text_offset = bitmap_offset + pagebitmap.GetWidth()
|
|
562
|
+
text_offset += 3 # bitmap padding
|
|
563
|
+
|
|
564
|
+
else:
|
|
565
|
+
|
|
566
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT == 0 or not close_button_width:
|
|
567
|
+
text_offset = tab_x + 8
|
|
568
|
+
|
|
569
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width)
|
|
570
|
+
|
|
571
|
+
ypos = drawn_tab_yoff + (drawn_tab_height)//2 - (texty//2) - 1
|
|
572
|
+
|
|
573
|
+
offset_focus = text_offset
|
|
574
|
+
if control:
|
|
575
|
+
if control.GetPosition() != wxPoint(text_offset+1, ypos):
|
|
576
|
+
control.SetPosition(wxPoint(text_offset+1, ypos))
|
|
577
|
+
|
|
578
|
+
if not control.IsShown():
|
|
579
|
+
control.Show()
|
|
580
|
+
|
|
581
|
+
if paint_control:
|
|
582
|
+
bmp = TakeScreenShot(control.GetScreenRect())
|
|
583
|
+
dc.DrawBitmap(bmp, text_offset+1, ypos, True)
|
|
584
|
+
|
|
585
|
+
controlW, controlH = control.GetSize()
|
|
586
|
+
text_offset += controlW + 4
|
|
587
|
+
textx += controlW + 4
|
|
588
|
+
|
|
589
|
+
# draw tab text
|
|
590
|
+
rectx, recty, dummy = dc.GetFullMultiLineTextExtent(draw_text)
|
|
591
|
+
dc.DrawLabel(draw_text, wx.Rect(text_offset, ypos, rectx, recty))
|
|
592
|
+
|
|
593
|
+
# draw focus rectangle
|
|
594
|
+
if (agwFlags & AUI_NB_NO_TAB_FOCUS) == 0:
|
|
595
|
+
self.DrawFocusRectangle(dc, page, wnd, draw_text, offset_focus, bitmap_offset, drawn_tab_yoff, drawn_tab_height, rectx, recty)
|
|
596
|
+
|
|
597
|
+
out_button_rect = wx.Rect()
|
|
598
|
+
|
|
599
|
+
# draw close button if necessary
|
|
600
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
601
|
+
|
|
602
|
+
bmp = self._disabled_close_bmp
|
|
603
|
+
|
|
604
|
+
if close_button_state == AUI_BUTTON_STATE_HOVER:
|
|
605
|
+
bmp = self._hover_close_bmp
|
|
606
|
+
elif close_button_state == AUI_BUTTON_STATE_PRESSED:
|
|
607
|
+
bmp = self._pressed_close_bmp
|
|
608
|
+
|
|
609
|
+
shift = (agwFlags & AUI_NB_BOTTOM and [1] or [0])[0]
|
|
610
|
+
|
|
611
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
612
|
+
rect = wx.Rect(tab_x + 4, tab_y + (tab_height - bmp.GetHeight())//2 - shift,
|
|
613
|
+
close_button_width, tab_height)
|
|
614
|
+
else:
|
|
615
|
+
rect = wx.Rect(tab_x + tab_width - close_button_width - 1,
|
|
616
|
+
tab_y + (tab_height - bmp.GetHeight())//2 - shift,
|
|
617
|
+
close_button_width, tab_height)
|
|
618
|
+
|
|
619
|
+
rect = IndentPressedBitmap(rect, close_button_state)
|
|
620
|
+
dc.DrawBitmap(bmp, rect.x, rect.y, True)
|
|
621
|
+
|
|
622
|
+
out_button_rect = rect
|
|
623
|
+
|
|
624
|
+
out_tab_rect = wx.Rect(tab_x, tab_y, tab_width, tab_height)
|
|
625
|
+
|
|
626
|
+
dc.DestroyClippingRegion()
|
|
627
|
+
|
|
628
|
+
return out_tab_rect, out_button_rect, x_extent
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
def SetCustomButton(self, bitmap_id, button_state, bmp):
|
|
632
|
+
"""
|
|
633
|
+
Sets a custom bitmap for the close, left, right and window list buttons.
|
|
634
|
+
|
|
635
|
+
:param integer `bitmap_id`: the button identifier;
|
|
636
|
+
:param integer `button_state`: the button state;
|
|
637
|
+
:param wx.Bitmap `bmp`: the custom bitmap to use for the button.
|
|
638
|
+
"""
|
|
639
|
+
|
|
640
|
+
if bitmap_id == AUI_BUTTON_CLOSE:
|
|
641
|
+
if button_state == AUI_BUTTON_STATE_NORMAL:
|
|
642
|
+
self._active_close_bmp = bmp
|
|
643
|
+
self._hover_close_bmp = self._active_close_bmp
|
|
644
|
+
self._pressed_close_bmp = self._active_close_bmp
|
|
645
|
+
self._disabled_close_bmp = self._active_close_bmp
|
|
646
|
+
|
|
647
|
+
elif button_state == AUI_BUTTON_STATE_HOVER:
|
|
648
|
+
self._hover_close_bmp = bmp
|
|
649
|
+
elif button_state == AUI_BUTTON_STATE_PRESSED:
|
|
650
|
+
self._pressed_close_bmp = bmp
|
|
651
|
+
else:
|
|
652
|
+
self._disabled_close_bmp = bmp
|
|
653
|
+
|
|
654
|
+
elif bitmap_id == AUI_BUTTON_LEFT:
|
|
655
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
656
|
+
self._disabled_left_bmp = bmp
|
|
657
|
+
else:
|
|
658
|
+
self._active_left_bmp = bmp
|
|
659
|
+
|
|
660
|
+
elif bitmap_id == AUI_BUTTON_RIGHT:
|
|
661
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
662
|
+
self._disabled_right_bmp = bmp
|
|
663
|
+
else:
|
|
664
|
+
self._active_right_bmp = bmp
|
|
665
|
+
|
|
666
|
+
elif bitmap_id == AUI_BUTTON_WINDOWLIST:
|
|
667
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
668
|
+
self._disabled_windowlist_bmp = bmp
|
|
669
|
+
else:
|
|
670
|
+
self._active_windowlist_bmp = bmp
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
def GetIndentSize(self):
|
|
674
|
+
""" Returns the tabs indent size. """
|
|
675
|
+
|
|
676
|
+
return 5
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
def GetTabSize(self, dc, wnd, caption, bitmap, active, close_button_state, control=None):
|
|
680
|
+
"""
|
|
681
|
+
Returns the tab size for the given caption, bitmap and button state.
|
|
682
|
+
|
|
683
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
684
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
685
|
+
:param string `caption`: the tab text caption;
|
|
686
|
+
:param wx.Bitmap `bitmap`: the bitmap displayed on the tab;
|
|
687
|
+
:param bool `active`: whether the tab is selected or not;
|
|
688
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
689
|
+
:param wx.Window `control`: a :class:`wx.Window` instance inside a tab (or ``None``).
|
|
690
|
+
"""
|
|
691
|
+
|
|
692
|
+
dc.SetFont(self._measuring_font)
|
|
693
|
+
measured_textx, measured_texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
694
|
+
|
|
695
|
+
# add padding around the text
|
|
696
|
+
tab_width = measured_textx
|
|
697
|
+
tab_height = measured_texty
|
|
698
|
+
|
|
699
|
+
# if the close button is showing, add space for it
|
|
700
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
701
|
+
tab_width += self._active_close_bmp.GetWidth() + 3
|
|
702
|
+
|
|
703
|
+
# if there's a bitmap, add space for it
|
|
704
|
+
if bitmap.IsOk():
|
|
705
|
+
tab_width += bitmap.GetWidth()
|
|
706
|
+
tab_width += 3 # right side bitmap padding
|
|
707
|
+
tab_height = max(tab_height, bitmap.GetHeight())
|
|
708
|
+
|
|
709
|
+
# add padding
|
|
710
|
+
tab_width += 16
|
|
711
|
+
tab_height += 10
|
|
712
|
+
|
|
713
|
+
agwFlags = self.GetAGWFlags()
|
|
714
|
+
if agwFlags & AUI_NB_TAB_FIXED_WIDTH:
|
|
715
|
+
tab_width = self._fixed_tab_width
|
|
716
|
+
|
|
717
|
+
if control:
|
|
718
|
+
tab_width += control.GetSize().GetWidth() + 4
|
|
719
|
+
|
|
720
|
+
x_extent = tab_width
|
|
721
|
+
|
|
722
|
+
return (tab_width, tab_height), x_extent
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
def DrawButton(self, dc, wnd, in_rect, button, orientation):
|
|
726
|
+
"""
|
|
727
|
+
Draws a button on the tab or on the tab area, depending on the button identifier.
|
|
728
|
+
|
|
729
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
730
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
731
|
+
:param wx.Rect `in_rect`: rectangle the tab should be confined to;
|
|
732
|
+
:param `button`: an instance of the button class;
|
|
733
|
+
:param integer `orientation`: the tab orientation.
|
|
734
|
+
"""
|
|
735
|
+
|
|
736
|
+
bitmap_id, button_state = button.id, button.cur_state
|
|
737
|
+
|
|
738
|
+
if bitmap_id == AUI_BUTTON_CLOSE:
|
|
739
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
740
|
+
bmp = self._disabled_close_bmp
|
|
741
|
+
elif button_state & AUI_BUTTON_STATE_HOVER:
|
|
742
|
+
bmp = self._hover_close_bmp
|
|
743
|
+
elif button_state & AUI_BUTTON_STATE_PRESSED:
|
|
744
|
+
bmp = self._pressed_close_bmp
|
|
745
|
+
else:
|
|
746
|
+
bmp = self._active_close_bmp
|
|
747
|
+
|
|
748
|
+
elif bitmap_id == AUI_BUTTON_LEFT:
|
|
749
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
750
|
+
bmp = self._disabled_left_bmp
|
|
751
|
+
else:
|
|
752
|
+
bmp = self._active_left_bmp
|
|
753
|
+
|
|
754
|
+
elif bitmap_id == AUI_BUTTON_RIGHT:
|
|
755
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
756
|
+
bmp = self._disabled_right_bmp
|
|
757
|
+
else:
|
|
758
|
+
bmp = self._active_right_bmp
|
|
759
|
+
|
|
760
|
+
elif bitmap_id == AUI_BUTTON_WINDOWLIST:
|
|
761
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
762
|
+
bmp = self._disabled_windowlist_bmp
|
|
763
|
+
else:
|
|
764
|
+
bmp = self._active_windowlist_bmp
|
|
765
|
+
|
|
766
|
+
else:
|
|
767
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
768
|
+
bmp = button.dis_bitmap
|
|
769
|
+
else:
|
|
770
|
+
bmp = button.bitmap
|
|
771
|
+
|
|
772
|
+
if not bmp.IsOk():
|
|
773
|
+
return
|
|
774
|
+
|
|
775
|
+
rect = wx.Rect(*in_rect)
|
|
776
|
+
|
|
777
|
+
if orientation == wx.LEFT:
|
|
778
|
+
|
|
779
|
+
rect.SetX(in_rect.x)
|
|
780
|
+
rect.SetY(((in_rect.y + in_rect.height)//2) - (bmp.GetHeight()//2))
|
|
781
|
+
rect.SetWidth(bmp.GetWidth())
|
|
782
|
+
rect.SetHeight(bmp.GetHeight())
|
|
783
|
+
|
|
784
|
+
else:
|
|
785
|
+
|
|
786
|
+
rect = wx.Rect(in_rect.x + in_rect.width - bmp.GetWidth(),
|
|
787
|
+
((in_rect.y + in_rect.height)//2) - (bmp.GetHeight()//2),
|
|
788
|
+
bmp.GetWidth(), bmp.GetHeight())
|
|
789
|
+
|
|
790
|
+
rect = IndentPressedBitmap(rect, button_state)
|
|
791
|
+
dc.DrawBitmap(bmp, rect.x, rect.y, True)
|
|
792
|
+
|
|
793
|
+
out_rect = rect
|
|
794
|
+
|
|
795
|
+
if bitmap_id == AUI_BUTTON_RIGHT:
|
|
796
|
+
self._buttonRect = wx.Rect(rect.x, rect.y, 30, rect.height)
|
|
797
|
+
|
|
798
|
+
return out_rect
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
def DrawFocusRectangle(self, dc, page, wnd, draw_text, text_offset, bitmap_offset, drawn_tab_yoff, drawn_tab_height, textx, texty):
|
|
802
|
+
"""
|
|
803
|
+
Draws the focus rectangle on a tab.
|
|
804
|
+
|
|
805
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
806
|
+
:param `page`: the page associated with the tab;
|
|
807
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
808
|
+
:param string `draw_text`: the text that has been drawn on the tab;
|
|
809
|
+
:param integer `text_offset`: the text offset on the tab;
|
|
810
|
+
:param integer `bitmap_offset`: the bitmap offset on the tab;
|
|
811
|
+
:param integer `drawn_tab_yoff`: the y offset of the tab text;
|
|
812
|
+
:param integer `drawn_tab_height`: the height of the tab;
|
|
813
|
+
:param integer `textx`: the x text extent;
|
|
814
|
+
:param integer `texty`: the y text extent.
|
|
815
|
+
"""
|
|
816
|
+
|
|
817
|
+
if self.GetAGWFlags() & AUI_NB_NO_TAB_FOCUS:
|
|
818
|
+
return
|
|
819
|
+
|
|
820
|
+
if page.active and wx.Window.FindFocus() == wnd:
|
|
821
|
+
|
|
822
|
+
focusRectText = wx.Rect(text_offset, (drawn_tab_yoff + (drawn_tab_height)//2 - (texty//2)),
|
|
823
|
+
textx, texty)
|
|
824
|
+
|
|
825
|
+
if page.bitmap.IsOk():
|
|
826
|
+
focusRectBitmap = wx.Rect(bitmap_offset, drawn_tab_yoff + (drawn_tab_height//2) - (page.bitmap.GetHeight()//2),
|
|
827
|
+
page.bitmap.GetWidth(), page.bitmap.GetHeight())
|
|
828
|
+
|
|
829
|
+
if page.bitmap.IsOk() and draw_text == "":
|
|
830
|
+
focusRect = wx.Rect(*focusRectBitmap)
|
|
831
|
+
elif not page.bitmap.IsOk() and draw_text != "":
|
|
832
|
+
focusRect = wx.Rect(*focusRectText)
|
|
833
|
+
elif page.bitmap.IsOk() and draw_text != "":
|
|
834
|
+
focusRect = focusRectText.Union(focusRectBitmap)
|
|
835
|
+
|
|
836
|
+
focusRect.Inflate(2, 2)
|
|
837
|
+
|
|
838
|
+
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
|
839
|
+
dc.SetPen(self._focusPen)
|
|
840
|
+
dc.DrawRoundedRectangle(focusRect, 2)
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
def GetBestTabCtrlSize(self, wnd, pages, required_bmp_size):
|
|
844
|
+
"""
|
|
845
|
+
Returns the best tab control size.
|
|
846
|
+
|
|
847
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
848
|
+
:param list `pages`: the pages associated with the tabs;
|
|
849
|
+
:param wx.Size `required_bmp_size`: the size of the bitmap on the tabs.
|
|
850
|
+
"""
|
|
851
|
+
|
|
852
|
+
dc = wx.ClientDC(wnd)
|
|
853
|
+
dc.SetFont(self._measuring_font)
|
|
854
|
+
|
|
855
|
+
# sometimes a standard bitmap size needs to be enforced, especially
|
|
856
|
+
# if some tabs have bitmaps and others don't. This is important because
|
|
857
|
+
# it prevents the tab control from resizing when tabs are added.
|
|
858
|
+
|
|
859
|
+
measure_bmp = wx.NullBitmap
|
|
860
|
+
|
|
861
|
+
if required_bmp_size.IsFullySpecified():
|
|
862
|
+
measure_bmp = wx.Bitmap(required_bmp_size.x, required_bmp_size.y)
|
|
863
|
+
|
|
864
|
+
max_y = 0
|
|
865
|
+
|
|
866
|
+
self_GetTabSize = self.GetTabSize # local opt
|
|
867
|
+
measure_bmp_isok = measure_bmp.IsOk()
|
|
868
|
+
for page in pages:
|
|
869
|
+
|
|
870
|
+
if not measure_bmp_isok:
|
|
871
|
+
bmp = page.bitmap
|
|
872
|
+
|
|
873
|
+
# we don't use the caption text because we don't
|
|
874
|
+
# want tab heights to be different in the case
|
|
875
|
+
# of a very short piece of text on one tab and a very
|
|
876
|
+
# tall piece of text on another tab
|
|
877
|
+
s, x_ext = self_GetTabSize(dc, wnd, page.caption, bmp, True, AUI_BUTTON_STATE_HIDDEN, None)
|
|
878
|
+
max_y = max(max_y, s[1])
|
|
879
|
+
|
|
880
|
+
if page.control:
|
|
881
|
+
controlW, controlH = page.control.GetSize()
|
|
882
|
+
max_y = max(max_y, controlH+4)
|
|
883
|
+
|
|
884
|
+
return max_y + 2
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
def SetNormalFont(self, font):
|
|
888
|
+
"""
|
|
889
|
+
Sets the normal font for drawing tab labels.
|
|
890
|
+
|
|
891
|
+
:param wx.Font `font`: the new font to use to draw tab labels in their normal, un-selected state.
|
|
892
|
+
"""
|
|
893
|
+
|
|
894
|
+
self._normal_font = font
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
def SetSelectedFont(self, font):
|
|
898
|
+
"""
|
|
899
|
+
Sets the selected tab font for drawing tab labels.
|
|
900
|
+
|
|
901
|
+
:param wx.Font `font`: the new font to use to draw tab labels in their selected state.
|
|
902
|
+
"""
|
|
903
|
+
|
|
904
|
+
self._selected_font = font
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
def SetMeasuringFont(self, font):
|
|
908
|
+
"""
|
|
909
|
+
Sets the font for calculating text measurements.
|
|
910
|
+
|
|
911
|
+
:param wx.Font `font`: the new font to use to measure tab labels text extents.
|
|
912
|
+
"""
|
|
913
|
+
|
|
914
|
+
self._measuring_font = font
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
def GetNormalFont(self):
|
|
918
|
+
""" Returns the normal font for drawing tab labels. """
|
|
919
|
+
|
|
920
|
+
return self._normal_font
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
def GetSelectedFont(self):
|
|
924
|
+
""" Returns the selected tab font for drawing tab labels. """
|
|
925
|
+
|
|
926
|
+
return self._selected_font
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
def GetMeasuringFont(self):
|
|
930
|
+
""" Returns the font for calculating text measurements. """
|
|
931
|
+
|
|
932
|
+
return self._measuring_font
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
def ShowDropDown(self, wnd, pages, active_idx):
|
|
936
|
+
"""
|
|
937
|
+
Shows the drop-down window menu on the tab area.
|
|
938
|
+
|
|
939
|
+
:param `wnd`: a :class:`wx.Window` derived window instance;
|
|
940
|
+
:param list `pages`: the pages associated with the tabs;
|
|
941
|
+
:param integer `active_idx`: the active tab index.
|
|
942
|
+
"""
|
|
943
|
+
|
|
944
|
+
useImages = self.GetAGWFlags() & AUI_NB_USE_IMAGES_DROPDOWN
|
|
945
|
+
menuPopup = wx.Menu()
|
|
946
|
+
|
|
947
|
+
longest = 0
|
|
948
|
+
for i, page in enumerate(pages):
|
|
949
|
+
|
|
950
|
+
caption = page.caption
|
|
951
|
+
|
|
952
|
+
# if there is no caption, make it a space. This will prevent
|
|
953
|
+
# an assert in the menu code.
|
|
954
|
+
if caption == "":
|
|
955
|
+
caption = " "
|
|
956
|
+
|
|
957
|
+
# Save longest caption width for calculating menu width with
|
|
958
|
+
width = wnd.GetTextExtent(caption)[0]
|
|
959
|
+
if width > longest:
|
|
960
|
+
longest = width
|
|
961
|
+
|
|
962
|
+
if useImages:
|
|
963
|
+
menuItem = wx.MenuItem(menuPopup, 1000+i, caption)
|
|
964
|
+
if page.bitmap:
|
|
965
|
+
menuItem.SetBitmap(page.bitmap)
|
|
966
|
+
|
|
967
|
+
menuPopup.Append(menuItem)
|
|
968
|
+
|
|
969
|
+
else:
|
|
970
|
+
|
|
971
|
+
menuPopup.AppendCheckItem(1000+i, caption)
|
|
972
|
+
|
|
973
|
+
menuPopup.Enable(1000+i, page.enabled)
|
|
974
|
+
|
|
975
|
+
if active_idx != -1 and not useImages:
|
|
976
|
+
|
|
977
|
+
menuPopup.Check(1000+active_idx, True)
|
|
978
|
+
|
|
979
|
+
cc = AuiCommandCapture()
|
|
980
|
+
wnd.PushEventHandler(cc)
|
|
981
|
+
wnd.PopupMenu(menuPopup)
|
|
982
|
+
command = cc.GetCommandId()
|
|
983
|
+
wnd.PopEventHandler(True)
|
|
984
|
+
|
|
985
|
+
if command >= 1000:
|
|
986
|
+
return command - 1000
|
|
987
|
+
|
|
988
|
+
return -1
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
class AuiSimpleTabArt(object):
|
|
992
|
+
""" A simple-looking implementation of a tab art. """
|
|
993
|
+
|
|
994
|
+
def __init__(self):
|
|
995
|
+
""" Default class constructor. """
|
|
996
|
+
|
|
997
|
+
self._normal_font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
|
|
998
|
+
self._selected_font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
|
|
999
|
+
self._selected_font.SetWeight(wx.FONTWEIGHT_BOLD)
|
|
1000
|
+
self._measuring_font = self._selected_font
|
|
1001
|
+
|
|
1002
|
+
self._agwFlags = 0
|
|
1003
|
+
self._fixed_tab_width = 100
|
|
1004
|
+
|
|
1005
|
+
base_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE)
|
|
1006
|
+
|
|
1007
|
+
background_colour = base_colour
|
|
1008
|
+
normaltab_colour = base_colour
|
|
1009
|
+
selectedtab_colour = wx.WHITE
|
|
1010
|
+
|
|
1011
|
+
self._bkbrush = wx.Brush(background_colour)
|
|
1012
|
+
self._normal_bkbrush = wx.Brush(normaltab_colour)
|
|
1013
|
+
self._normal_bkpen = wx.Pen(normaltab_colour)
|
|
1014
|
+
self._selected_bkbrush = wx.Brush(selectedtab_colour)
|
|
1015
|
+
self._selected_bkpen = wx.Pen(selectedtab_colour)
|
|
1016
|
+
|
|
1017
|
+
self._active_close_bmp = BitmapFromBits(nb_close_bits, 16, 16, wx.BLACK)
|
|
1018
|
+
self._disabled_close_bmp = BitmapFromBits(nb_close_bits, 16, 16, wx.Colour(128, 128, 128))
|
|
1019
|
+
|
|
1020
|
+
self._active_left_bmp = BitmapFromBits(nb_left_bits, 16, 16, wx.BLACK)
|
|
1021
|
+
self._disabled_left_bmp = BitmapFromBits(nb_left_bits, 16, 16, wx.Colour(128, 128, 128))
|
|
1022
|
+
|
|
1023
|
+
self._active_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, wx.BLACK)
|
|
1024
|
+
self._disabled_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, wx.Colour(128, 128, 128))
|
|
1025
|
+
|
|
1026
|
+
self._active_windowlist_bmp = BitmapFromBits(nb_list_bits, 16, 16, wx.BLACK)
|
|
1027
|
+
self._disabled_windowlist_bmp = BitmapFromBits(nb_list_bits, 16, 16, wx.Colour(128, 128, 128))
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
def Clone(self):
|
|
1031
|
+
""" Clones the art object. """
|
|
1032
|
+
|
|
1033
|
+
art = type(self)()
|
|
1034
|
+
art.SetNormalFont(self.GetNormalFont())
|
|
1035
|
+
art.SetSelectedFont(self.GetSelectedFont())
|
|
1036
|
+
art.SetMeasuringFont(self.GetMeasuringFont())
|
|
1037
|
+
|
|
1038
|
+
art = CopyAttributes(art, self)
|
|
1039
|
+
return art
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
def SetAGWFlags(self, agwFlags):
|
|
1043
|
+
"""
|
|
1044
|
+
Sets the tab art flags.
|
|
1045
|
+
|
|
1046
|
+
:param integer `agwFlags`: a combination of the following values:
|
|
1047
|
+
|
|
1048
|
+
==================================== ==================================
|
|
1049
|
+
Flag name Description
|
|
1050
|
+
==================================== ==================================
|
|
1051
|
+
``AUI_NB_TOP`` With this style, tabs are drawn along the top of the notebook
|
|
1052
|
+
``AUI_NB_LEFT`` With this style, tabs are drawn along the left of the notebook. Not implemented yet.
|
|
1053
|
+
``AUI_NB_RIGHT`` With this style, tabs are drawn along the right of the notebook. Not implemented yet.
|
|
1054
|
+
``AUI_NB_BOTTOM`` With this style, tabs are drawn along the bottom of the notebook
|
|
1055
|
+
``AUI_NB_TAB_SPLIT`` Allows the tab control to be split by dragging a tab
|
|
1056
|
+
``AUI_NB_TAB_MOVE`` Allows a tab to be moved horizontally by dragging
|
|
1057
|
+
``AUI_NB_TAB_EXTERNAL_MOVE`` Allows a tab to be moved to another tab control
|
|
1058
|
+
``AUI_NB_TAB_FIXED_WIDTH`` With this style, all tabs have the same width
|
|
1059
|
+
``AUI_NB_SCROLL_BUTTONS`` With this style, left and right scroll buttons are displayed
|
|
1060
|
+
``AUI_NB_WINDOWLIST_BUTTON`` With this style, a drop-down list of windows is available
|
|
1061
|
+
``AUI_NB_CLOSE_BUTTON`` With this style, a close button is available on the tab bar
|
|
1062
|
+
``AUI_NB_CLOSE_ON_ACTIVE_TAB`` With this style, a close button is available on the active tab
|
|
1063
|
+
``AUI_NB_CLOSE_ON_ALL_TABS`` With this style, a close button is available on all tabs
|
|
1064
|
+
``AUI_NB_MIDDLE_CLICK_CLOSE`` Allows to close :class:`~wx.lib.agw.aui.auibook.AuiNotebook` tabs by mouse middle button click
|
|
1065
|
+
``AUI_NB_SUB_NOTEBOOK`` This style is used by :class:`~wx.lib.agw.aui.framemanager.AuiManager` to create automatic AuiNotebooks
|
|
1066
|
+
``AUI_NB_HIDE_ON_SINGLE_TAB`` Hides the tab window if only one tab is present
|
|
1067
|
+
``AUI_NB_SMART_TABS`` Use Smart Tabbing, like ``Alt`` + ``Tab`` on Windows
|
|
1068
|
+
``AUI_NB_USE_IMAGES_DROPDOWN`` Uses images on dropdown window list menu instead of check items
|
|
1069
|
+
``AUI_NB_CLOSE_ON_TAB_LEFT`` Draws the tab close button on the left instead of on the right (a la Camino browser)
|
|
1070
|
+
``AUI_NB_TAB_FLOAT`` Allows the floating of single tabs. Known limitation: when the notebook is more or less full
|
|
1071
|
+
screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
|
|
1072
|
+
``AUI_NB_DRAW_DND_TAB`` Draws an image representation of a tab while dragging (on by default)
|
|
1073
|
+
``AUI_NB_ORDER_BY_ACCESS`` Tab navigation order by last access time for the tabs
|
|
1074
|
+
``AUI_NB_NO_TAB_FOCUS`` Don't draw tab focus rectangle
|
|
1075
|
+
==================================== ==================================
|
|
1076
|
+
|
|
1077
|
+
"""
|
|
1078
|
+
|
|
1079
|
+
self._agwFlags = agwFlags
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
def GetAGWFlags(self):
|
|
1083
|
+
"""
|
|
1084
|
+
Returns the tab art flags.
|
|
1085
|
+
|
|
1086
|
+
:see: :meth:`~AuiSimpleTabArt.SetAGWFlags` for a list of possible return values.
|
|
1087
|
+
"""
|
|
1088
|
+
|
|
1089
|
+
return self._agwFlags
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
def SetSizingInfo(self, tab_ctrl_size, tab_count, minMaxTabWidth):
|
|
1093
|
+
"""
|
|
1094
|
+
Sets the tab sizing information.
|
|
1095
|
+
|
|
1096
|
+
:param wx.Size `tab_ctrl_size`: the size of the tab control area;
|
|
1097
|
+
:param integer `tab_count`: the number of tabs;
|
|
1098
|
+
:param tuple `minMaxTabWidth`: a tuple containing the minimum and maximum tab widths
|
|
1099
|
+
to be used when the ``AUI_NB_TAB_FIXED_WIDTH`` style is active.
|
|
1100
|
+
"""
|
|
1101
|
+
|
|
1102
|
+
self._fixed_tab_width = 100
|
|
1103
|
+
minTabWidth, maxTabWidth = minMaxTabWidth
|
|
1104
|
+
|
|
1105
|
+
tot_width = tab_ctrl_size.x - self.GetIndentSize() - 4
|
|
1106
|
+
|
|
1107
|
+
if self._agwFlags & AUI_NB_CLOSE_BUTTON:
|
|
1108
|
+
tot_width -= self._active_close_bmp.GetWidth()
|
|
1109
|
+
if self._agwFlags & AUI_NB_WINDOWLIST_BUTTON:
|
|
1110
|
+
tot_width -= self._active_windowlist_bmp.GetWidth()
|
|
1111
|
+
|
|
1112
|
+
if tab_count > 0:
|
|
1113
|
+
self._fixed_tab_width = tot_width//tab_count
|
|
1114
|
+
|
|
1115
|
+
if self._fixed_tab_width < 100:
|
|
1116
|
+
self._fixed_tab_width = 100
|
|
1117
|
+
|
|
1118
|
+
if self._fixed_tab_width > tot_width//2:
|
|
1119
|
+
self._fixed_tab_width = tot_width//2
|
|
1120
|
+
|
|
1121
|
+
if self._fixed_tab_width > 220:
|
|
1122
|
+
self._fixed_tab_width = 220
|
|
1123
|
+
|
|
1124
|
+
if minTabWidth > -1:
|
|
1125
|
+
self._fixed_tab_width = max(self._fixed_tab_width, minTabWidth)
|
|
1126
|
+
if maxTabWidth > -1:
|
|
1127
|
+
self._fixed_tab_width = min(self._fixed_tab_width, maxTabWidth)
|
|
1128
|
+
|
|
1129
|
+
self._tab_ctrl_height = tab_ctrl_size.y
|
|
1130
|
+
|
|
1131
|
+
|
|
1132
|
+
def DrawBackground(self, dc, wnd, rect):
|
|
1133
|
+
"""
|
|
1134
|
+
Draws the tab area background.
|
|
1135
|
+
|
|
1136
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
1137
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
1138
|
+
:param wx.Rect `rect`: the tab control rectangle.
|
|
1139
|
+
"""
|
|
1140
|
+
|
|
1141
|
+
# draw background
|
|
1142
|
+
dc.SetBrush(self._bkbrush)
|
|
1143
|
+
dc.SetPen(wx.TRANSPARENT_PEN)
|
|
1144
|
+
dc.DrawRectangle(-1, -1, rect.GetWidth()+2, rect.GetHeight()+2)
|
|
1145
|
+
|
|
1146
|
+
# draw base line
|
|
1147
|
+
dc.SetPen(wx.GREY_PEN)
|
|
1148
|
+
dc.DrawLine(0, rect.GetHeight()-1, rect.GetWidth(), rect.GetHeight()-1)
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=False):
|
|
1152
|
+
"""
|
|
1153
|
+
Draws a single tab.
|
|
1154
|
+
|
|
1155
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
1156
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
1157
|
+
:param `page`: the tab control page associated with the tab;
|
|
1158
|
+
:param wx.Rect `in_rect`: rectangle the tab should be confined to;
|
|
1159
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
1160
|
+
:param bool `paint_control`: whether to draw the control inside a tab (if any) on a :class:`MemoryDC`.
|
|
1161
|
+
"""
|
|
1162
|
+
|
|
1163
|
+
# if the caption is empty, measure some temporary text
|
|
1164
|
+
caption = page.caption
|
|
1165
|
+
if caption == "":
|
|
1166
|
+
caption = "Xj"
|
|
1167
|
+
|
|
1168
|
+
agwFlags = self.GetAGWFlags()
|
|
1169
|
+
|
|
1170
|
+
dc.SetFont(self._selected_font)
|
|
1171
|
+
selected_textx, selected_texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
1172
|
+
|
|
1173
|
+
dc.SetFont(self._normal_font)
|
|
1174
|
+
normal_textx, normal_texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
1175
|
+
|
|
1176
|
+
control = page.control
|
|
1177
|
+
|
|
1178
|
+
# figure out the size of the tab
|
|
1179
|
+
tab_size, x_extent = self.GetTabSize(dc, wnd, page.caption, page.bitmap,
|
|
1180
|
+
page.active, close_button_state, control)
|
|
1181
|
+
|
|
1182
|
+
tab_height = tab_size[1]
|
|
1183
|
+
tab_width = tab_size[0]
|
|
1184
|
+
tab_x = in_rect.x
|
|
1185
|
+
tab_y = in_rect.y + in_rect.height - tab_height
|
|
1186
|
+
|
|
1187
|
+
caption = page.caption
|
|
1188
|
+
# select pen, brush and font for the tab to be drawn
|
|
1189
|
+
|
|
1190
|
+
if page.active:
|
|
1191
|
+
|
|
1192
|
+
dc.SetPen(self._selected_bkpen)
|
|
1193
|
+
dc.SetBrush(self._selected_bkbrush)
|
|
1194
|
+
dc.SetFont(self._selected_font)
|
|
1195
|
+
textx = selected_textx
|
|
1196
|
+
texty = selected_texty
|
|
1197
|
+
|
|
1198
|
+
else:
|
|
1199
|
+
|
|
1200
|
+
dc.SetPen(self._normal_bkpen)
|
|
1201
|
+
dc.SetBrush(self._normal_bkbrush)
|
|
1202
|
+
dc.SetFont(self._normal_font)
|
|
1203
|
+
textx = normal_textx
|
|
1204
|
+
texty = normal_texty
|
|
1205
|
+
|
|
1206
|
+
if not page.enabled:
|
|
1207
|
+
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
|
|
1208
|
+
else:
|
|
1209
|
+
dc.SetTextForeground(page.text_colour)
|
|
1210
|
+
|
|
1211
|
+
# -- draw line --
|
|
1212
|
+
|
|
1213
|
+
points = [wx.Point() for i in range(7)]
|
|
1214
|
+
points[0].x = tab_x
|
|
1215
|
+
points[0].y = tab_y + tab_height - 1
|
|
1216
|
+
points[1].x = tab_x + tab_height - 3
|
|
1217
|
+
points[1].y = tab_y + 2
|
|
1218
|
+
points[2].x = tab_x + tab_height + 3
|
|
1219
|
+
points[2].y = tab_y
|
|
1220
|
+
points[3].x = tab_x + tab_width - 2
|
|
1221
|
+
points[3].y = tab_y
|
|
1222
|
+
points[4].x = tab_x + tab_width
|
|
1223
|
+
points[4].y = tab_y + 2
|
|
1224
|
+
points[5].x = tab_x + tab_width
|
|
1225
|
+
points[5].y = tab_y + tab_height - 1
|
|
1226
|
+
points[6] = points[0]
|
|
1227
|
+
|
|
1228
|
+
dc.SetClippingRegion(in_rect)
|
|
1229
|
+
dc.DrawPolygon(points)
|
|
1230
|
+
|
|
1231
|
+
dc.SetPen(wx.GREY_PEN)
|
|
1232
|
+
dc.DrawLines(points)
|
|
1233
|
+
|
|
1234
|
+
close_button_width = 0
|
|
1235
|
+
|
|
1236
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
1237
|
+
|
|
1238
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
1239
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
1240
|
+
if control:
|
|
1241
|
+
text_offset = tab_x + (tab_height//2) + close_button_width - (textx//2) - 2
|
|
1242
|
+
else:
|
|
1243
|
+
text_offset = tab_x + (tab_height//2) + ((tab_width+close_button_width)//2) - (textx//2) - 2
|
|
1244
|
+
else:
|
|
1245
|
+
if control:
|
|
1246
|
+
text_offset = tab_x + (tab_height//2) + close_button_width - (textx//2)
|
|
1247
|
+
else:
|
|
1248
|
+
text_offset = tab_x + (tab_height//2) + ((tab_width-close_button_width)//2) - (textx//2)
|
|
1249
|
+
|
|
1250
|
+
else:
|
|
1251
|
+
|
|
1252
|
+
text_offset = tab_x + (tab_height//3) + (tab_width//2) - (textx//2)
|
|
1253
|
+
if control:
|
|
1254
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
1255
|
+
text_offset = tab_x + (tab_height//3) - (textx//2) + close_button_width + 2
|
|
1256
|
+
else:
|
|
1257
|
+
text_offset = tab_x + (tab_height//3) - (textx//2)
|
|
1258
|
+
|
|
1259
|
+
# set minimum text offset
|
|
1260
|
+
if text_offset < tab_x + tab_height:
|
|
1261
|
+
text_offset = tab_x + tab_height
|
|
1262
|
+
|
|
1263
|
+
# chop text if necessary
|
|
1264
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
1265
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x))
|
|
1266
|
+
else:
|
|
1267
|
+
draw_text = ChopText(dc, caption,
|
|
1268
|
+
tab_width - (text_offset-tab_x) - close_button_width)
|
|
1269
|
+
|
|
1270
|
+
ypos = (tab_y + tab_height)//2 - (texty//2) + 1
|
|
1271
|
+
|
|
1272
|
+
if control:
|
|
1273
|
+
if control.GetPosition() != wx.Point(text_offset+1, ypos):
|
|
1274
|
+
control.SetPosition(wx.Point(text_offset+1, ypos))
|
|
1275
|
+
|
|
1276
|
+
if not control.IsShown():
|
|
1277
|
+
control.Show()
|
|
1278
|
+
|
|
1279
|
+
if paint_control:
|
|
1280
|
+
bmp = TakeScreenShot(control.GetScreenRect())
|
|
1281
|
+
dc.DrawBitmap(bmp, text_offset+1, ypos, True)
|
|
1282
|
+
|
|
1283
|
+
controlW, controlH = control.GetSize()
|
|
1284
|
+
text_offset += controlW + 4
|
|
1285
|
+
|
|
1286
|
+
# draw tab text
|
|
1287
|
+
rectx, recty, dummy = dc.GetFullMultiLineTextExtent(draw_text)
|
|
1288
|
+
dc.DrawLabel(draw_text, wx.Rect(text_offset, ypos, rectx, recty))
|
|
1289
|
+
|
|
1290
|
+
# draw focus rectangle
|
|
1291
|
+
if page.active and wx.Window.FindFocus() == wnd and (agwFlags & AUI_NB_NO_TAB_FOCUS) == 0:
|
|
1292
|
+
|
|
1293
|
+
focusRect = wx.Rect(text_offset, ((tab_y + tab_height)//2 - (texty//2) + 1),
|
|
1294
|
+
selected_textx, selected_texty)
|
|
1295
|
+
|
|
1296
|
+
focusRect.Inflate(2, 2)
|
|
1297
|
+
# TODO:
|
|
1298
|
+
# This should be uncommented when DrawFocusRect will become
|
|
1299
|
+
# available in wxPython
|
|
1300
|
+
# wx.RendererNative.Get().DrawFocusRect(wnd, dc, focusRect, 0)
|
|
1301
|
+
|
|
1302
|
+
out_button_rect = wx.Rect()
|
|
1303
|
+
# draw close button if necessary
|
|
1304
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
1305
|
+
|
|
1306
|
+
if page.active:
|
|
1307
|
+
bmp = self._active_close_bmp
|
|
1308
|
+
else:
|
|
1309
|
+
bmp = self._disabled_close_bmp
|
|
1310
|
+
|
|
1311
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
1312
|
+
rect = wx.Rect(tab_x + tab_height - 2,
|
|
1313
|
+
tab_y + (tab_height//2) - (bmp.GetHeight()//2) + 1,
|
|
1314
|
+
close_button_width, tab_height - 1)
|
|
1315
|
+
else:
|
|
1316
|
+
rect = wx.Rect(tab_x + tab_width - close_button_width - 1,
|
|
1317
|
+
tab_y + (tab_height//2) - (bmp.GetHeight()//2) + 1,
|
|
1318
|
+
close_button_width, tab_height - 1)
|
|
1319
|
+
|
|
1320
|
+
self.DrawButtons(dc, rect, bmp, wx.WHITE, close_button_state)
|
|
1321
|
+
out_button_rect = wx.Rect(*rect)
|
|
1322
|
+
|
|
1323
|
+
out_tab_rect = wx.Rect(tab_x, tab_y, tab_width, tab_height)
|
|
1324
|
+
dc.DestroyClippingRegion()
|
|
1325
|
+
|
|
1326
|
+
return out_tab_rect, out_button_rect, x_extent
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
def DrawButtons(self, dc, _rect, bmp, bkcolour, button_state):
|
|
1330
|
+
"""
|
|
1331
|
+
Convenience method to draw tab buttons.
|
|
1332
|
+
|
|
1333
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
1334
|
+
:param wx.Rect `_rect`: the tab rectangle;
|
|
1335
|
+
:param wx.Bitmap `bmp`: the tab bitmap;
|
|
1336
|
+
:param wx.Colour `bkcolour`: the tab background colour;
|
|
1337
|
+
:param integer `button_state`: the state of the tab button.
|
|
1338
|
+
"""
|
|
1339
|
+
|
|
1340
|
+
rect = wx.Rect(*_rect)
|
|
1341
|
+
|
|
1342
|
+
if button_state == AUI_BUTTON_STATE_PRESSED:
|
|
1343
|
+
rect.x += 1
|
|
1344
|
+
rect.y += 1
|
|
1345
|
+
|
|
1346
|
+
if button_state in [AUI_BUTTON_STATE_HOVER, AUI_BUTTON_STATE_PRESSED]:
|
|
1347
|
+
dc.SetBrush(wx.Brush(StepColour(bkcolour, 120)))
|
|
1348
|
+
dc.SetPen(wx.Pen(StepColour(bkcolour, 75)))
|
|
1349
|
+
|
|
1350
|
+
# draw the background behind the button
|
|
1351
|
+
dc.DrawRectangle(rect.x, rect.y, 15, 15)
|
|
1352
|
+
|
|
1353
|
+
# draw the button itself
|
|
1354
|
+
dc.DrawBitmap(bmp, rect.x, rect.y, True)
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
def GetIndentSize(self):
|
|
1358
|
+
""" Returns the tabs indent size. """
|
|
1359
|
+
|
|
1360
|
+
return 0
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
def GetTabSize(self, dc, wnd, caption, bitmap, active, close_button_state, control=None):
|
|
1364
|
+
"""
|
|
1365
|
+
Returns the tab size for the given caption, bitmap and button state.
|
|
1366
|
+
|
|
1367
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
1368
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
1369
|
+
:param string `caption`: the tab text caption;
|
|
1370
|
+
:param wx.Bitmap `bitmap`: the bitmap displayed on the tab;
|
|
1371
|
+
:param bool `active`: whether the tab is selected or not;
|
|
1372
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
1373
|
+
:param wx.Window `control`: a :class:`wx.Window` instance inside a tab (or ``None``).
|
|
1374
|
+
"""
|
|
1375
|
+
|
|
1376
|
+
dc.SetFont(self._measuring_font)
|
|
1377
|
+
measured_textx, measured_texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
1378
|
+
|
|
1379
|
+
tab_height = measured_texty + 4
|
|
1380
|
+
tab_width = measured_textx + tab_height + 5
|
|
1381
|
+
|
|
1382
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
1383
|
+
tab_width += self._active_close_bmp.GetWidth()
|
|
1384
|
+
|
|
1385
|
+
if self._agwFlags & AUI_NB_TAB_FIXED_WIDTH:
|
|
1386
|
+
tab_width = self._fixed_tab_width
|
|
1387
|
+
|
|
1388
|
+
if control:
|
|
1389
|
+
controlW, controlH = control.GetSize()
|
|
1390
|
+
tab_width += controlW + 4
|
|
1391
|
+
|
|
1392
|
+
x_extent = tab_width - (tab_height//2) - 1
|
|
1393
|
+
|
|
1394
|
+
return (tab_width, tab_height), x_extent
|
|
1395
|
+
|
|
1396
|
+
|
|
1397
|
+
def DrawButton(self, dc, wnd, in_rect, button, orientation):
|
|
1398
|
+
"""
|
|
1399
|
+
Draws a button on the tab or on the tab area, depending on the button identifier.
|
|
1400
|
+
|
|
1401
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
1402
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
1403
|
+
:param wx.Rect `in_rect`: rectangle the tab should be confined to;
|
|
1404
|
+
:param `button`: an instance of the button class;
|
|
1405
|
+
:param integer `orientation`: the tab orientation.
|
|
1406
|
+
"""
|
|
1407
|
+
|
|
1408
|
+
bitmap_id, button_state = button.id, button.cur_state
|
|
1409
|
+
|
|
1410
|
+
if bitmap_id == AUI_BUTTON_CLOSE:
|
|
1411
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
1412
|
+
bmp = self._disabled_close_bmp
|
|
1413
|
+
else:
|
|
1414
|
+
bmp = self._active_close_bmp
|
|
1415
|
+
|
|
1416
|
+
elif bitmap_id == AUI_BUTTON_LEFT:
|
|
1417
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
1418
|
+
bmp = self._disabled_left_bmp
|
|
1419
|
+
else:
|
|
1420
|
+
bmp = self._active_left_bmp
|
|
1421
|
+
|
|
1422
|
+
elif bitmap_id == AUI_BUTTON_RIGHT:
|
|
1423
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
1424
|
+
bmp = self._disabled_right_bmp
|
|
1425
|
+
else:
|
|
1426
|
+
bmp = self._active_right_bmp
|
|
1427
|
+
|
|
1428
|
+
elif bitmap_id == AUI_BUTTON_WINDOWLIST:
|
|
1429
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
1430
|
+
bmp = self._disabled_windowlist_bmp
|
|
1431
|
+
else:
|
|
1432
|
+
bmp = self._active_windowlist_bmp
|
|
1433
|
+
|
|
1434
|
+
else:
|
|
1435
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
1436
|
+
bmp = button.dis_bitmap
|
|
1437
|
+
else:
|
|
1438
|
+
bmp = button.bitmap
|
|
1439
|
+
|
|
1440
|
+
if not bmp.IsOk():
|
|
1441
|
+
return
|
|
1442
|
+
|
|
1443
|
+
rect = wx.Rect(*in_rect)
|
|
1444
|
+
|
|
1445
|
+
if orientation == wx.LEFT:
|
|
1446
|
+
|
|
1447
|
+
rect.SetX(in_rect.x)
|
|
1448
|
+
rect.SetY(((in_rect.y + in_rect.height)//2) - (bmp.GetHeight()//2))
|
|
1449
|
+
rect.SetWidth(bmp.GetWidth())
|
|
1450
|
+
rect.SetHeight(bmp.GetHeight())
|
|
1451
|
+
|
|
1452
|
+
else:
|
|
1453
|
+
|
|
1454
|
+
rect = wx.Rect(in_rect.x + in_rect.width - bmp.GetWidth(),
|
|
1455
|
+
((in_rect.y + in_rect.height)//2) - (bmp.GetHeight()//2),
|
|
1456
|
+
bmp.GetWidth(), bmp.GetHeight())
|
|
1457
|
+
|
|
1458
|
+
self.DrawButtons(dc, rect, bmp, wx.WHITE, button_state)
|
|
1459
|
+
|
|
1460
|
+
out_rect = wx.Rect(*rect)
|
|
1461
|
+
return out_rect
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
def ShowDropDown(self, wnd, pages, active_idx):
|
|
1465
|
+
"""
|
|
1466
|
+
Shows the drop-down window menu on the tab area.
|
|
1467
|
+
|
|
1468
|
+
:param `wnd`: a :class:`wx.Window` derived window instance;
|
|
1469
|
+
:param list `pages`: the pages associated with the tabs;
|
|
1470
|
+
:param integer `active_idx`: the active tab index.
|
|
1471
|
+
"""
|
|
1472
|
+
|
|
1473
|
+
menuPopup = wx.Menu()
|
|
1474
|
+
useImages = self.GetAGWFlags() & AUI_NB_USE_IMAGES_DROPDOWN
|
|
1475
|
+
|
|
1476
|
+
for i, page in enumerate(pages):
|
|
1477
|
+
|
|
1478
|
+
if useImages:
|
|
1479
|
+
menuItem = wx.MenuItem(menuPopup, 1000+i, page.caption)
|
|
1480
|
+
if page.bitmap:
|
|
1481
|
+
menuItem.SetBitmap(page.bitmap)
|
|
1482
|
+
|
|
1483
|
+
menuPopup.Append(menuItem)
|
|
1484
|
+
|
|
1485
|
+
else:
|
|
1486
|
+
|
|
1487
|
+
menuPopup.AppendCheckItem(1000+i, page.caption)
|
|
1488
|
+
|
|
1489
|
+
menuPopup.Enable(1000+i, page.enabled)
|
|
1490
|
+
|
|
1491
|
+
if active_idx != -1 and not useImages:
|
|
1492
|
+
menuPopup.Check(1000+active_idx, True)
|
|
1493
|
+
|
|
1494
|
+
cc = AuiCommandCapture()
|
|
1495
|
+
wnd.PushEventHandler(cc)
|
|
1496
|
+
wnd.PopupMenu(menuPopup)
|
|
1497
|
+
command = cc.GetCommandId()
|
|
1498
|
+
wnd.PopEventHandler(True)
|
|
1499
|
+
|
|
1500
|
+
if command >= 1000:
|
|
1501
|
+
return command-1000
|
|
1502
|
+
|
|
1503
|
+
return -1
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
def GetBestTabCtrlSize(self, wnd, pages, required_bmp_size):
|
|
1507
|
+
"""
|
|
1508
|
+
Returns the best tab control size.
|
|
1509
|
+
|
|
1510
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
1511
|
+
:param list `pages`: the pages associated with the tabs;
|
|
1512
|
+
:param wx.Size `required_bmp_size`: the size of the bitmap on the tabs.
|
|
1513
|
+
"""
|
|
1514
|
+
|
|
1515
|
+
dc = wx.ClientDC(wnd)
|
|
1516
|
+
dc.SetFont(self._measuring_font)
|
|
1517
|
+
s, x_extent = self.GetTabSize(dc, wnd, "ABCDEFGHIj", wx.NullBitmap, True,
|
|
1518
|
+
AUI_BUTTON_STATE_HIDDEN, None)
|
|
1519
|
+
|
|
1520
|
+
max_y = s[1]
|
|
1521
|
+
|
|
1522
|
+
for page in pages:
|
|
1523
|
+
if page.control:
|
|
1524
|
+
controlW, controlH = page.control.GetSize()
|
|
1525
|
+
max_y = max(max_y, controlH+4)
|
|
1526
|
+
|
|
1527
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(page.caption)
|
|
1528
|
+
max_y = max(max_y, texty)
|
|
1529
|
+
|
|
1530
|
+
return max_y + 3
|
|
1531
|
+
|
|
1532
|
+
|
|
1533
|
+
def SetNormalFont(self, font):
|
|
1534
|
+
"""
|
|
1535
|
+
Sets the normal font for drawing tab labels.
|
|
1536
|
+
|
|
1537
|
+
:param wx.Font `font`: the new font to use to draw tab labels in their normal, un-selected state.
|
|
1538
|
+
"""
|
|
1539
|
+
|
|
1540
|
+
self._normal_font = font
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
def SetSelectedFont(self, font):
|
|
1544
|
+
"""
|
|
1545
|
+
Sets the selected tab font for drawing tab labels.
|
|
1546
|
+
|
|
1547
|
+
:param wx.Font `font`: the new font to use to draw tab labels in their selected state.
|
|
1548
|
+
"""
|
|
1549
|
+
|
|
1550
|
+
self._selected_font = font
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
def SetMeasuringFont(self, font):
|
|
1554
|
+
"""
|
|
1555
|
+
Sets the font for calculating text measurements.
|
|
1556
|
+
|
|
1557
|
+
:param wx.Font `font`: the new font to use to measure tab labels text extents.
|
|
1558
|
+
"""
|
|
1559
|
+
|
|
1560
|
+
self._measuring_font = font
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
def GetNormalFont(self):
|
|
1564
|
+
""" Returns the normal font for drawing tab labels. """
|
|
1565
|
+
|
|
1566
|
+
return self._normal_font
|
|
1567
|
+
|
|
1568
|
+
|
|
1569
|
+
def GetSelectedFont(self):
|
|
1570
|
+
""" Returns the selected tab font for drawing tab labels. """
|
|
1571
|
+
|
|
1572
|
+
return self._selected_font
|
|
1573
|
+
|
|
1574
|
+
|
|
1575
|
+
def GetMeasuringFont(self):
|
|
1576
|
+
""" Returns the font for calculating text measurements. """
|
|
1577
|
+
|
|
1578
|
+
return self._measuring_font
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
def SetCustomButton(self, bitmap_id, button_state, bmp):
|
|
1582
|
+
"""
|
|
1583
|
+
Sets a custom bitmap for the close, left, right and window list buttons.
|
|
1584
|
+
|
|
1585
|
+
:param integer `bitmap_id`: the button identifier;
|
|
1586
|
+
:param integer `button_state`: the button state;
|
|
1587
|
+
:param wx.Bitmap `bmp`: the custom bitmap to use for the button.
|
|
1588
|
+
"""
|
|
1589
|
+
|
|
1590
|
+
if bitmap_id == AUI_BUTTON_CLOSE:
|
|
1591
|
+
if button_state == AUI_BUTTON_STATE_NORMAL:
|
|
1592
|
+
self._active_close_bmp = bmp
|
|
1593
|
+
self._hover_close_bmp = self._active_close_bmp
|
|
1594
|
+
self._pressed_close_bmp = self._active_close_bmp
|
|
1595
|
+
self._disabled_close_bmp = self._active_close_bmp
|
|
1596
|
+
|
|
1597
|
+
elif button_state == AUI_BUTTON_STATE_HOVER:
|
|
1598
|
+
self._hover_close_bmp = bmp
|
|
1599
|
+
elif button_state == AUI_BUTTON_STATE_PRESSED:
|
|
1600
|
+
self._pressed_close_bmp = bmp
|
|
1601
|
+
else:
|
|
1602
|
+
self._disabled_close_bmp = bmp
|
|
1603
|
+
|
|
1604
|
+
elif bitmap_id == AUI_BUTTON_LEFT:
|
|
1605
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
1606
|
+
self._disabled_left_bmp = bmp
|
|
1607
|
+
else:
|
|
1608
|
+
self._active_left_bmp = bmp
|
|
1609
|
+
|
|
1610
|
+
elif bitmap_id == AUI_BUTTON_RIGHT:
|
|
1611
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
1612
|
+
self._disabled_right_bmp = bmp
|
|
1613
|
+
else:
|
|
1614
|
+
self._active_right_bmp = bmp
|
|
1615
|
+
|
|
1616
|
+
elif bitmap_id == AUI_BUTTON_WINDOWLIST:
|
|
1617
|
+
if button_state & AUI_BUTTON_STATE_DISABLED:
|
|
1618
|
+
self._disabled_windowlist_bmp = bmp
|
|
1619
|
+
else:
|
|
1620
|
+
self._active_windowlist_bmp = bmp
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
class VC71TabArt(AuiDefaultTabArt):
|
|
1624
|
+
""" A class to draw tabs using the Visual Studio 2003 (VC71) style. """
|
|
1625
|
+
|
|
1626
|
+
def __init__(self):
|
|
1627
|
+
""" Default class constructor. """
|
|
1628
|
+
|
|
1629
|
+
AuiDefaultTabArt.__init__(self)
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
def Clone(self):
|
|
1633
|
+
""" Clones the art object. """
|
|
1634
|
+
|
|
1635
|
+
art = type(self)()
|
|
1636
|
+
art.SetNormalFont(self.GetNormalFont())
|
|
1637
|
+
art.SetSelectedFont(self.GetSelectedFont())
|
|
1638
|
+
art.SetMeasuringFont(self.GetMeasuringFont())
|
|
1639
|
+
|
|
1640
|
+
art = CopyAttributes(art, self)
|
|
1641
|
+
return art
|
|
1642
|
+
|
|
1643
|
+
|
|
1644
|
+
def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=False):
|
|
1645
|
+
"""
|
|
1646
|
+
Draws a single tab.
|
|
1647
|
+
|
|
1648
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
1649
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
1650
|
+
:param `page`: the tab control page associated with the tab;
|
|
1651
|
+
:param wx.Rect `in_rect`: rectangle the tab should be confined to;
|
|
1652
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
1653
|
+
:param bool `paint_control`: whether to draw the control inside a tab (if any) on a :class:`MemoryDC`.
|
|
1654
|
+
"""
|
|
1655
|
+
|
|
1656
|
+
# Visual studio 7.1 style
|
|
1657
|
+
# This code is based on the renderer included in FlatNotebook
|
|
1658
|
+
|
|
1659
|
+
# figure out the size of the tab
|
|
1660
|
+
|
|
1661
|
+
control = page.control
|
|
1662
|
+
tab_size, x_extent = self.GetTabSize(dc, wnd, page.caption, page.bitmap, page.active,
|
|
1663
|
+
close_button_state, control)
|
|
1664
|
+
|
|
1665
|
+
tab_height = self._tab_ctrl_height - 3
|
|
1666
|
+
tab_width = tab_size[0]
|
|
1667
|
+
tab_x = in_rect.x
|
|
1668
|
+
tab_y = in_rect.y + in_rect.height - tab_height
|
|
1669
|
+
clip_width = tab_width
|
|
1670
|
+
|
|
1671
|
+
if tab_x + clip_width > in_rect.x + in_rect.width - 4:
|
|
1672
|
+
clip_width = (in_rect.x + in_rect.width) - tab_x - 4
|
|
1673
|
+
|
|
1674
|
+
dc.SetClippingRegion(tab_x, tab_y, clip_width + 1, tab_height - 3)
|
|
1675
|
+
agwFlags = self.GetAGWFlags()
|
|
1676
|
+
|
|
1677
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
1678
|
+
tab_y -= 1
|
|
1679
|
+
|
|
1680
|
+
dc.SetPen((page.active and [wx.Pen(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DHIGHLIGHT))] or \
|
|
1681
|
+
[wx.Pen(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DSHADOW))])[0])
|
|
1682
|
+
dc.SetBrush((page.active and [wx.Brush(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE))] or \
|
|
1683
|
+
[wx.TRANSPARENT_BRUSH])[0])
|
|
1684
|
+
|
|
1685
|
+
if page.active:
|
|
1686
|
+
|
|
1687
|
+
tabH = tab_height - 2
|
|
1688
|
+
dc.DrawRectangle(tab_x, tab_y, tab_width, tabH)
|
|
1689
|
+
|
|
1690
|
+
rightLineY1 = (agwFlags & AUI_NB_BOTTOM and [vertical_border_padding - 2] or \
|
|
1691
|
+
[vertical_border_padding - 1])[0]
|
|
1692
|
+
rightLineY2 = tabH + 3
|
|
1693
|
+
dc.SetPen(wx.Pen(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DSHADOW)))
|
|
1694
|
+
dc.DrawLine(tab_x + tab_width - 1, rightLineY1 + 1, tab_x + tab_width - 1, rightLineY2)
|
|
1695
|
+
|
|
1696
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
1697
|
+
dc.DrawLine(tab_x + 1, rightLineY2 - 3 , tab_x + tab_width - 1, rightLineY2 - 3)
|
|
1698
|
+
|
|
1699
|
+
dc.SetPen(wx.Pen(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW)))
|
|
1700
|
+
dc.DrawLine(tab_x + tab_width, rightLineY1, tab_x + tab_width, rightLineY2)
|
|
1701
|
+
|
|
1702
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
1703
|
+
dc.DrawLine(tab_x, rightLineY2 - 2, tab_x + tab_width, rightLineY2 - 2)
|
|
1704
|
+
|
|
1705
|
+
else:
|
|
1706
|
+
|
|
1707
|
+
# We dont draw a rectangle for non selected tabs, but only
|
|
1708
|
+
# vertical line on the right
|
|
1709
|
+
blackLineY1 = (agwFlags & AUI_NB_BOTTOM and [vertical_border_padding + 2] or \
|
|
1710
|
+
[vertical_border_padding + 1])[0]
|
|
1711
|
+
blackLineY2 = tab_height - 5
|
|
1712
|
+
dc.DrawLine(tab_x + tab_width, blackLineY1, tab_x + tab_width, blackLineY2)
|
|
1713
|
+
|
|
1714
|
+
border_points = [0, 0]
|
|
1715
|
+
|
|
1716
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
1717
|
+
|
|
1718
|
+
border_points[0] = wx.Point(tab_x, tab_y)
|
|
1719
|
+
border_points[1] = wx.Point(tab_x, tab_y + tab_height - 6)
|
|
1720
|
+
|
|
1721
|
+
else: # if (agwFlags & AUI_NB_TOP)
|
|
1722
|
+
|
|
1723
|
+
border_points[0] = wx.Point(tab_x, tab_y + tab_height - 4)
|
|
1724
|
+
border_points[1] = wx.Point(tab_x, tab_y + 2)
|
|
1725
|
+
|
|
1726
|
+
drawn_tab_yoff = border_points[1].y
|
|
1727
|
+
drawn_tab_height = border_points[0].y - border_points[1].y
|
|
1728
|
+
|
|
1729
|
+
text_offset = tab_x + 8
|
|
1730
|
+
close_button_width = 0
|
|
1731
|
+
|
|
1732
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
1733
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
1734
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
1735
|
+
text_offset += close_button_width - 5
|
|
1736
|
+
|
|
1737
|
+
if not page.enabled:
|
|
1738
|
+
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
|
|
1739
|
+
pagebitmap = page.dis_bitmap
|
|
1740
|
+
else:
|
|
1741
|
+
dc.SetTextForeground(page.text_colour)
|
|
1742
|
+
pagebitmap = page.bitmap
|
|
1743
|
+
|
|
1744
|
+
shift = 0
|
|
1745
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
1746
|
+
shift = (page.active and [1] or [2])[0]
|
|
1747
|
+
|
|
1748
|
+
bitmap_offset = 0
|
|
1749
|
+
if pagebitmap.IsOk():
|
|
1750
|
+
bitmap_offset = tab_x + 8
|
|
1751
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT and close_button_width:
|
|
1752
|
+
bitmap_offset += close_button_width - 5
|
|
1753
|
+
|
|
1754
|
+
# draw bitmap
|
|
1755
|
+
dc.DrawBitmap(pagebitmap, bitmap_offset,
|
|
1756
|
+
drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2) + shift,
|
|
1757
|
+
True)
|
|
1758
|
+
|
|
1759
|
+
text_offset = bitmap_offset + pagebitmap.GetWidth()
|
|
1760
|
+
text_offset += 3 # bitmap padding
|
|
1761
|
+
|
|
1762
|
+
else:
|
|
1763
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT == 0 or not close_button_width:
|
|
1764
|
+
text_offset = tab_x + 8
|
|
1765
|
+
|
|
1766
|
+
# if the caption is empty, measure some temporary text
|
|
1767
|
+
caption = page.caption
|
|
1768
|
+
|
|
1769
|
+
if caption == "":
|
|
1770
|
+
caption = "Xj"
|
|
1771
|
+
|
|
1772
|
+
if page.active:
|
|
1773
|
+
dc.SetFont(self._selected_font)
|
|
1774
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
1775
|
+
else:
|
|
1776
|
+
dc.SetFont(self._normal_font)
|
|
1777
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
1778
|
+
|
|
1779
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width)
|
|
1780
|
+
|
|
1781
|
+
ypos = drawn_tab_yoff + (drawn_tab_height)//2 - (texty//2) - 1 + shift
|
|
1782
|
+
|
|
1783
|
+
offset_focus = text_offset
|
|
1784
|
+
|
|
1785
|
+
if control:
|
|
1786
|
+
if control.GetPosition() != wx.Point(text_offset+1, ypos):
|
|
1787
|
+
control.SetPosition(wx.Point(text_offset+1, ypos))
|
|
1788
|
+
|
|
1789
|
+
if not control.IsShown():
|
|
1790
|
+
control.Show()
|
|
1791
|
+
|
|
1792
|
+
if paint_control:
|
|
1793
|
+
bmp = TakeScreenShot(control.GetScreenRect())
|
|
1794
|
+
dc.DrawBitmap(bmp, text_offset+1, ypos, True)
|
|
1795
|
+
|
|
1796
|
+
controlW, controlH = control.GetSize()
|
|
1797
|
+
text_offset += controlW + 4
|
|
1798
|
+
textx += controlW + 4
|
|
1799
|
+
|
|
1800
|
+
# draw tab text
|
|
1801
|
+
rectx, recty, dummy = dc.GetFullMultiLineTextExtent(draw_text)
|
|
1802
|
+
dc.DrawLabel(draw_text, wx.Rect(text_offset, ypos, rectx, recty))
|
|
1803
|
+
|
|
1804
|
+
out_button_rect = wx.Rect()
|
|
1805
|
+
|
|
1806
|
+
# draw focus rectangle
|
|
1807
|
+
if (agwFlags & AUI_NB_NO_TAB_FOCUS) == 0:
|
|
1808
|
+
self.DrawFocusRectangle(dc, page, wnd, draw_text, offset_focus, bitmap_offset, drawn_tab_yoff+shift,
|
|
1809
|
+
drawn_tab_height+shift, rectx, recty)
|
|
1810
|
+
|
|
1811
|
+
# draw 'x' on tab (if enabled)
|
|
1812
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
1813
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
1814
|
+
|
|
1815
|
+
bmp = self._disabled_close_bmp
|
|
1816
|
+
|
|
1817
|
+
if close_button_state == AUI_BUTTON_STATE_HOVER:
|
|
1818
|
+
bmp = self._hover_close_bmp
|
|
1819
|
+
elif close_button_state == AUI_BUTTON_STATE_PRESSED:
|
|
1820
|
+
bmp = self._pressed_close_bmp
|
|
1821
|
+
|
|
1822
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
1823
|
+
rect = wx.Rect(tab_x + 4,
|
|
1824
|
+
drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift,
|
|
1825
|
+
close_button_width, tab_height)
|
|
1826
|
+
else:
|
|
1827
|
+
rect = wx.Rect(tab_x + tab_width - close_button_width - 3,
|
|
1828
|
+
drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift,
|
|
1829
|
+
close_button_width, tab_height)
|
|
1830
|
+
|
|
1831
|
+
# Indent the button if it is pressed down:
|
|
1832
|
+
rect = IndentPressedBitmap(rect, close_button_state)
|
|
1833
|
+
dc.DrawBitmap(bmp, rect.x, rect.y, True)
|
|
1834
|
+
|
|
1835
|
+
out_button_rect = rect
|
|
1836
|
+
|
|
1837
|
+
out_tab_rect = wx.Rect(tab_x, tab_y, tab_width, tab_height)
|
|
1838
|
+
dc.DestroyClippingRegion()
|
|
1839
|
+
|
|
1840
|
+
return out_tab_rect, out_button_rect, x_extent
|
|
1841
|
+
|
|
1842
|
+
|
|
1843
|
+
class FF2TabArt(AuiDefaultTabArt):
|
|
1844
|
+
""" A class to draw tabs using the Firefox 2 (FF2) style. """
|
|
1845
|
+
|
|
1846
|
+
def __init__(self):
|
|
1847
|
+
""" Default class constructor. """
|
|
1848
|
+
|
|
1849
|
+
AuiDefaultTabArt.__init__(self)
|
|
1850
|
+
|
|
1851
|
+
|
|
1852
|
+
def Clone(self):
|
|
1853
|
+
""" Clones the art object. """
|
|
1854
|
+
|
|
1855
|
+
art = type(self)()
|
|
1856
|
+
art.SetNormalFont(self.GetNormalFont())
|
|
1857
|
+
art.SetSelectedFont(self.GetSelectedFont())
|
|
1858
|
+
art.SetMeasuringFont(self.GetMeasuringFont())
|
|
1859
|
+
|
|
1860
|
+
art = CopyAttributes(art, self)
|
|
1861
|
+
return art
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
def GetTabSize(self, dc, wnd, caption, bitmap, active, close_button_state, control):
|
|
1865
|
+
"""
|
|
1866
|
+
Returns the tab size for the given caption, bitmap and button state.
|
|
1867
|
+
|
|
1868
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
1869
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
1870
|
+
:param string `caption`: the tab text caption;
|
|
1871
|
+
:param wx.Bitmap `bitmap`: the bitmap displayed on the tab;
|
|
1872
|
+
:param bool `active`: whether the tab is selected or not;
|
|
1873
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
1874
|
+
:param wx.Window `control`: a :class:`wx.Window` instance inside a tab (or ``None``).
|
|
1875
|
+
"""
|
|
1876
|
+
|
|
1877
|
+
tab_size, x_extent = AuiDefaultTabArt.GetTabSize(self, dc, wnd, caption, bitmap,
|
|
1878
|
+
active, close_button_state, control)
|
|
1879
|
+
|
|
1880
|
+
tab_width, tab_height = tab_size
|
|
1881
|
+
|
|
1882
|
+
# add some vertical padding
|
|
1883
|
+
tab_height += 2
|
|
1884
|
+
|
|
1885
|
+
return (tab_width, tab_height), x_extent
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=False):
|
|
1889
|
+
"""
|
|
1890
|
+
Draws a single tab.
|
|
1891
|
+
|
|
1892
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
1893
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
1894
|
+
:param `page`: the tab control page associated with the tab;
|
|
1895
|
+
:param wx.Rect `in_rect`: rectangle the tab should be confined to;
|
|
1896
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
1897
|
+
:param bool `paint_control`: whether to draw the control inside a tab (if any) on a :class:`MemoryDC`.
|
|
1898
|
+
"""
|
|
1899
|
+
|
|
1900
|
+
# Firefox 2 style
|
|
1901
|
+
|
|
1902
|
+
control = page.control
|
|
1903
|
+
|
|
1904
|
+
# figure out the size of the tab
|
|
1905
|
+
tab_size, x_extent = self.GetTabSize(dc, wnd, page.caption, page.bitmap,
|
|
1906
|
+
page.active, close_button_state, control)
|
|
1907
|
+
|
|
1908
|
+
tab_height = self._tab_ctrl_height - 2
|
|
1909
|
+
tab_width = tab_size[0]
|
|
1910
|
+
tab_x = in_rect.x
|
|
1911
|
+
tab_y = in_rect.y + in_rect.height - tab_height
|
|
1912
|
+
|
|
1913
|
+
clip_width = tab_width
|
|
1914
|
+
if tab_x + clip_width > in_rect.x + in_rect.width - 4:
|
|
1915
|
+
clip_width = (in_rect.x + in_rect.width) - tab_x - 4
|
|
1916
|
+
|
|
1917
|
+
dc.SetClippingRegion(tab_x, tab_y, clip_width + 1, tab_height - 3)
|
|
1918
|
+
|
|
1919
|
+
tabPoints = [wx.Point() for i in range(7)]
|
|
1920
|
+
|
|
1921
|
+
adjust = 0
|
|
1922
|
+
if not page.active:
|
|
1923
|
+
adjust = 1
|
|
1924
|
+
|
|
1925
|
+
agwFlags = self.GetAGWFlags()
|
|
1926
|
+
|
|
1927
|
+
tabPoints[0].x = tab_x + 3
|
|
1928
|
+
tabPoints[0].y = (agwFlags & AUI_NB_BOTTOM and [3] or [tab_height - 2])[0]
|
|
1929
|
+
|
|
1930
|
+
tabPoints[1].x = tabPoints[0].x
|
|
1931
|
+
tabPoints[1].y = (agwFlags & AUI_NB_BOTTOM and [tab_height - (vertical_border_padding + 2) - adjust] or \
|
|
1932
|
+
[(vertical_border_padding + 2) + adjust])[0]
|
|
1933
|
+
|
|
1934
|
+
tabPoints[2].x = tabPoints[1].x+2
|
|
1935
|
+
tabPoints[2].y = (agwFlags & AUI_NB_BOTTOM and [tab_height - vertical_border_padding - adjust] or \
|
|
1936
|
+
[vertical_border_padding + adjust])[0]
|
|
1937
|
+
|
|
1938
|
+
tabPoints[3].x = tab_x + tab_width - 2
|
|
1939
|
+
tabPoints[3].y = tabPoints[2].y
|
|
1940
|
+
|
|
1941
|
+
tabPoints[4].x = tabPoints[3].x + 2
|
|
1942
|
+
tabPoints[4].y = tabPoints[1].y
|
|
1943
|
+
|
|
1944
|
+
tabPoints[5].x = tabPoints[4].x
|
|
1945
|
+
tabPoints[5].y = tabPoints[0].y
|
|
1946
|
+
|
|
1947
|
+
tabPoints[6].x = tabPoints[0].x
|
|
1948
|
+
tabPoints[6].y = tabPoints[0].y
|
|
1949
|
+
|
|
1950
|
+
rr = wx.Rect(tabPoints[2], tabPoints[5])
|
|
1951
|
+
self.DrawTabBackground(dc, rr, page.active, (agwFlags & AUI_NB_BOTTOM) == 0)
|
|
1952
|
+
|
|
1953
|
+
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
|
1954
|
+
dc.SetPen(wx.Pen(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNSHADOW)))
|
|
1955
|
+
|
|
1956
|
+
# Draw the tab as rounded rectangle
|
|
1957
|
+
dc.DrawPolygon(tabPoints)
|
|
1958
|
+
|
|
1959
|
+
if page.active:
|
|
1960
|
+
dc.DrawLine(tabPoints[0].x + 1, tabPoints[0].y, tabPoints[5].x , tabPoints[0].y)
|
|
1961
|
+
|
|
1962
|
+
drawn_tab_yoff = tabPoints[1].y
|
|
1963
|
+
drawn_tab_height = tabPoints[0].y - tabPoints[2].y
|
|
1964
|
+
|
|
1965
|
+
text_offset = tab_x + 8
|
|
1966
|
+
close_button_width = 0
|
|
1967
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
1968
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
1969
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
1970
|
+
text_offset += close_button_width - 4
|
|
1971
|
+
|
|
1972
|
+
if not page.enabled:
|
|
1973
|
+
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
|
|
1974
|
+
pagebitmap = page.dis_bitmap
|
|
1975
|
+
else:
|
|
1976
|
+
dc.SetTextForeground(page.text_colour)
|
|
1977
|
+
pagebitmap = page.bitmap
|
|
1978
|
+
|
|
1979
|
+
shift = -1
|
|
1980
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
1981
|
+
shift = 2
|
|
1982
|
+
|
|
1983
|
+
bitmap_offset = 0
|
|
1984
|
+
if pagebitmap.IsOk():
|
|
1985
|
+
bitmap_offset = tab_x + 8
|
|
1986
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT and close_button_width:
|
|
1987
|
+
bitmap_offset += close_button_width - 4
|
|
1988
|
+
|
|
1989
|
+
# draw bitmap
|
|
1990
|
+
dc.DrawBitmap(pagebitmap, bitmap_offset,
|
|
1991
|
+
drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2) + shift,
|
|
1992
|
+
True)
|
|
1993
|
+
|
|
1994
|
+
text_offset = bitmap_offset + pagebitmap.GetWidth()
|
|
1995
|
+
text_offset += 3 # bitmap padding
|
|
1996
|
+
|
|
1997
|
+
else:
|
|
1998
|
+
|
|
1999
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT == 0 or not close_button_width:
|
|
2000
|
+
text_offset = tab_x + 8
|
|
2001
|
+
|
|
2002
|
+
# if the caption is empty, measure some temporary text
|
|
2003
|
+
caption = page.caption
|
|
2004
|
+
if caption == "":
|
|
2005
|
+
caption = "Xj"
|
|
2006
|
+
|
|
2007
|
+
if page.active:
|
|
2008
|
+
dc.SetFont(self._selected_font)
|
|
2009
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
2010
|
+
else:
|
|
2011
|
+
dc.SetFont(self._normal_font)
|
|
2012
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
2013
|
+
|
|
2014
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
2015
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width + 1)
|
|
2016
|
+
else:
|
|
2017
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width)
|
|
2018
|
+
|
|
2019
|
+
ypos = drawn_tab_yoff + drawn_tab_height//2 - texty//2 - 1 + shift
|
|
2020
|
+
|
|
2021
|
+
offset_focus = text_offset
|
|
2022
|
+
|
|
2023
|
+
if control:
|
|
2024
|
+
if control.GetPosition() != wx.Point(text_offset+1, ypos):
|
|
2025
|
+
control.SetPosition(wx.Point(text_offset+1, ypos))
|
|
2026
|
+
|
|
2027
|
+
if not control.IsShown():
|
|
2028
|
+
control.Show()
|
|
2029
|
+
|
|
2030
|
+
if paint_control:
|
|
2031
|
+
bmp = TakeScreenShot(control.GetScreenRect())
|
|
2032
|
+
dc.DrawBitmap(bmp, text_offset+1, ypos, True)
|
|
2033
|
+
|
|
2034
|
+
controlW, controlH = control.GetSize()
|
|
2035
|
+
text_offset += controlW + 4
|
|
2036
|
+
textx += controlW + 4
|
|
2037
|
+
|
|
2038
|
+
# draw tab text
|
|
2039
|
+
rectx, recty, dummy = dc.GetFullMultiLineTextExtent(draw_text)
|
|
2040
|
+
dc.DrawLabel(draw_text, wx.Rect(text_offset, ypos, rectx, recty))
|
|
2041
|
+
|
|
2042
|
+
# draw focus rectangle
|
|
2043
|
+
if (agwFlags & AUI_NB_NO_TAB_FOCUS) == 0:
|
|
2044
|
+
self.DrawFocusRectangle(dc, page, wnd, draw_text, offset_focus, bitmap_offset, drawn_tab_yoff+shift,
|
|
2045
|
+
drawn_tab_height, rectx, recty)
|
|
2046
|
+
|
|
2047
|
+
out_button_rect = wx.Rect()
|
|
2048
|
+
# draw 'x' on tab (if enabled)
|
|
2049
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
2050
|
+
|
|
2051
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
2052
|
+
bmp = self._disabled_close_bmp
|
|
2053
|
+
|
|
2054
|
+
if close_button_state == AUI_BUTTON_STATE_HOVER:
|
|
2055
|
+
bmp = self._hover_close_bmp
|
|
2056
|
+
elif close_button_state == AUI_BUTTON_STATE_PRESSED:
|
|
2057
|
+
bmp = self._pressed_close_bmp
|
|
2058
|
+
|
|
2059
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
2060
|
+
rect = wx.Rect(tab_x + 5,
|
|
2061
|
+
drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift,
|
|
2062
|
+
close_button_width, tab_height)
|
|
2063
|
+
else:
|
|
2064
|
+
rect = wx.Rect(tab_x + tab_width - close_button_width - 3,
|
|
2065
|
+
drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift,
|
|
2066
|
+
close_button_width, tab_height)
|
|
2067
|
+
|
|
2068
|
+
# Indent the button if it is pressed down:
|
|
2069
|
+
rect = IndentPressedBitmap(rect, close_button_state)
|
|
2070
|
+
dc.DrawBitmap(bmp, rect.x, rect.y, True)
|
|
2071
|
+
out_button_rect = rect
|
|
2072
|
+
|
|
2073
|
+
out_tab_rect = wx.Rect(tab_x, tab_y, tab_width, tab_height)
|
|
2074
|
+
dc.DestroyClippingRegion()
|
|
2075
|
+
|
|
2076
|
+
return out_tab_rect, out_button_rect, x_extent
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
def DrawTabBackground(self, dc, rect, focus, upperTabs):
|
|
2080
|
+
"""
|
|
2081
|
+
Draws the tab background for the Firefox 2 style.
|
|
2082
|
+
This is more consistent with :class:`~wx.lib.agw.flatnotebook.FlatNotebook` than before.
|
|
2083
|
+
|
|
2084
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
2085
|
+
:param wx.Rect `rect`: rectangle the tab should be confined to;
|
|
2086
|
+
:param bool `focus`: whether the tab has focus or not;
|
|
2087
|
+
:param bool `upperTabs`: whether the style is ``AUI_NB_TOP`` or ``AUI_NB_BOTTOM``.
|
|
2088
|
+
"""
|
|
2089
|
+
|
|
2090
|
+
# Define the rounded rectangle base on the given rect
|
|
2091
|
+
# we need an array of 9 points for it
|
|
2092
|
+
regPts = [wx.Point() for indx in range(9)]
|
|
2093
|
+
|
|
2094
|
+
if focus:
|
|
2095
|
+
if upperTabs:
|
|
2096
|
+
leftPt = wx.Point(rect.x, rect.y + (rect.height // 10)*8)
|
|
2097
|
+
rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height // 10)*8)
|
|
2098
|
+
else:
|
|
2099
|
+
leftPt = wx.Point(rect.x, rect.y + (rect.height // 10)*5)
|
|
2100
|
+
rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height // 10)*5)
|
|
2101
|
+
else:
|
|
2102
|
+
leftPt = wx.Point(rect.x, rect.y + (rect.height // 2))
|
|
2103
|
+
rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height // 2))
|
|
2104
|
+
|
|
2105
|
+
# Define the top region
|
|
2106
|
+
top = wx.Rect(rect.GetTopLeft(), rightPt)
|
|
2107
|
+
bottom = wx.Rect(leftPt, rect.GetBottomRight())
|
|
2108
|
+
|
|
2109
|
+
topStartColour = wx.WHITE
|
|
2110
|
+
|
|
2111
|
+
if not focus:
|
|
2112
|
+
topStartColour = LightColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE), 50)
|
|
2113
|
+
|
|
2114
|
+
topEndColour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE)
|
|
2115
|
+
bottomStartColour = topEndColour
|
|
2116
|
+
bottomEndColour = topEndColour
|
|
2117
|
+
|
|
2118
|
+
# Incase we use bottom tabs, switch the colours
|
|
2119
|
+
if upperTabs:
|
|
2120
|
+
if focus:
|
|
2121
|
+
dc.GradientFillLinear(top, topStartColour, topEndColour, wx.SOUTH)
|
|
2122
|
+
dc.GradientFillLinear(bottom, bottomStartColour, bottomEndColour, wx.SOUTH)
|
|
2123
|
+
else:
|
|
2124
|
+
dc.GradientFillLinear(top, topEndColour , topStartColour, wx.SOUTH)
|
|
2125
|
+
dc.GradientFillLinear(bottom, bottomStartColour, bottomEndColour, wx.SOUTH)
|
|
2126
|
+
|
|
2127
|
+
else:
|
|
2128
|
+
if focus:
|
|
2129
|
+
dc.GradientFillLinear(bottom, topEndColour, bottomEndColour, wx.SOUTH)
|
|
2130
|
+
dc.GradientFillLinear(top, topStartColour, topStartColour, wx.SOUTH)
|
|
2131
|
+
else:
|
|
2132
|
+
dc.GradientFillLinear(bottom, bottomStartColour, bottomEndColour, wx.SOUTH)
|
|
2133
|
+
dc.GradientFillLinear(top, topEndColour, topStartColour, wx.SOUTH)
|
|
2134
|
+
|
|
2135
|
+
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
|
2136
|
+
|
|
2137
|
+
|
|
2138
|
+
class VC8TabArt(AuiDefaultTabArt):
|
|
2139
|
+
""" A class to draw tabs using the Visual Studio 2005 (VC8) style. """
|
|
2140
|
+
|
|
2141
|
+
def __init__(self):
|
|
2142
|
+
""" Default class constructor. """
|
|
2143
|
+
|
|
2144
|
+
AuiDefaultTabArt.__init__(self)
|
|
2145
|
+
|
|
2146
|
+
|
|
2147
|
+
def Clone(self):
|
|
2148
|
+
""" Clones the art object. """
|
|
2149
|
+
|
|
2150
|
+
art = type(self)()
|
|
2151
|
+
art.SetNormalFont(self.GetNormalFont())
|
|
2152
|
+
art.SetSelectedFont(self.GetSelectedFont())
|
|
2153
|
+
art.SetMeasuringFont(self.GetMeasuringFont())
|
|
2154
|
+
|
|
2155
|
+
art = CopyAttributes(art, self)
|
|
2156
|
+
return art
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
def SetSizingInfo(self, tab_ctrl_size, tab_count, minMaxTabWidth):
|
|
2160
|
+
"""
|
|
2161
|
+
Sets the tab sizing information.
|
|
2162
|
+
|
|
2163
|
+
:param wx.Size `tab_ctrl_size`: the size of the tab control area;
|
|
2164
|
+
:param integer `tab_count`: the number of tabs;
|
|
2165
|
+
:param tuple `minMaxTabWidth`: a tuple containing the minimum and maximum tab widths
|
|
2166
|
+
to be used when the ``AUI_NB_TAB_FIXED_WIDTH`` style is active.
|
|
2167
|
+
"""
|
|
2168
|
+
|
|
2169
|
+
AuiDefaultTabArt.SetSizingInfo(self, tab_ctrl_size, tab_count, minMaxTabWidth)
|
|
2170
|
+
|
|
2171
|
+
minTabWidth, maxTabWidth = minMaxTabWidth
|
|
2172
|
+
if minTabWidth > -1:
|
|
2173
|
+
self._fixed_tab_width = max(self._fixed_tab_width, minTabWidth)
|
|
2174
|
+
if maxTabWidth > -1:
|
|
2175
|
+
self._fixed_tab_width = min(self._fixed_tab_width, maxTabWidth)
|
|
2176
|
+
|
|
2177
|
+
self._fixed_tab_width -= 5
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
def GetTabSize(self, dc, wnd, caption, bitmap, active, close_button_state, control=None):
|
|
2181
|
+
"""
|
|
2182
|
+
Returns the tab size for the given caption, bitmap and button state.
|
|
2183
|
+
|
|
2184
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
2185
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
2186
|
+
:param string `caption`: the tab text caption;
|
|
2187
|
+
:param wx.Bitmap `bitmap`: the bitmap displayed on the tab;
|
|
2188
|
+
:param bool `active`: whether the tab is selected or not;
|
|
2189
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
2190
|
+
:param wx.Window `control`: a :class:`wx.Window` instance inside a tab (or ``None``).
|
|
2191
|
+
"""
|
|
2192
|
+
|
|
2193
|
+
tab_size, x_extent = AuiDefaultTabArt.GetTabSize(self, dc, wnd, caption, bitmap,
|
|
2194
|
+
active, close_button_state, control)
|
|
2195
|
+
|
|
2196
|
+
tab_width, tab_height = tab_size
|
|
2197
|
+
|
|
2198
|
+
# add some padding
|
|
2199
|
+
tab_width += 10
|
|
2200
|
+
|
|
2201
|
+
if not bitmap.IsOk():
|
|
2202
|
+
tab_width += 5
|
|
2203
|
+
|
|
2204
|
+
tab_height += 2
|
|
2205
|
+
|
|
2206
|
+
return (tab_width, tab_height), x_extent
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=False):
|
|
2210
|
+
"""
|
|
2211
|
+
Draws a single tab.
|
|
2212
|
+
|
|
2213
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
2214
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
2215
|
+
:param `page`: the tab control page associated with the tab;
|
|
2216
|
+
:param wx.Rect `in_rect`: rectangle the tab should be confined to;
|
|
2217
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
2218
|
+
:param bool `paint_control`: whether to draw the control inside a tab (if any) on a :class:`MemoryDC`.
|
|
2219
|
+
"""
|
|
2220
|
+
|
|
2221
|
+
# Visual Studio 8 style
|
|
2222
|
+
|
|
2223
|
+
control = page.control
|
|
2224
|
+
|
|
2225
|
+
# figure out the size of the tab
|
|
2226
|
+
tab_size, x_extent = self.GetTabSize(dc, wnd, page.caption, page.bitmap,
|
|
2227
|
+
page.active, close_button_state, control)
|
|
2228
|
+
|
|
2229
|
+
tab_height = self._tab_ctrl_height - 1
|
|
2230
|
+
tab_width = tab_size[0]
|
|
2231
|
+
tab_x = in_rect.x
|
|
2232
|
+
tab_y = in_rect.y + in_rect.height - tab_height
|
|
2233
|
+
|
|
2234
|
+
clip_width = tab_width + 3
|
|
2235
|
+
if tab_x + clip_width > in_rect.x + in_rect.width - 4:
|
|
2236
|
+
clip_width = (in_rect.x + in_rect.width) - tab_x - 4
|
|
2237
|
+
|
|
2238
|
+
tabPoints = [wx.Point() for i in range(8)]
|
|
2239
|
+
|
|
2240
|
+
# If we draw the first tab or the active tab,
|
|
2241
|
+
# we draw a full tab, else we draw a truncated tab
|
|
2242
|
+
#
|
|
2243
|
+
# X(2) X(3)
|
|
2244
|
+
# X(1) X(4)
|
|
2245
|
+
#
|
|
2246
|
+
# X(5)
|
|
2247
|
+
#
|
|
2248
|
+
# X(0),(7) X(6)
|
|
2249
|
+
#
|
|
2250
|
+
#
|
|
2251
|
+
|
|
2252
|
+
adjust = 0
|
|
2253
|
+
if not page.active:
|
|
2254
|
+
adjust = 1
|
|
2255
|
+
|
|
2256
|
+
agwFlags = self.GetAGWFlags()
|
|
2257
|
+
tabPoints[0].x = (agwFlags & AUI_NB_BOTTOM and [tab_x] or [tab_x + adjust])[0]
|
|
2258
|
+
tabPoints[0].y = (agwFlags & AUI_NB_BOTTOM and [2] or [tab_height - 3])[0]
|
|
2259
|
+
|
|
2260
|
+
tabPoints[1].x = tabPoints[0].x + tab_height - vertical_border_padding - 3 - adjust
|
|
2261
|
+
tabPoints[1].y = (agwFlags & AUI_NB_BOTTOM and [tab_height - (vertical_border_padding+2)] or \
|
|
2262
|
+
[(vertical_border_padding+2)])[0]
|
|
2263
|
+
|
|
2264
|
+
tabPoints[2].x = tabPoints[1].x + 4
|
|
2265
|
+
tabPoints[2].y = (agwFlags & AUI_NB_BOTTOM and [tab_height - vertical_border_padding] or \
|
|
2266
|
+
[vertical_border_padding])[0]
|
|
2267
|
+
|
|
2268
|
+
tabPoints[3].x = tabPoints[2].x + tab_width - tab_height + vertical_border_padding
|
|
2269
|
+
tabPoints[3].y = (agwFlags & AUI_NB_BOTTOM and [tab_height - vertical_border_padding] or \
|
|
2270
|
+
[vertical_border_padding])[0]
|
|
2271
|
+
|
|
2272
|
+
tabPoints[4].x = tabPoints[3].x + 1
|
|
2273
|
+
tabPoints[4].y = (agwFlags & AUI_NB_BOTTOM and [tabPoints[3].y - 1] or [tabPoints[3].y + 1])[0]
|
|
2274
|
+
|
|
2275
|
+
tabPoints[5].x = tabPoints[4].x + 1
|
|
2276
|
+
tabPoints[5].y = (agwFlags & AUI_NB_BOTTOM and [(tabPoints[4].y - 1)] or [tabPoints[4].y + 1])[0]
|
|
2277
|
+
|
|
2278
|
+
tabPoints[6].x = tabPoints[2].x + tab_width - tab_height + 2 + vertical_border_padding
|
|
2279
|
+
tabPoints[6].y = tabPoints[0].y
|
|
2280
|
+
|
|
2281
|
+
tabPoints[7].x = tabPoints[0].x
|
|
2282
|
+
tabPoints[7].y = tabPoints[0].y
|
|
2283
|
+
|
|
2284
|
+
self.FillVC8GradientColour(dc, tabPoints, page.active)
|
|
2285
|
+
|
|
2286
|
+
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
|
2287
|
+
|
|
2288
|
+
dc.SetPen(wx.Pen(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNSHADOW)))
|
|
2289
|
+
dc.DrawPolygon(tabPoints)
|
|
2290
|
+
|
|
2291
|
+
if page.active:
|
|
2292
|
+
# Delete the bottom line (or the upper one, incase we use wxBOTTOM)
|
|
2293
|
+
dc.SetPen(wx.WHITE_PEN)
|
|
2294
|
+
dc.DrawLine(tabPoints[0].x, tabPoints[0].y, tabPoints[6].x, tabPoints[6].y)
|
|
2295
|
+
|
|
2296
|
+
dc.SetClippingRegion(tab_x, tab_y, clip_width + 2, tab_height - 3)
|
|
2297
|
+
|
|
2298
|
+
drawn_tab_yoff = tabPoints[1].y
|
|
2299
|
+
drawn_tab_height = tabPoints[0].y - tabPoints[2].y
|
|
2300
|
+
|
|
2301
|
+
text_offset = tab_x + 20
|
|
2302
|
+
close_button_width = 0
|
|
2303
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
2304
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
2305
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
2306
|
+
text_offset += close_button_width
|
|
2307
|
+
|
|
2308
|
+
if not page.enabled:
|
|
2309
|
+
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
|
|
2310
|
+
pagebitmap = page.dis_bitmap
|
|
2311
|
+
else:
|
|
2312
|
+
dc.SetTextForeground(page.text_colour)
|
|
2313
|
+
pagebitmap = page.bitmap
|
|
2314
|
+
|
|
2315
|
+
shift = 0
|
|
2316
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
2317
|
+
shift = (page.active and [1] or [2])[0]
|
|
2318
|
+
|
|
2319
|
+
bitmap_offset = 0
|
|
2320
|
+
if pagebitmap.IsOk():
|
|
2321
|
+
bitmap_offset = tab_x + 20
|
|
2322
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT and close_button_width:
|
|
2323
|
+
bitmap_offset += close_button_width
|
|
2324
|
+
|
|
2325
|
+
# draw bitmap
|
|
2326
|
+
dc.DrawBitmap(pagebitmap, bitmap_offset,
|
|
2327
|
+
drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2) + shift,
|
|
2328
|
+
True)
|
|
2329
|
+
|
|
2330
|
+
text_offset = bitmap_offset + pagebitmap.GetWidth()
|
|
2331
|
+
text_offset += 3 # bitmap padding
|
|
2332
|
+
|
|
2333
|
+
else:
|
|
2334
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT == 0 or not close_button_width:
|
|
2335
|
+
text_offset = tab_x + tab_height
|
|
2336
|
+
|
|
2337
|
+
# if the caption is empty, measure some temporary text
|
|
2338
|
+
caption = page.caption
|
|
2339
|
+
if caption == "":
|
|
2340
|
+
caption = "Xj"
|
|
2341
|
+
|
|
2342
|
+
if page.active:
|
|
2343
|
+
dc.SetFont(self._selected_font)
|
|
2344
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
2345
|
+
else:
|
|
2346
|
+
dc.SetFont(self._normal_font)
|
|
2347
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
2348
|
+
|
|
2349
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
2350
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x))
|
|
2351
|
+
else:
|
|
2352
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width)
|
|
2353
|
+
|
|
2354
|
+
ypos = drawn_tab_yoff + drawn_tab_height//2 - texty//2 - 1 + shift
|
|
2355
|
+
|
|
2356
|
+
offset_focus = text_offset
|
|
2357
|
+
|
|
2358
|
+
if control:
|
|
2359
|
+
if control.GetPosition() != wx.Point(text_offset+1, ypos):
|
|
2360
|
+
control.SetPosition(wx.Point(text_offset+1, ypos))
|
|
2361
|
+
|
|
2362
|
+
if not control.IsShown():
|
|
2363
|
+
control.Show()
|
|
2364
|
+
|
|
2365
|
+
if paint_control:
|
|
2366
|
+
bmp = TakeScreenShot(control.GetScreenRect())
|
|
2367
|
+
dc.DrawBitmap(bmp, text_offset+1, ypos, True)
|
|
2368
|
+
|
|
2369
|
+
controlW, controlH = control.GetSize()
|
|
2370
|
+
text_offset += controlW + 4
|
|
2371
|
+
textx += controlW + 4
|
|
2372
|
+
|
|
2373
|
+
# draw tab text
|
|
2374
|
+
rectx, recty, dummy = dc.GetFullMultiLineTextExtent(draw_text)
|
|
2375
|
+
dc.DrawLabel(draw_text, wx.Rect(text_offset, ypos, rectx, recty))
|
|
2376
|
+
|
|
2377
|
+
# draw focus rectangle
|
|
2378
|
+
if (agwFlags & AUI_NB_NO_TAB_FOCUS) == 0:
|
|
2379
|
+
self.DrawFocusRectangle(dc, page, wnd, draw_text, offset_focus, bitmap_offset, drawn_tab_yoff+shift,
|
|
2380
|
+
drawn_tab_height+shift, rectx, recty)
|
|
2381
|
+
|
|
2382
|
+
out_button_rect = wx.Rect()
|
|
2383
|
+
# draw 'x' on tab (if enabled)
|
|
2384
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
2385
|
+
|
|
2386
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
2387
|
+
bmp = self._disabled_close_bmp
|
|
2388
|
+
|
|
2389
|
+
if close_button_state == AUI_BUTTON_STATE_HOVER:
|
|
2390
|
+
bmp = self._hover_close_bmp
|
|
2391
|
+
elif close_button_state == AUI_BUTTON_STATE_PRESSED:
|
|
2392
|
+
bmp = self._pressed_close_bmp
|
|
2393
|
+
|
|
2394
|
+
if page.active:
|
|
2395
|
+
xpos = tab_x + tab_width - close_button_width + 3
|
|
2396
|
+
else:
|
|
2397
|
+
xpos = tab_x + tab_width - close_button_width - 5
|
|
2398
|
+
|
|
2399
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
2400
|
+
rect = wx.Rect(tab_x + 20,
|
|
2401
|
+
drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift,
|
|
2402
|
+
close_button_width, tab_height)
|
|
2403
|
+
else:
|
|
2404
|
+
rect = wx.Rect(xpos,
|
|
2405
|
+
drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift,
|
|
2406
|
+
close_button_width, tab_height)
|
|
2407
|
+
|
|
2408
|
+
# Indent the button if it is pressed down:
|
|
2409
|
+
rect = IndentPressedBitmap(rect, close_button_state)
|
|
2410
|
+
dc.DrawBitmap(bmp, rect.x, rect.y, True)
|
|
2411
|
+
out_button_rect = rect
|
|
2412
|
+
|
|
2413
|
+
out_tab_rect = wx.Rect(tab_x, tab_y, x_extent, tab_height)
|
|
2414
|
+
dc.DestroyClippingRegion()
|
|
2415
|
+
|
|
2416
|
+
return out_tab_rect, out_button_rect, x_extent
|
|
2417
|
+
|
|
2418
|
+
|
|
2419
|
+
def FillVC8GradientColour(self, dc, tabPoints, active):
|
|
2420
|
+
"""
|
|
2421
|
+
Fills the tab with the Visual Studio 2005 gradient background.
|
|
2422
|
+
|
|
2423
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
2424
|
+
:param list `tabPoints`: a list of :class:`wx.Point` objects describing the tab shape;
|
|
2425
|
+
:param bool `active`: whether the tab is selected or not.
|
|
2426
|
+
"""
|
|
2427
|
+
|
|
2428
|
+
xList = [pt.x for pt in tabPoints]
|
|
2429
|
+
yList = [pt.y for pt in tabPoints]
|
|
2430
|
+
|
|
2431
|
+
minx, maxx = min(xList), max(xList)
|
|
2432
|
+
miny, maxy = min(yList), max(yList)
|
|
2433
|
+
|
|
2434
|
+
rect = wx.Rect(minx, maxy, maxx-minx, miny-maxy+1)
|
|
2435
|
+
region = wx.Region(tabPoints)
|
|
2436
|
+
|
|
2437
|
+
if self._buttonRect.width > 0:
|
|
2438
|
+
buttonRegion = wx.Region(*self._buttonRect)
|
|
2439
|
+
region.Xor(buttonRegion)
|
|
2440
|
+
|
|
2441
|
+
dc.SetDeviceClippingRegion(region)
|
|
2442
|
+
|
|
2443
|
+
if active:
|
|
2444
|
+
bottom_colour = top_colour = wx.WHITE
|
|
2445
|
+
else:
|
|
2446
|
+
bottom_colour = StepColour(self._base_colour, 90)
|
|
2447
|
+
top_colour = StepColour(self._base_colour, 170)
|
|
2448
|
+
|
|
2449
|
+
dc.GradientFillLinear(rect, top_colour, bottom_colour, wx.SOUTH)
|
|
2450
|
+
dc.DestroyClippingRegion()
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
class ChromeTabArt(AuiDefaultTabArt):
|
|
2454
|
+
"""
|
|
2455
|
+
A class to draw tabs using the Google Chrome browser style.
|
|
2456
|
+
It uses custom bitmap to render the tabs, so that the look and feel is as close
|
|
2457
|
+
as possible to the Chrome style.
|
|
2458
|
+
"""
|
|
2459
|
+
|
|
2460
|
+
def __init__(self):
|
|
2461
|
+
""" Default class constructor. """
|
|
2462
|
+
|
|
2463
|
+
AuiDefaultTabArt.__init__(self)
|
|
2464
|
+
|
|
2465
|
+
self.SetBitmaps(mirror=False)
|
|
2466
|
+
|
|
2467
|
+
closeBmp = tab_close.GetBitmap()
|
|
2468
|
+
closeHBmp = tab_close_h.GetBitmap()
|
|
2469
|
+
closePBmp = tab_close_p.GetBitmap()
|
|
2470
|
+
|
|
2471
|
+
self.SetCustomButton(AUI_BUTTON_CLOSE, AUI_BUTTON_STATE_NORMAL, closeBmp)
|
|
2472
|
+
self.SetCustomButton(AUI_BUTTON_CLOSE, AUI_BUTTON_STATE_HOVER, closeHBmp)
|
|
2473
|
+
self.SetCustomButton(AUI_BUTTON_CLOSE, AUI_BUTTON_STATE_PRESSED, closePBmp)
|
|
2474
|
+
|
|
2475
|
+
|
|
2476
|
+
def SetAGWFlags(self, agwFlags):
|
|
2477
|
+
"""
|
|
2478
|
+
Sets the tab art flags.
|
|
2479
|
+
|
|
2480
|
+
:param integer `agwFlags`: a combination of the following values:
|
|
2481
|
+
|
|
2482
|
+
==================================== ==================================
|
|
2483
|
+
Flag name Description
|
|
2484
|
+
==================================== ==================================
|
|
2485
|
+
``AUI_NB_TOP`` With this style, tabs are drawn along the top of the notebook
|
|
2486
|
+
``AUI_NB_LEFT`` With this style, tabs are drawn along the left of the notebook. Not implemented yet.
|
|
2487
|
+
``AUI_NB_RIGHT`` With this style, tabs are drawn along the right of the notebook. Not implemented yet.
|
|
2488
|
+
``AUI_NB_BOTTOM`` With this style, tabs are drawn along the bottom of the notebook
|
|
2489
|
+
``AUI_NB_TAB_SPLIT`` Allows the tab control to be split by dragging a tab
|
|
2490
|
+
``AUI_NB_TAB_MOVE`` Allows a tab to be moved horizontally by dragging
|
|
2491
|
+
``AUI_NB_TAB_EXTERNAL_MOVE`` Allows a tab to be moved to another tab control
|
|
2492
|
+
``AUI_NB_TAB_FIXED_WIDTH`` With this style, all tabs have the same width
|
|
2493
|
+
``AUI_NB_SCROLL_BUTTONS`` With this style, left and right scroll buttons are displayed
|
|
2494
|
+
``AUI_NB_WINDOWLIST_BUTTON`` With this style, a drop-down list of windows is available
|
|
2495
|
+
``AUI_NB_CLOSE_BUTTON`` With this style, a close button is available on the tab bar
|
|
2496
|
+
``AUI_NB_CLOSE_ON_ACTIVE_TAB`` With this style, a close button is available on the active tab
|
|
2497
|
+
``AUI_NB_CLOSE_ON_ALL_TABS`` With this style, a close button is available on all tabs
|
|
2498
|
+
``AUI_NB_MIDDLE_CLICK_CLOSE`` Allows to close :class:`~wx.lib.agw.aui.auibook.AuiNotebook` tabs by mouse middle button click
|
|
2499
|
+
``AUI_NB_SUB_NOTEBOOK`` This style is used by :class:`~wx.lib.agw.aui.framemanager.AuiManager` to create automatic AuiNotebooks
|
|
2500
|
+
``AUI_NB_HIDE_ON_SINGLE_TAB`` Hides the tab window if only one tab is present
|
|
2501
|
+
``AUI_NB_SMART_TABS`` Use Smart Tabbing, like ``Alt`` + ``Tab`` on Windows
|
|
2502
|
+
``AUI_NB_USE_IMAGES_DROPDOWN`` Uses images on dropdown window list menu instead of check items
|
|
2503
|
+
``AUI_NB_CLOSE_ON_TAB_LEFT`` Draws the tab close button on the left instead of on the right (a la Camino browser)
|
|
2504
|
+
``AUI_NB_TAB_FLOAT`` Allows the floating of single tabs. Known limitation: when the notebook is more or less full
|
|
2505
|
+
screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
|
|
2506
|
+
``AUI_NB_DRAW_DND_TAB`` Draws an image representation of a tab while dragging (on by default)
|
|
2507
|
+
``AUI_NB_ORDER_BY_ACCESS`` Tab navigation order by last access time for the tabs
|
|
2508
|
+
``AUI_NB_NO_TAB_FOCUS`` Don't draw tab focus rectangle
|
|
2509
|
+
==================================== ==================================
|
|
2510
|
+
|
|
2511
|
+
:note: Overridden from :class:`AuiDefaultTabArt`.
|
|
2512
|
+
"""
|
|
2513
|
+
|
|
2514
|
+
if agwFlags & AUI_NB_TOP:
|
|
2515
|
+
self.SetBitmaps(mirror=False)
|
|
2516
|
+
elif agwFlags & AUI_NB_BOTTOM:
|
|
2517
|
+
self.SetBitmaps(mirror=True)
|
|
2518
|
+
|
|
2519
|
+
AuiDefaultTabArt.SetAGWFlags(self, agwFlags)
|
|
2520
|
+
|
|
2521
|
+
|
|
2522
|
+
def SetBitmaps(self, mirror):
|
|
2523
|
+
"""
|
|
2524
|
+
Assigns the tab custom bitmaps
|
|
2525
|
+
|
|
2526
|
+
:param bool `mirror`: whether to vertically mirror the bitmap or not.
|
|
2527
|
+
"""
|
|
2528
|
+
|
|
2529
|
+
bmps = [tab_active_left.GetBitmap(), tab_active_center.GetBitmap(),
|
|
2530
|
+
tab_active_right.GetBitmap(), tab_inactive_left.GetBitmap(),
|
|
2531
|
+
tab_inactive_center.GetBitmap(), tab_inactive_right.GetBitmap()]
|
|
2532
|
+
|
|
2533
|
+
if mirror:
|
|
2534
|
+
for indx, bmp in enumerate(bmps):
|
|
2535
|
+
img = bmp.ConvertToImage()
|
|
2536
|
+
img = img.Mirror(horizontally=False)
|
|
2537
|
+
bmps[indx] = img.ConvertToBitmap()
|
|
2538
|
+
|
|
2539
|
+
self._leftActiveBmp = bmps[0]
|
|
2540
|
+
self._centerActiveBmp = bmps[1]
|
|
2541
|
+
self._rightActiveBmp = bmps[2]
|
|
2542
|
+
self._leftInactiveBmp = bmps[3]
|
|
2543
|
+
self._centerInactiveBmp = bmps[4]
|
|
2544
|
+
self._rightInactiveBmp = bmps[5]
|
|
2545
|
+
|
|
2546
|
+
|
|
2547
|
+
def Clone(self):
|
|
2548
|
+
""" Clones the art object. """
|
|
2549
|
+
|
|
2550
|
+
art = type(self)()
|
|
2551
|
+
art.SetNormalFont(self.GetNormalFont())
|
|
2552
|
+
art.SetSelectedFont(self.GetSelectedFont())
|
|
2553
|
+
art.SetMeasuringFont(self.GetMeasuringFont())
|
|
2554
|
+
|
|
2555
|
+
art = CopyAttributes(art, self)
|
|
2556
|
+
return art
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
def SetSizingInfo(self, tab_ctrl_size, tab_count, minMaxTabWidth):
|
|
2560
|
+
"""
|
|
2561
|
+
Sets the tab sizing information.
|
|
2562
|
+
|
|
2563
|
+
:param wx.Size `tab_ctrl_size`: the size of the tab control area;
|
|
2564
|
+
:param integer `tab_count`: the number of tabs;
|
|
2565
|
+
:param tuple `minMaxTabWidth`: a tuple containing the minimum and maximum tab widths
|
|
2566
|
+
to be used when the ``AUI_NB_TAB_FIXED_WIDTH`` style is active.
|
|
2567
|
+
"""
|
|
2568
|
+
|
|
2569
|
+
AuiDefaultTabArt.SetSizingInfo(self, tab_ctrl_size, tab_count, minMaxTabWidth)
|
|
2570
|
+
|
|
2571
|
+
minTabWidth, maxTabWidth = minMaxTabWidth
|
|
2572
|
+
if minTabWidth > -1:
|
|
2573
|
+
self._fixed_tab_width = max(self._fixed_tab_width, minTabWidth)
|
|
2574
|
+
if maxTabWidth > -1:
|
|
2575
|
+
self._fixed_tab_width = min(self._fixed_tab_width, maxTabWidth)
|
|
2576
|
+
|
|
2577
|
+
self._fixed_tab_width -= 5
|
|
2578
|
+
|
|
2579
|
+
|
|
2580
|
+
def GetTabSize(self, dc, wnd, caption, bitmap, active, close_button_state, control=None):
|
|
2581
|
+
"""
|
|
2582
|
+
Returns the tab size for the given caption, bitmap and button state.
|
|
2583
|
+
|
|
2584
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
2585
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
2586
|
+
:param string `caption`: the tab text caption;
|
|
2587
|
+
:param wx.Bitmap `bitmap`: the bitmap displayed on the tab;
|
|
2588
|
+
:param bool `active`: whether the tab is selected or not;
|
|
2589
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
2590
|
+
:param wx.Window `control`: a :class:`wx.Window` instance inside a tab (or ``None``).
|
|
2591
|
+
"""
|
|
2592
|
+
|
|
2593
|
+
tab_size, x_extent = AuiDefaultTabArt.GetTabSize(self, dc, wnd, caption, bitmap,
|
|
2594
|
+
active, close_button_state, control)
|
|
2595
|
+
|
|
2596
|
+
tab_width, tab_height = tab_size
|
|
2597
|
+
|
|
2598
|
+
# add some padding
|
|
2599
|
+
tab_width += self._leftActiveBmp.GetWidth()
|
|
2600
|
+
tab_height += 2
|
|
2601
|
+
|
|
2602
|
+
tab_height = max(tab_height, self._centerActiveBmp.GetHeight())
|
|
2603
|
+
|
|
2604
|
+
return (tab_width, tab_height), x_extent
|
|
2605
|
+
|
|
2606
|
+
|
|
2607
|
+
def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=False):
|
|
2608
|
+
"""
|
|
2609
|
+
Draws a single tab.
|
|
2610
|
+
|
|
2611
|
+
:param `dc`: a :class:`wx.DC` device context;
|
|
2612
|
+
:param `wnd`: a :class:`wx.Window` instance object;
|
|
2613
|
+
:param `page`: the tab control page associated with the tab;
|
|
2614
|
+
:param wx.Rect `in_rect`: rectangle the tab should be confined to;
|
|
2615
|
+
:param integer `close_button_state`: the state of the close button on the tab;
|
|
2616
|
+
:param bool `paint_control`: whether to draw the control inside a tab (if any) on a :class:`MemoryDC`.
|
|
2617
|
+
"""
|
|
2618
|
+
|
|
2619
|
+
# Chrome tab style
|
|
2620
|
+
|
|
2621
|
+
control = page.control
|
|
2622
|
+
# figure out the size of the tab
|
|
2623
|
+
tab_size, x_extent = self.GetTabSize(dc, wnd, page.caption, page.bitmap, page.active,
|
|
2624
|
+
close_button_state, control)
|
|
2625
|
+
|
|
2626
|
+
agwFlags = self.GetAGWFlags()
|
|
2627
|
+
|
|
2628
|
+
tab_height = self._tab_ctrl_height - 1
|
|
2629
|
+
tab_width = tab_size[0]
|
|
2630
|
+
tab_x = in_rect.x
|
|
2631
|
+
tab_y = in_rect.y + in_rect.height - tab_height
|
|
2632
|
+
clip_width = tab_width
|
|
2633
|
+
|
|
2634
|
+
if tab_x + clip_width > in_rect.x + in_rect.width - 4:
|
|
2635
|
+
clip_width = (in_rect.x + in_rect.width) - tab_x - 4
|
|
2636
|
+
|
|
2637
|
+
dc.SetClippingRegion(tab_x, tab_y, clip_width + 1, tab_height - 3)
|
|
2638
|
+
drawn_tab_yoff = 1
|
|
2639
|
+
|
|
2640
|
+
if page.active:
|
|
2641
|
+
left = self._leftActiveBmp
|
|
2642
|
+
center = self._centerActiveBmp
|
|
2643
|
+
right = self._rightActiveBmp
|
|
2644
|
+
else:
|
|
2645
|
+
left = self._leftInactiveBmp
|
|
2646
|
+
center = self._centerInactiveBmp
|
|
2647
|
+
right = self._rightInactiveBmp
|
|
2648
|
+
|
|
2649
|
+
dc.DrawBitmap(left, tab_x, tab_y)
|
|
2650
|
+
leftw = left.GetWidth()
|
|
2651
|
+
centerw = center.GetWidth()
|
|
2652
|
+
rightw = right.GetWidth()
|
|
2653
|
+
|
|
2654
|
+
available = tab_x + tab_width - rightw
|
|
2655
|
+
posx = tab_x + leftw
|
|
2656
|
+
|
|
2657
|
+
while 1:
|
|
2658
|
+
if posx >= available:
|
|
2659
|
+
break
|
|
2660
|
+
dc.DrawBitmap(center, posx, tab_y)
|
|
2661
|
+
posx += centerw
|
|
2662
|
+
|
|
2663
|
+
dc.DrawBitmap(right, posx, tab_y)
|
|
2664
|
+
|
|
2665
|
+
drawn_tab_height = center.GetHeight()
|
|
2666
|
+
text_offset = tab_x + leftw
|
|
2667
|
+
|
|
2668
|
+
close_button_width = 0
|
|
2669
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
2670
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
2671
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
2672
|
+
text_offset += close_button_width
|
|
2673
|
+
|
|
2674
|
+
if not page.enabled:
|
|
2675
|
+
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
|
|
2676
|
+
pagebitmap = page.dis_bitmap
|
|
2677
|
+
else:
|
|
2678
|
+
dc.SetTextForeground(page.text_colour)
|
|
2679
|
+
pagebitmap = page.bitmap
|
|
2680
|
+
|
|
2681
|
+
bitmap_offset = 0
|
|
2682
|
+
if pagebitmap.IsOk():
|
|
2683
|
+
bitmap_offset = tab_x + leftw
|
|
2684
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT and close_button_width:
|
|
2685
|
+
bitmap_offset += close_button_width
|
|
2686
|
+
|
|
2687
|
+
# draw bitmap
|
|
2688
|
+
dc.DrawBitmap(pagebitmap, bitmap_offset,
|
|
2689
|
+
drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2),
|
|
2690
|
+
True)
|
|
2691
|
+
|
|
2692
|
+
text_offset = bitmap_offset + pagebitmap.GetWidth()
|
|
2693
|
+
text_offset += 3 # bitmap padding
|
|
2694
|
+
|
|
2695
|
+
else:
|
|
2696
|
+
|
|
2697
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT == 0 or not close_button_width:
|
|
2698
|
+
text_offset = tab_x + leftw
|
|
2699
|
+
|
|
2700
|
+
# if the caption is empty, measure some temporary text
|
|
2701
|
+
caption = page.caption
|
|
2702
|
+
if caption == "":
|
|
2703
|
+
caption = "Xj"
|
|
2704
|
+
|
|
2705
|
+
if page.active:
|
|
2706
|
+
dc.SetFont(self._selected_font)
|
|
2707
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
2708
|
+
else:
|
|
2709
|
+
dc.SetFont(self._normal_font)
|
|
2710
|
+
textx, texty, dummy = dc.GetFullMultiLineTextExtent(caption)
|
|
2711
|
+
|
|
2712
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
2713
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - leftw)
|
|
2714
|
+
else:
|
|
2715
|
+
draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width - leftw)
|
|
2716
|
+
|
|
2717
|
+
ypos = drawn_tab_yoff + drawn_tab_height//2 - texty//2 - 1
|
|
2718
|
+
|
|
2719
|
+
if control:
|
|
2720
|
+
if control.GetPosition() != wx.Point(text_offset+1, ypos):
|
|
2721
|
+
control.SetPosition(wx.Point(text_offset+1, ypos))
|
|
2722
|
+
|
|
2723
|
+
if not control.IsShown():
|
|
2724
|
+
control.Show()
|
|
2725
|
+
|
|
2726
|
+
if paint_control:
|
|
2727
|
+
bmp = TakeScreenShot(control.GetScreenRect())
|
|
2728
|
+
dc.DrawBitmap(bmp, text_offset+1, ypos, True)
|
|
2729
|
+
|
|
2730
|
+
controlW, controlH = control.GetSize()
|
|
2731
|
+
text_offset += controlW + 4
|
|
2732
|
+
|
|
2733
|
+
# draw tab text
|
|
2734
|
+
rectx, recty, dummy = dc.GetFullMultiLineTextExtent(draw_text)
|
|
2735
|
+
dc.DrawLabel(draw_text, wx.Rect(text_offset, ypos, rectx, recty))
|
|
2736
|
+
|
|
2737
|
+
out_button_rect = wx.Rect()
|
|
2738
|
+
# draw 'x' on tab (if enabled)
|
|
2739
|
+
if close_button_state != AUI_BUTTON_STATE_HIDDEN:
|
|
2740
|
+
|
|
2741
|
+
close_button_width = self._active_close_bmp.GetWidth()
|
|
2742
|
+
bmp = self._disabled_close_bmp
|
|
2743
|
+
|
|
2744
|
+
if close_button_state == AUI_BUTTON_STATE_HOVER:
|
|
2745
|
+
bmp = self._hover_close_bmp
|
|
2746
|
+
elif close_button_state == AUI_BUTTON_STATE_PRESSED:
|
|
2747
|
+
bmp = self._pressed_close_bmp
|
|
2748
|
+
|
|
2749
|
+
if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
|
|
2750
|
+
rect = wx.Rect(tab_x + leftw - 2,
|
|
2751
|
+
drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + 1,
|
|
2752
|
+
close_button_width, tab_height)
|
|
2753
|
+
else:
|
|
2754
|
+
rect = wx.Rect(tab_x + tab_width - close_button_width - rightw + 2,
|
|
2755
|
+
drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + 1,
|
|
2756
|
+
close_button_width, tab_height)
|
|
2757
|
+
|
|
2758
|
+
if agwFlags & AUI_NB_BOTTOM:
|
|
2759
|
+
rect.y -= 1
|
|
2760
|
+
|
|
2761
|
+
# Indent the button if it is pressed down:
|
|
2762
|
+
rect = IndentPressedBitmap(rect, close_button_state)
|
|
2763
|
+
dc.DrawBitmap(bmp, rect.x, rect.y, True)
|
|
2764
|
+
out_button_rect = rect
|
|
2765
|
+
|
|
2766
|
+
out_tab_rect = wx.Rect(tab_x, tab_y, tab_width, tab_height)
|
|
2767
|
+
dc.DestroyClippingRegion()
|
|
2768
|
+
|
|
2769
|
+
return out_tab_rect, out_button_rect, x_extent
|
|
2770
|
+
|
|
2771
|
+
|