Page 1 of 1

PureCOLOR library for Linux (v 0.1)

Posted: Fri May 25, 2007 9:54 pm
by walker
to make it easier for cross plattfrom development (at least I did need it as I use the fabulous PureColor lib from gnozal on Windows) I decided to create a userlib which has the same commandset as the Lib on Windows made by gnozal.

hope, this is usefull for someone else...

Supported commands are (so far):

PureCOLOR_SetButtonColor(gadgetid.l,text_color,back_color,text_pressed_color,pressed_color)
PureCOLOR_SetGadgetColor(gadgetid.l,text_color,back_color)
PureCOLOR_SetWindowColor(GadgetId.l) (which is only a wrapper for the builtin pb command SetWindowColor())
PureCOLOR_SetMenuColors(MenuNumber.l , Text_Color.l, Back_Color.l, TextColorSelected.l, BackColorSelected.l) (which only applies a color to the menubar and the highlighted menuentry... if the theming engine allows this)
PureCOLOR_ClearAllColorsForGadget(GadgetId.l)
PureCOLOR_ClearWindowColor(WindowNumber.l)

all other commans are implemented but do nothing and always return 1

The GadgetID could be the Gadgetnumber or the gadgetId (to be compatible with the Windows version always use the GadgetNumber)
The colors are all RGB colors

Two things re different to the Win-version: The Menu colors are not working as you may expect it (and it's not easy to color a gtk menu like a win-menu as there is always a theming engine)

Buttons on linux have 3 states.... 2 of them are covered by the command (normal and pressed) the third one is when the mouse is over a button (highlighted) this color is calculated from the normal button color (this color is slightly lighter)

And you can't color a ComboBoxGadget().....

a screenshot:
Image

the demo source:

Code: Select all


OpenWindow(0, 100, 150, 500,500,  "PureColor -  Linux",#PB_Window_SystemMenu|#PB_Window_Invisible)
If CreateGadgetList(WindowID(0))
;     ExplorerTreeGadget(10,280,230,200,200,"/")
    ButtonGadget(0,10,10,100,28,"button")
    ButtonGadget(1,10,50,100,28,"toggle",#PB_Button_Toggle)
    StringGadget(2,10,90,100,30,"My Text")
    CheckBoxGadget(3,10,130,100,30,"My Text")
    ListIconGadget(4,120,10,100,200,"Header 1",100)
        AddGadgetItem(4,-1,"entry 1")
        AddGadgetItem(4,-1,"entry 2")
    ComboBoxGadget(5,10,220,100,30)
        AddGadgetItem(5,-1,"entry 1")
        AddGadgetItem(5,-1,"entry 2")
    ListViewGadget(6,230,10,100,200)
        AddGadgetItem(6,-1,"entry 1")        
        AddGadgetItem(6,-1,"entry 2")                
    OptionGadget(7,10,260,00,30,"Option1")
    OptionGadget(8,10,290,00,30,"Option2")
    TreeGadget(9,10,330,200,60)
        AddGadgetItem(9,-1,"entry1",0,0)
        AddGadgetItem(9,-1,"subentry1",0,1)
    ExplorerTreeGadget(10,280,230,200,200,"/")
    mymenu=CreateMenu(0,WindowID(0))
    MenuTitle("Datei")
    m1=MenuItem(1,"mymenuitem")
    m2=MenuItem(2,"mymenuitem")
    m3=MenuItem(3,"mymenuitem")

EndIf
; SetWindowColor(0,255)
PureCOLOR_SetButtonColor((0),RGB(101, 31, 51),RGB(183, 179, 72),RGB(111, 213, 144),RGB(95, 137, 148))
PureCOLOR_SetButtonColor(GadgetID(1),RGB(0, 0, 0),RGB(95, 137, 148),RGB(33, 118, 222),RGB(251, 126, 4))

PureCOLOR_SetGadgetColor((2),RGB(30, 53, 225),RGB(109, 250, 146))
PureCOLOR_SetGadgetColor((3),RGB(127, 238, 241),RGB(112, 15, 143))
PureCOLOR_SetGadgetColor(GadgetID(4),RGB(83, 18, 172),RGB(205, 113, 140))
PureCOLOR_SetGadgetColor(GadgetID(5),RGB(83, 18, 172),RGB(113, 198, 233))
PureCOLOR_SetGadgetColor(GadgetID(6),RGB(83, 18, 172),RGB(113, 198, 233))
PureCOLOR_SetGadgetColor(GadgetID(7),RGB(83, 18, 172),RGB(113, 198, 233))
PureCOLOR_SetGadgetColor(GadgetID(8),RGB(83, 18, 172),RGB(113, 198, 233))
PureCOLOR_SetGadgetColor(GadgetID(9),RGB(83, 18, 172),RGB(247, 153, 98))
PureCOLOR_SetGadgetColor(GadgetID(10),RGB(83, 18, 172),RGB(74, 145, 181))

PureCOLOR_SetWindowColor(0,RGB(184, 246, 204))

PureCOLOR_SetMenuColors(0,RGB(80, 24, 41),RGB(154, 204, 253),RGB(187, 229, 92),RGB(92, 32, 105))

;PureCOLOR_ClearAllColorsForGadget(0)
HideWindow(0,#False)
Repeat
    event=WaitWindowEvent(10)
Until event=#PB_Event_CloseWindow
and at least the userlib to download:
http://home.arcor.de/x-linux/pure/pure_color

downloadlink for the resident file:
http://home.arcor.de/x-linux/pure/pure_color.res

place the file in your ./purebasic/purelibraries/userlibraries/ folder and restart the compiler .... enjoy :D

Posted: Fri May 25, 2007 10:07 pm
by bembulak
Thanks! That's an enhancement and I'm happy, that the Penguins follow up with the libs!

Posted: Sat May 26, 2007 4:06 am
by Beach
Thanks Walker! I noticed a couple of the gadgets did not get the color change. Any ideas?

Image

I am on Ubuntu 7.04

Posted: Sat May 26, 2007 5:26 am
by walker
...hmm.. maybe the theme which overrrides the color.. I will have a look (the screenie is made on Ubuntu 6.10 with enlightment as windowmanager but works on gnome too)

anyone else with the same result as beach??

I'm downloading 7.04 now....


[EDIT] it IS the Theme which does the difference... you're using the human theme... right? if you choose i.e. clearlooks or another theme, the result should be as expected)
[/EDIT]

Posted: Sat May 26, 2007 5:39 am
by Beach
You are correct sir... :oops:

Works fine now...

Posted: Sun May 27, 2007 10:56 am
by walker
.... unfortunately I'd forgot the res-file :oops: the downloadlink is added in the first post....

Maybe there is a way to override the theme engine... but it's a bit complicated ... I will see....