| | 49 | class dPageFrameStyled(dPageFrameMixin, fnb.FlatNotebook): |
|---|
| | 50 | """Creates a pageframe, which can contain an unlimited number of pages. |
|---|
| | 51 | |
|---|
| | 52 | Typically, your pages will descend from dPage, but they can in fact be any |
|---|
| | 53 | Dabo visual control, such as a dPanel, dEditBox, etc. |
|---|
| | 54 | """ |
|---|
| | 55 | _evtPageChanged = readonly(fnb.EVT_FLATNOTEBOOK_PAGE_CHANGED) |
|---|
| | 56 | _evtPageChanging = readonly(fnb.EVT_FLATNOTEBOOK_PAGE_CHANGING) |
|---|
| | 57 | _tabposBottom = readonly(fnb.FNB_BOTTOM) |
|---|
| | 58 | _tabstyleDefault = readonly(fnb.FNB_DEFAULT_STYLE) |
|---|
| | 59 | _tabstyleVC8 = readonly(fnb.FNB_VC8) |
|---|
| | 60 | _tabstyleVC7 = readonly(fnb.FNB_VC71) |
|---|
| | 61 | _tabstyleFancy = readonly(fnb.FNB_FANCY_TABS) |
|---|
| | 62 | _tabstyleColorful = readonly(fnb.FNB_COLORFUL_TABS) |
|---|
| | 63 | _tabstyleNoXBtn = readonly(fnb.FNB_NO_X_BUTTON) |
|---|
| | 64 | _tabstyleXOnTab = readonly(fnb.FNB_X_ON_TAB) |
|---|
| | 65 | _tabstyleNoNavBtn = readonly(fnb.FNB_NO_NAV_BUTTONS) |
|---|
| | 66 | _tabstyleNoDrag = readonly(fnb.FNB_NODRAG) |
|---|
| | 67 | _tabstyleMiddleClose = readonly(fnb.FNB_MOUSE_MIDDLE_CLOSES_TABS) |
|---|
| | 68 | _tabstyleDClickClose = readonly(fnb.FNB_DCLICK_CLOSES_TABS) |
|---|
| | 69 | _tabstyleBGGradient = readonly(fnb.FNB_BACKGROUND_GRADIENT) |
|---|
| | 70 | _tabstyleTabList = readonly(fnb.FNB_DROPDOWN_TABS_LIST) |
|---|
| | 71 | _tabstyleSmartTab = readonly(fnb.FNB_SMART_TABS) |
|---|
| | 72 | _tabstyleForeignDnD = readonly(fnb.FNB_ALLOW_FOREIGN_DND) |
|---|
| | 73 | _tabstyleHideSingleTab = readonly(fnb.FNB_HIDE_ON_SINGLE_TAB) |
|---|
| | 74 | |
|---|
| | 75 | def __init__(self, parent, properties=None, attProperties=None, *args, **kwargs): |
|---|
| | 76 | self._baseClass = dPageFrame |
|---|
| | 77 | preClass = fnb.FlatNotebook |
|---|
| | 78 | |
|---|
| | 79 | cm.dControlMixin.__init__(self, preClass, parent, properties, attProperties, *args, **kwargs) |
|---|
| | 80 | # Dictionary for tracking images by key value |
|---|
| | 81 | self._imageList = {} |
|---|
| | 82 | |
|---|
| | 83 | # Dictionary for the Various Styles |
|---|
| | 84 | self._styles = {} |
|---|
| | 85 | self._styles['Default'] = _tabstyleDefault |
|---|
| | 86 | self._styles['VC8'] = _tabstyleVC8 |
|---|
| | 87 | self._styles['VC7'] = _tabstyleVC7 |
|---|
| | 88 | self._styles['Fancy'] = _tabstyleFancy |
|---|
| | 89 | self._styles['Colorful'] = _tabstyleColorful |
|---|
| | 90 | self._styles['No X Button'] = _tabstyleNoXBtn |
|---|
| | 91 | self._styles['X On Tab'] = _tabstyleXOnTab |
|---|
| | 92 | self._styles['No Nav Buttons'] = _tabstyleNoNavBtn |
|---|
| | 93 | self._styles['No Drag'] = _tabstyleNpDrag |
|---|
| | 94 | self._styles['Middle Mouse Close'] = _tabstyleMiddleClose |
|---|
| | 95 | self._styles['Double Click Close'] = _tabstyleDCliecClose |
|---|
| | 96 | self._styles['Background Gradient'] = _tabstyleBGGradient |
|---|
| | 97 | self._styles['Tab List'] = _tabstyleTabList |
|---|
| | 98 | self._styles['Smart Tab Switch'] = _tabstyleSmartTab |
|---|
| | 99 | self._styles['Allow Foreign Drag and Drop'] = _tabstyleForeignDnD |
|---|
| | 100 | self._styles['Hide Single Tab'] = _tabstyleHideSingleTab |
|---|
| | 101 | |
|---|
| | 102 | def _afterInit(self): |
|---|
| | 103 | if sys.platform[:3] == "win": |
|---|
| | 104 | ## This keeps Pages from being ugly on Windows: |
|---|
| | 105 | self.SetBackgroundColour(self.GetBackgroundColour()) |
|---|
| | 106 | super(dPageFrameStyled, self)._afterInit() |
|---|
| | 107 | |
|---|
| | 108 | def addStyleFlag(self, flag): |
|---|
| | 109 | if not isinstance(flag, int): |
|---|
| | 110 | flag = self._styles.get(flag) |
|---|
| | 111 | |
|---|
| | 112 | if flag == self._tabstyleDefault: |
|---|
| | 113 | self._delWindowStyleFlag(self._tabstyleVC8) |
|---|
| | 114 | self._delWindowStyleFlag(self._tabstyleVC7) |
|---|
| | 115 | self._delWindowStyleFlag(self._tabstyleFancy) |
|---|
| | 116 | self._delWindowStyleFlag(self._tabstyleColorful) |
|---|
| | 117 | |
|---|
| | 118 | elif flag == self._tabstyleVC8: |
|---|
| | 119 | self._delWindowStyleFlag(self._tabstyleVC7) |
|---|
| | 120 | self._delWindowStyleFlag(self._tabstyleFancy) |
|---|
| | 121 | self._delWindowStyleFlag(self._tabstyleColorful) |
|---|
| | 122 | |
|---|
| | 123 | elif flag == self._tabstyleVC7: |
|---|
| | 124 | self._delWindowStyleFlag(self._tabstyleVC8) |
|---|
| | 125 | self._delWindowStyleFlag(self._tabstyleFancy) |
|---|
| | 126 | self._delWindowStyleFlag(self._tabstyleColorful) |
|---|
| | 127 | |
|---|
| | 128 | elif flag == self._tabstyleFancy: |
|---|
| | 129 | self._delWindowStyleFlag(self._tabstyleVC8) |
|---|
| | 130 | self._delWindowStyleFlag(self._tabstyleVC7) |
|---|
| | 131 | self._delWindowStyleFlag(self._tabstyleColorful) |
|---|
| | 132 | |
|---|
| | 133 | elif flag == self._tabstyleColorful: |
|---|
| | 134 | self._delWindowStyleFlag(self._tabstyleVC8) |
|---|
| | 135 | self._delWindowStyleFlag(self._tabstyleVC7) |
|---|
| | 136 | self._delWindowStyleFlag(self._tabstyleFancy) |
|---|
| | 137 | self._addWindowStyleFlag(self._tabstyleVC8) |
|---|
| | 138 | |
|---|
| | 139 | self._addWindowStyleFlag(flag) |
|---|
| | 140 | |
|---|
| | 141 | self.Refresh() |
|---|
| | 142 | |
|---|
| | 143 | def delStyleFlag(self, flag): |
|---|
| | 144 | if not isinstance(flag, int): |
|---|
| | 145 | flag = self._styles.get(flag) |
|---|
| | 146 | |
|---|
| | 147 | self._delWindowStyleFlag(flag) |
|---|
| | 148 | |
|---|
| | 149 | self.Refresh() |
|---|
| | 150 | |
|---|
| | 151 | def isEnabled(self, pg): |
|---|
| | 152 | return self.GetEnabled(pg) |
|---|
| | 153 | |
|---|
| | 154 | def enable(self, page, enable=True): |
|---|
| | 155 | self.Enable(page, enable) |
|---|
| | 156 | |
|---|
| | 157 | def getPageShapeAngle(self, pg): |
|---|
| | 158 | return self.GetPageShapeAngle(pg) |
|---|
| | 159 | |
|---|
| | 160 | def setPageShapeAngle(self, pg, val): |
|---|
| | 161 | self.SetPageShapeAngle(pg, val) |
|---|
| | 162 | |
|---|
| | 163 | def delStyleFlag(self, flag): |
|---|
| | 164 | self._delWindowStyleFlag(flag) |
|---|
| | 165 | self.Refresh() |
|---|
| | 166 | |
|---|
| | 167 | def _getActiveTabColour(self): |
|---|
| | 168 | return self.GetActiveTabColour() |
|---|
| | 169 | |
|---|
| | 170 | def _setActiveTabColour(self, val): |
|---|
| | 171 | self.SetActiveTabColour(val) |
|---|
| | 172 | |
|---|
| | 173 | |
|---|
| | 174 | def _getActiveTabTextColour(self): |
|---|
| | 175 | return self.GetActiveTabTextColour(self) |
|---|
| | 176 | |
|---|
| | 177 | def _setActiveTabTextColour(self, val): |
|---|
| | 178 | self.SetActiveTabTextColour(val) |
|---|
| | 179 | |
|---|
| | 180 | |
|---|
| | 181 | def _getBorderColour(self): |
|---|
| | 182 | return self.GetBorderColour() |
|---|
| | 183 | |
|---|
| | 184 | def _setBorderColour(self, val): |
|---|
| | 185 | self.SetBorderColour(val) |
|---|
| | 186 | |
|---|
| | 187 | |
|---|
| | 188 | def _getGradientColourBorder(self): |
|---|
| | 189 | return self.GetGradientColourBorder() |
|---|
| | 190 | |
|---|
| | 191 | def _setGradientColourBorder(self, val): |
|---|
| | 192 | self.SetGradientColourBorder(val) |
|---|
| | 193 | |
|---|
| | 194 | |
|---|
| | 195 | def _getGradientColourFrom(self): |
|---|
| | 196 | return self.GetGradientColourFrom() |
|---|
| | 197 | |
|---|
| | 198 | def _setGradientColourFrom(self, val): |
|---|
| | 199 | self.SetGradientColourFrom(val) |
|---|
| | 200 | |
|---|
| | 201 | |
|---|
| | 202 | def _getGradientColourTo(self): |
|---|
| | 203 | return self.GetGradientColourTo() |
|---|
| | 204 | |
|---|
| | 205 | def _setGradientColourTo(self, val): |
|---|
| | 206 | self.SetGradientColourTo(val) |
|---|
| | 207 | |
|---|
| | 208 | |
|---|
| | 209 | def _getNonActiveTabTextColour(self): |
|---|
| | 210 | return self.GetNonActiveTabTextColour() |
|---|
| | 211 | |
|---|
| | 212 | def _setNonActiveTabTextColour(self, val): |
|---|
| | 213 | self.SetNonActiveTabTextColour(val) |
|---|
| | 214 | |
|---|
| | 215 | |
|---|
| | 216 | def _getPadding(self): |
|---|
| | 217 | return self.GetPadding() |
|---|
| | 218 | |
|---|
| | 219 | def _setPadding(self, val): |
|---|
| | 220 | self.SetPadding(val) |
|---|
| | 221 | |
|---|
| | 222 | |
|---|
| | 223 | def _getTabAreaColour(self): |
|---|
| | 224 | return self.GetTabAreaColour() |
|---|
| | 225 | |
|---|
| | 226 | def _setTabAreaColour(self, val): |
|---|
| | 227 | self.SetTabAreaColour(val) |
|---|
| | 228 | |
|---|
| | 229 | ActiveTabColor = property(_getActiveTabColour, _setActiveTabColour, None, |
|---|
| | 230 | _("Get/Sets the active tab color (color)")) |
|---|
| | 231 | |
|---|
| | 232 | ActiveTabTextColor = property(_getActiveTabTextColour, _setActiveTabTextColour, None, |
|---|
| | 233 | _("Get/Sets the Active Tab Text Color (color)")) |
|---|
| | 234 | |
|---|
| | 235 | BorderColor = property(_getBorderColour, _setBorderColour, None, |
|---|
| | 236 | _("Get/Sets the Tab Border Color (color)")) |
|---|
| | 237 | |
|---|
| | 238 | GradientColorBorder = property(_getGradientColourBorder, _setGradientColourBorder, None, |
|---|
| | 239 | _("Get/Sets the Gradient Color (color)")) |
|---|
| | 240 | |
|---|
| | 241 | GradientFromColor = property(_getGradientColourFrom, _setGradientColourFrom, None, |
|---|
| | 242 | _("Get/Sets the Gradient From Color (color)")) |
|---|
| | 243 | |
|---|
| | 244 | GradientToColor = property(_getGradientColourTo, _setGradientColourTo, None, |
|---|
| | 245 | _("Get/Sets the Gradient To Color (color)")) |
|---|
| | 246 | |
|---|
| | 247 | NonActiveTabTextColor = property(_getNonActiveTabTextColour, _setNonActiveTabTextColour, None, |
|---|
| | 248 | _("Get/Sets the NonActive Tab Text Color (color)")) |
|---|
| | 249 | |
|---|
| | 250 | Padding = property(_getPadding, _setPadding, None, |
|---|
| | 251 | _("Get/Sets the Tab Padding (int)")) |
|---|
| | 252 | |
|---|
| | 253 | TabAreaColor = property(_getTabAreaColour, _setTabAreaColour, None, |
|---|
| | 254 | _("Get/Sets the Tab area color (color)")) |
|---|
| | 255 | |
|---|
| | 256 | DynamicActiveTabColor = makeDynamicProperty(ActiveTabColor) |
|---|
| | 257 | DynamicActiveTabTextColor = makeDynamicProperty(ActiveTabTextColor) |
|---|
| | 258 | DynamicBorderColor = makeDynamicProperty(BorderColor) |
|---|
| | 259 | DynamicGradientColorBorder = makeDynamicProperty(GradientColorBorder) |
|---|
| | 260 | DynamicGradientFromColor = makeDynamicProperty(GradientFromColor) |
|---|
| | 261 | DynamicGradientToColor = makeDynamicProperty(GradientToColor) |
|---|
| | 262 | DynamicNonActiveTabTextColor = makeDynamicProperty(NonActiveTabTextColor) |
|---|
| | 263 | DynamicPadding = makeDynamicProperty(Padding) |
|---|
| | 264 | DynamicTabAreaColor = makeDynamicProperty(TabAreaColor) |
|---|