[good] Re: [Gtk-sharp-list] simple button style change ...

Anset Anset at anset.org
Fri Aug 5 05:51:17 EDT 2005


Hi,

since I am doing style and theme stuff on winxp, I would be surprised if 
kde is breaking this...

On linux I am using gnome, not kde, so I cannot test it quickly...

Anset.

ted leslie wrote:
> arggh......
> 
> ok i simply ran my app on a different system
> and it worked with the styles through the rcgtk and parsestring (in app)
> 
> i run a kde on suse 9.2 and determined that NO gtk based app
> is doing sqwat with the style specs. (or themes for that matter)
> yet i put a gnome on another X screen and run the
> gtk#/mono apps all if fine,
> 
> on a redhat installed machine  i got it to run on gnome and kde desktops just fine,
> 
> i have a stock 9.2 suse, i dunno why its doing this, but screw it,
> i will upgrade to suse 9.3 with full installed components for both desktops
> (maybe even give gnome a try) and hopefully this issue will be
> behind me.
> 
> I will give an update as to whether i can change styles
> on widgets other then rc or parsestring methods,
> to concur if in fact there is a bug with the direct widget manipulation
> of styles. 
> 
> -tl
> 
> 
> On Thu, Aug 04, 2005 at 04:28:59PM +0200, Anset wrote:
> 
>>Hi,
>>
>>On both os you can find examples of resource files. do a search for 
>>gtkrc files and you should find a few. On windows you will find them 
>>under the directory where you installed GTK.
>>
>>The best documentation is to be found on the gnome developer website. 
>>look at the api documentation.
>>
>>of course it is all C code, but you should get the point.
>>The only problem is that the RC class is not fully ported yet. 
>>(depending on your version of gtk#, your success wil vary).
>>
>>So if things do not seem to work for you, take a look at the custom 
>>files on svn.myrealbox.org to see what has been "ported".
>>
>>Below are the examples you asked for. MAKE SURE TO GIVE YOUR WIDGET A 
>>NAME! that is how the styles are matched.
>>
>>Here is a part of a resource file:
>>
>>############
>># Defaults #
>>############
>>
>>style "Default_Style"
>>{
>>	font_name  = "Times new Roman 10"
>>	fg[NORMAL] = "#000000"
>>
>>	bg_pixmap[NORMAL]      = "ice.png"
>>	bg_pixmap[ACTIVE]      = "cork.png"
>>	bg_pixmap[PRELIGHT]    = "camouflage.png"
>>	bg_pixmap[INSENSITIVE] = "purple_marble.png"
>>
>>  engine "pixmap"
>>  {
>>  }
>>
>>}
>>
>>class "GtkWidget" style "Default_Style"
>>
>>#widget "*" style "Default_Style"
>>#widget "DDD_Main_Window" style "Default_Style"
>>#widget "DDD_Main_Window.*" style "Default_Style"
>>
>>##################
>># Startup Dialog #
>>##################
>>
>>style "Startup_Dialog_Title_Style"
>>{
>>	font_name  = "Times new Roman Bold 12"
>>	fg[NORMAL] = "#000000"
>>
>>}
>>widget "*.Startup_Dialog_Title"	style "Startup_Dialog_Title_Style"
>>
>>
>>
>>Here is an example parsing a string in your program:
>>Basically you just put the text you would put in the resource file in a 
>>string and then parse it. It's a lot less clear, but this way you can 
>>"hide" style settings.
>>
>>Gtk.Rc.ParseString( "pixmap_path \"images\"\n"+
>>	"style \"Startup_Dialog_Style\" {\n"+
>>	"bg_pixmap[NORMAL] = \"startup.png\"\"\n"+
>>	"}\n"+
>>	"widget \"*Startup_Dialog\" style \"Startup_Dialog_Style\"");
>>
>>
>>ted leslie wrote:
>>
>>>do you have any examples of this, 
>>>i see some for GTKmm but thats not quite the same.
>>>
>>>any code snipets, file?
>>>
>>>-tl
>>>
>>>On Thu, Aug 04, 2005 at 03:37:56PM +0200, Anset wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>The only way I found that works is using a resource file, or building a 
>>>>resource string and then parse it using the RC class.
>>>>
>>>>Afaik, rcstyle in gtk# is broken.
>>>>
>>>>Anset
>>>>
>>>>ted leslie wrote:
>>>>
>>>>
>>>>>i am just trying to get the color of a button to change, i think i 
>>>>>exhausted
>>>>>ever color type in the widget below, but none take effect,
>>>>>Relief takes effect when i change it from one type to another, but 
>>>>>nothing else,
>>>>>What am i doing wrong,
>>>>>I use the GTKmm pages for documentation because i havnt found much
>>>>>on GTK# anywhere, is there some ..
>>>>>No one seems to do this on any of the GTK# applications in the mono site 
>>>>>so i am baffed..
>>>>>
>>>>> Gtk.RcStyle rc_style;
>>>>> rc_style= new Gtk.RcStyle();
>>>>>
>>>>> Gdk.Color color;
>>>>>
>>>>> color.Red = 65535;
>>>>> color.Green = 0;
>>>>> color.Blue = 0;
>>>>> color.Pixel = 65535;  // whats this?
>>>>>
>>>>> btn3.Style=null;
>>>>> btn3.ModifyStyle(rc_style);
>>>>> btn3.Relief=Gtk.ReliefStyle.Half;  // this works and we see impact!!!
>>>>>btn3.ModifyBg(Gtk.StateType.Selected, color);
>>>>>btn3.ModifyFg(Gtk.StateType.Selected, color);
>>>>>btn3.ModifyBase(Gtk.StateType.Selected, color);
>>>>>Console.WriteLine(btn3.Style.BaseColors[1]);
>>>>>Console.WriteLine(btn3.Style.Foregrounds[0]);
>>>>>
>>>>>btn3.Style.DarkColors[0]=color;
>>>>>btn3.Style.DarkColors[1]=color;
>>>>>btn3.Style.DarkColors[2]=color;
>>>>>btn3.Style.DarkColors[3]=color;
>>>>>btn3.Style.DarkColors[4]=color;
>>>>>btn3.Style.LightColors[0]=color;
>>>>>btn3.Style.LightColors[1]=color;
>>>>>btn3.Style.LightColors[2]=color;
>>>>>btn3.Style.LightColors[3]=color;
>>>>>btn3.Style.LightColors[4]=color;
>>>>>btn3.Style.BaseColors[1]=color;
>>>>>btn3.Style.BaseColors[0]=color;
>>>>>btn3.Style.BaseColors[2]=color;
>>>>>btn3.Style.BaseColors[3]=color;
>>>>>btn3.Style.BaseColors[4]=color;
>>>>>btn3.Style.Foregrounds[0]=color;
>>>>>btn3.Style.Foregrounds[1]=color;
>>>>>btn3.Style.Foregrounds[2]=color;
>>>>>btn3.Style.Foregrounds[3]=color;
>>>>>btn3.Style.Foregrounds[4]=color;
>>>>>
>>>>>..... assign widget into another container ....
>>>>>_______________________________________________
>>>>>Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
>>>>>http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>>>>
>>>>
>>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list


More information about the Gtk-sharp-list mailing list