зеркало из https://github.com/mono/mail-archives.git
225 строки
8.2 KiB
HTML
225 строки
8.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [good] Re: [Gtk-sharp-list] simple button style change ...
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5Bgood%5D%20Re%3A%20%5BGtk-sharp-list%5D%20simple%20button%20style%20change%20...&In-Reply-To=20050804140849.GA21619%40localhost">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="006287.html">
|
|
<LINK REL="Next" HREF="006296.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[good] Re: [Gtk-sharp-list] simple button style change ...</H1>
|
|
<B>Anset</B>
|
|
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5Bgood%5D%20Re%3A%20%5BGtk-sharp-list%5D%20simple%20button%20style%20change%20...&In-Reply-To=20050804140849.GA21619%40localhost"
|
|
TITLE="[good] Re: [Gtk-sharp-list] simple button style change ...">Anset at anset.org
|
|
</A><BR>
|
|
<I>Thu Aug 4 10:28:59 EDT 2005</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="006287.html">[good] Re: [Gtk-sharp-list] simple button style change ...
|
|
</A></li>
|
|
<LI>Next message: <A HREF="006296.html">[good] Re: [Gtk-sharp-list] simple button style change ...
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#6289">[ date ]</a>
|
|
<a href="thread.html#6289">[ thread ]</a>
|
|
<a href="subject.html#6289">[ subject ]</a>
|
|
<a href="author.html#6289">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>
|
|
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:
|
|
><i> do you have any examples of this,
|
|
</I>><i> i see some for GTKmm but thats not quite the same.
|
|
</I>><i>
|
|
</I>><i> any code snipets, file?
|
|
</I>><i>
|
|
</I>><i> -tl
|
|
</I>><i>
|
|
</I>><i> On Thu, Aug 04, 2005 at 03:37:56PM +0200, Anset wrote:
|
|
</I>><i>
|
|
</I>>><i>Hi,
|
|
</I>>><i>
|
|
</I>>><i>The only way I found that works is using a resource file, or building a
|
|
</I>>><i>resource string and then parse it using the RC class.
|
|
</I>>><i>
|
|
</I>>><i>Afaik, rcstyle in gtk# is broken.
|
|
</I>>><i>
|
|
</I>>><i>Anset
|
|
</I>>><i>
|
|
</I>>><i>ted leslie wrote:
|
|
</I>>><i>
|
|
</I>>>><i>i am just trying to get the color of a button to change, i think i
|
|
</I>>>><i>exhausted
|
|
</I>>>><i>ever color type in the widget below, but none take effect,
|
|
</I>>>><i>Relief takes effect when i change it from one type to another, but nothing
|
|
</I>>>><i>else,
|
|
</I>>>><i>What am i doing wrong,
|
|
</I>>>><i>I use the GTKmm pages for documentation because i havnt found much
|
|
</I>>>><i>on GTK# anywhere, is there some ..
|
|
</I>>>><i>No one seems to do this on any of the GTK# applications in the mono site
|
|
</I>>>><i>so i am baffed..
|
|
</I>>>><i>
|
|
</I>>>><i> Gtk.RcStyle rc_style;
|
|
</I>>>><i> rc_style= new Gtk.RcStyle();
|
|
</I>>>><i>
|
|
</I>>>><i> Gdk.Color color;
|
|
</I>>>><i>
|
|
</I>>>><i> color.Red = 65535;
|
|
</I>>>><i> color.Green = 0;
|
|
</I>>>><i> color.Blue = 0;
|
|
</I>>>><i> color.Pixel = 65535; // whats this?
|
|
</I>>>><i>
|
|
</I>>>><i> btn3.Style=null;
|
|
</I>>>><i> btn3.ModifyStyle(rc_style);
|
|
</I>>>><i> btn3.Relief=Gtk.ReliefStyle.Half; // this works and we see impact!!!
|
|
</I>>>><i>btn3.ModifyBg(Gtk.StateType.Selected, color);
|
|
</I>>>><i>btn3.ModifyFg(Gtk.StateType.Selected, color);
|
|
</I>>>><i>btn3.ModifyBase(Gtk.StateType.Selected, color);
|
|
</I>>>><i>Console.WriteLine(btn3.Style.BaseColors[1]);
|
|
</I>>>><i>Console.WriteLine(btn3.Style.Foregrounds[0]);
|
|
</I>>>><i>
|
|
</I>>>><i>btn3.Style.DarkColors[0]=color;
|
|
</I>>>><i>btn3.Style.DarkColors[1]=color;
|
|
</I>>>><i>btn3.Style.DarkColors[2]=color;
|
|
</I>>>><i>btn3.Style.DarkColors[3]=color;
|
|
</I>>>><i>btn3.Style.DarkColors[4]=color;
|
|
</I>>>><i>btn3.Style.LightColors[0]=color;
|
|
</I>>>><i>btn3.Style.LightColors[1]=color;
|
|
</I>>>><i>btn3.Style.LightColors[2]=color;
|
|
</I>>>><i>btn3.Style.LightColors[3]=color;
|
|
</I>>>><i>btn3.Style.LightColors[4]=color;
|
|
</I>>>><i>btn3.Style.BaseColors[1]=color;
|
|
</I>>>><i>btn3.Style.BaseColors[0]=color;
|
|
</I>>>><i>btn3.Style.BaseColors[2]=color;
|
|
</I>>>><i>btn3.Style.BaseColors[3]=color;
|
|
</I>>>><i>btn3.Style.BaseColors[4]=color;
|
|
</I>>>><i>btn3.Style.Foregrounds[0]=color;
|
|
</I>>>><i>btn3.Style.Foregrounds[1]=color;
|
|
</I>>>><i>btn3.Style.Foregrounds[2]=color;
|
|
</I>>>><i>btn3.Style.Foregrounds[3]=color;
|
|
</I>>>><i>btn3.Style.Foregrounds[4]=color;
|
|
</I>>>><i>
|
|
</I>>>><i>..... assign widget into another container ....
|
|
</I>>>><i>_______________________________________________
|
|
</I>>>><i>Gtk-sharp-list maillist - <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">Gtk-sharp-list at lists.ximian.com</A>
|
|
</I>>>><i><A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">http://lists.ximian.com/mailman/listinfo/gtk-sharp-list</A>
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I></PRE>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="006287.html">[good] Re: [Gtk-sharp-list] simple button style change ...
|
|
</A></li>
|
|
<LI>Next message: <A HREF="006296.html">[good] Re: [Gtk-sharp-list] simple button style change ...
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#6289">[ date ]</a>
|
|
<a href="thread.html#6289">[ thread ]</a>
|
|
<a href="subject.html#6289">[ subject ]</a>
|
|
<a href="author.html#6289">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
|
|
mailing list</a><br>
|
|
</body></html>
|