Trivial formatting fixes to all examples, simple functional fixes to
* docs/tutorial/gtk-tut.sgml, docs/examples/*: Trivial formatting fixes to all examples, simple functional fixes to rangewidgets example.
This commit is contained in:
@ -4,17 +4,17 @@
|
||||
/* I'm going to be lazy and use some global variables to
|
||||
* store the position of the widget within the fixed
|
||||
* container */
|
||||
gint x=50;
|
||||
gint y=50;
|
||||
gint x = 50;
|
||||
gint y = 50;
|
||||
|
||||
/* This callback function moves the button to a new position
|
||||
* in the Fixed container. */
|
||||
void move_button( GtkWidget *widget,
|
||||
GtkWidget *fixed )
|
||||
{
|
||||
x = (x+30)%300;
|
||||
y = (y+50)%300;
|
||||
gtk_fixed_move( GTK_FIXED(fixed), widget, x, y);
|
||||
x = (x + 30) % 300;
|
||||
y = (y + 50) % 300;
|
||||
gtk_fixed_move (GTK_FIXED (fixed), widget, x, y);
|
||||
}
|
||||
|
||||
int main( int argc,
|
||||
@ -27,23 +27,23 @@ int main( int argc,
|
||||
gint i;
|
||||
|
||||
/* Initialise GTK */
|
||||
gtk_init(&argc, &argv);
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* Create a new window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "Fixed Container");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Fixed Container");
|
||||
|
||||
/* Here we connect the "destroy" event to a signal handler */
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
|
||||
/* Sets the border width of the window. */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* Create a Fixed Container */
|
||||
fixed = gtk_fixed_new();
|
||||
gtk_container_add(GTK_CONTAINER(window), fixed);
|
||||
gtk_widget_show(fixed);
|
||||
fixed = gtk_fixed_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), fixed);
|
||||
gtk_widget_show (fixed);
|
||||
|
||||
for (i = 1 ; i <= 3 ; i++) {
|
||||
/* Creates a new button with the label "Press me" */
|
||||
@ -53,7 +53,7 @@ int main( int argc,
|
||||
* function move_button() passing it the Fixed Container as its
|
||||
* argument. */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (move_button), fixed);
|
||||
GTK_SIGNAL_FUNC (move_button), fixed);
|
||||
|
||||
/* This packs the button into the fixed containers window. */
|
||||
gtk_fixed_put (GTK_FIXED (fixed), button, i*50, i*50);
|
||||
|
Reference in New Issue
Block a user