From c11f1efd052146cf14dbdc7a187551fc070ab8f2 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 24 Apr 2003 18:38:39 +0000 Subject: [PATCH] C: John Luke, ToggleButton documentation svn path=/trunk/gtk-sharp/; revision=13984 --- doc/en/Gtk/ToggleButton.xml | 161 +++++++++++++++++++++++++++--------- 1 file changed, 122 insertions(+), 39 deletions(-) diff --git a/doc/en/Gtk/ToggleButton.xml b/doc/en/Gtk/ToggleButton.xml index 8c14c506e..a5ec4a2f6 100644 --- a/doc/en/Gtk/ToggleButton.xml +++ b/doc/en/Gtk/ToggleButton.xml @@ -7,8 +7,66 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + A button that can be toggled on and off. + + A is a which will remain 'pressed-in' when clicked. + Clicking again will cause the toggle button to return to it's normal state. This is useful if you need to maintain the state of a button. + + +namespace GtkSamples { + + using Gtk; + using GtkSharp; + using System; + + public class ToggleButtonApp { + + ToggleButton btn; + + public static int Main (string[] args) + { + new ToggleButtonApp(); + return 0; + } + + public ToggleButtonApp() + { + Application.Init (); + Window win = new Window ("ToggleButton Tester"); + win.SetDefaultSize (200, 150); + win.DeleteEvent += new DeleteEventHandler (Window_Delete); + btn = new ToggleButton ("Unselected"); + btn.Active = false; + btn.Toggled += new EventHandler (btn_toggled); + win.Add (btn); + win.ShowAll (); + Application.Run (); + } + + void btn_toggled (object obj, EventArgs args) + { + Console.WriteLine ("Button Toggled"); + if (btn.Active) + { + btn.Label = "Unselected"; + } + else + { + btn.Label = "Selected"; + } + } + + static void Window_Delete (object obj, DeleteEventArgs args) + { + Application.Quit (); + args.RetVal = true; + } + + } +} + + + Gtk.Button @@ -39,10 +97,10 @@ - To be added - To be added: an object of type 'string' - To be added: an object of type 'Gtk.ToggleButton' - To be added + Creates a new with a text label. + a containing the message to be placed in the toggle button. + a new . + Creates a new with a text label. @@ -53,8 +111,8 @@ - To be added - To be added + Emits the event + Emits the event on the . There is no good reason for an application ever to call this function. @@ -79,7 +137,7 @@ Internal constructor Pointer to the C object. - An instance of ToggleButton, wrapping the C object. + An instance of , wrapping the C object. This is an internal constructor, and should not be used by user code. @@ -91,9 +149,9 @@ - To be added - To be added: an object of type 'Gtk.ToggleButton' - To be added + Creates a new object + an object of type + Creates a new . A widget should be packed into the button, using . @@ -104,10 +162,10 @@ - To be added - To be added: an object of type 'string' - To be added: an object of type 'Gtk.ToggleButton' - To be added + Creates a new with a text label. + a containing the message to be placed in the toggle button. + an object of type ' + Creates a new with a text label. @@ -117,8 +175,8 @@ System.UInt32 - The GLib Type for Gtk.ToggleButton - The GLib Type for the Gtk.ToggleButton class. + The for + The for the @@ -132,10 +190,18 @@ - To be added - To be added: an object of type 'bool' - To be added: an object of type 'bool' - To be added + The Mode of the + an object of type + an object of type + + The Mode of the + Sets whether the button is displayed as a separate indicator and label. + You can call this function on a or a with = to make the button look like a normal button + + This function only effects instances of classes like and + that derive from , not instances of itself. + + @@ -148,10 +214,17 @@ - To be added - To be added: an object of type 'bool' - To be added: an object of type 'bool' - To be added + Determines if the has an intermediate state. + an object of type 'bool' + an object of type + + + If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, + and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state. + This function turns on "in between" display. Normally you would turn off the inconsistent state again if the user toggles the toggle button. + This has to be done manually, only affects visual appearance, it doesn't affect the semantics of the button. + + @@ -164,10 +237,18 @@ - To be added - To be added: an object of type 'bool' - To be added: an object of type 'bool' - To be added + Get or set the active + an object of type 'bool' + an object of type + + Get or set the active. + Get: Queries a GtkToggleButton and returns it's current state. + Returns if the toggle button is pressed in and if it is raised. + + Set: Sets the status of the toggle button. Set to if you want the GtkToggleButton to be 'pressed in', and to raise it. + This action causes the toggled signal to be emitted. + + @@ -180,10 +261,12 @@ - To be added - To be added: an object of type 'bool' - To be added: an object of type 'bool' - To be added + The DrawIndicator property + an object of type + an object of type + The DrawIndicator property can be set to to make + or look like a normal . + @@ -192,8 +275,8 @@ - To be added - To be added + Triggered when the is clicked. + Should be connected if you wish to perform an action whenever the 's state is changed. @@ -206,11 +289,11 @@ Internal constructor GLib type for the type - Creates a new instance of ToggleButton, using the GLib-provided type + Creates a new instance of , using the GLib-provided type - This is a constructor used by derivative types of that would have their own GLib type assigned to it. This is not typically used by C# code. + This is a constructor used by derivative types of that would have their own assigned to it. This is not typically used by C# code. - \ No newline at end of file +