This library will add and apply a theme color for All Windows and Gadgets
And for All possible color attributes (BackColor, FrontColor, TitleBackColor,...) for each of them
All gadgets will still work in the same way as PureBasic Gadget
How tu use:
Add: XIncludeFile "ObjectTheme.pbi"
Add: UseModule ObjectTheme if you use the module version (Mandatory)
And apply a theme with the function:
- - SetObjectTheme(#ObjectTheme [, WindowColor])
- - - With #ObjectTheme = #ObjectTheme_DarkBlue, #ObjectTheme_DarkRed, #ObjectTheme_LightBlue or #ObjectTheme_Auto
Easy ;) That's all :)
SetObjectTheme(#ObjectTheme_DarkBlue):
SetObjectTheme(#ObjectTheme_DarkRed):
SetObjectTheme(#ObjectTheme_LightBlue):
SetObjectTheme(#SetObjectTheme(#ObjectTheme_Auto, #Black)):
Supported Gadget
Window, Button, ButtonImage, Calendar, CheckBox, ComboBox, Container, Date, Editor, ExplorerList, ExplorerTree, Frame, HyperLink, ListIcon, ListView, Option, Panel, ProgressBar, ScrollArea, ScrollBar, Spin, Splitter, String, Text, TrackBar, Tree
Note that you can SetObjectTheme(Theme [, WindowColor]) anywhere you like in your source, before or after creating the window, gadget's
But note the special case for the ComboBox Gadget:
- Either you call the SetObjectTheme() function at the beginning of the program before creating the Windows and ComboBoxes
- Or add the flags #CBS_HASSTRINGS | #CBS_OWNERDRAWFIXED to the ComboBoxes (but Not for the ComboBox_Image) so that the drop-down List is painted
See ObjectTheme_DataSection.pbi for the theme color attribute for each GadgetType
-
It uses the same attributes as SetGadgetColor()
#PB_Gadget_FrontColor, #PB_Gadget_BackColor, #PB_Gadget_LineColor, #PB_Gadget_TitleFrontColor, #PB_Gadget_TitleBackColor, #PB_Gadget_GrayTextColor -
With new attributes
#PB_Gadget_DarkMode, #PB_Gadget_ActiveTab, #PB_Gadget_InactiveTab, #PB_Gadget_HighLightColor, #PB_Gadget_EditBoxColor, #PB_Gadget_OuterColor, #PB_Gadget_CornerColor, #PB_Gadget_GrayBackColor, #PB_Gadget_EnableShadow, #PB_Gadget_ShadowColor, #PB_Gadget_BorderColor, #PB_Gadget_RoundX, #PB_Gadget_RoundY, #PB_Gadget_SplitterBorder, #PB_Gadget_SplitterBorderColor, #PB_Gadget_UseUxGripper, #PB_Gadget_GripperColor, #PB_Gadget_LargeGripper
Add: XIncludeFile "ObjectTheme.pbi"
Add: UseModule ObjectTheme if you use the module version (Mandatory)
- SetObjectTheme(#ObjectTheme [, WindowColor])
Apply or change a Theme. Optional WindowColor, the new color to use for the window background
-- Ex: SetObjectTheme(#ObjectTheme_DarkBlue)
-- Ex: SetObjectTheme(#ObjectTheme_LightBlue)
-- Ex: SetObjectTheme(#ObjectTheme_Auto, #Black)
-
GetObjectTheme()
Get the current theme -
IsObjectTheme(#Gadget)
Is the Gadget included in ObjectTheme ? -
SetObjectThemeAttribute(ObjectType, #Attribut, Value)
Changes a theme color attribute value
Dependent color attributes with #PB_Default value, will be recalculated according to this new color
-- Ex: SetObjectThemeAttribute(#PB_GadgetType_Button, #PB_Gadget_BackColor, #Blue) to change the theme Button back color attribute in blue
- GetObjectThemeAttribute(ObjectType, #Attribut)
Returns a theme color attribute value
-- Ex: GetObjectThemeAttribute(#PB_GadgetType_Button, #PB_Gadget_BackColor)
- SetObjectTypeColor(ObjectType, Attribute, Value)
Changes a color attribute value for a gadget type. The Theme color attribute value is preserved
-- Ex: SetObjectTypeColor(#PB_GadgetType_Button, #PB_Gadget_BackColor, #Blue) to change the back color for each Button in blue
- SetObjectColor(#Gadget, #Attribut, Value)
Changes a color attribute on the given gadget
-- Ex: SetObjectColor(#Gadget, #PB_Gadget_BackColor, #Blue) to change the Gadget back color in blue
- GetObjectColor(#Gadget, #Attribut)
Returns a Gadget color attribute value
-- Ex: GetObjectColor(#Gadget, #PB_Gadget_BackColor)