Re-extract.
2005-01-03 Matthias Clasen <mclasen@redhat.com> * examples/*: Re-extract. * docs/tutorial/gtk-tut.sgml: Small corrections.
This commit is contained in:

committed by
Matthias Clasen

parent
6803d93d38
commit
44ec61dd97
@ -1,5 +1,9 @@
|
|||||||
2005-01-03 Matthias Clasen <mclasen@redhat.com>
|
2005-01-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* examples/*: Re-extract.
|
||||||
|
|
||||||
|
* docs/tutorial/gtk-tut.sgml: Small corrections.
|
||||||
|
|
||||||
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
|
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
|
||||||
section. (#161414, Robert Ancell)
|
section. (#161414, Robert Ancell)
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
2005-01-03 Matthias Clasen <mclasen@redhat.com>
|
2005-01-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* examples/*: Re-extract.
|
||||||
|
|
||||||
|
* docs/tutorial/gtk-tut.sgml: Small corrections.
|
||||||
|
|
||||||
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
|
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
|
||||||
section. (#161414, Robert Ancell)
|
section. (#161414, Robert Ancell)
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
2005-01-03 Matthias Clasen <mclasen@redhat.com>
|
2005-01-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* examples/*: Re-extract.
|
||||||
|
|
||||||
|
* docs/tutorial/gtk-tut.sgml: Small corrections.
|
||||||
|
|
||||||
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
|
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
|
||||||
section. (#161414, Robert Ancell)
|
section. (#161414, Robert Ancell)
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
2005-01-03 Matthias Clasen <mclasen@redhat.com>
|
2005-01-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* examples/*: Re-extract.
|
||||||
|
|
||||||
|
* docs/tutorial/gtk-tut.sgml: Small corrections.
|
||||||
|
|
||||||
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
|
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
|
||||||
section. (#161414, Robert Ancell)
|
section. (#161414, Robert Ancell)
|
||||||
|
|
||||||
|
@ -4048,6 +4048,7 @@ int main( int argc,
|
|||||||
|
|
||||||
/* Create the GtkProgressBar */
|
/* Create the GtkProgressBar */
|
||||||
pdata->pbar = gtk_progress_bar_new ();
|
pdata->pbar = gtk_progress_bar_new ();
|
||||||
|
pdata->activity_mode = FALSE;
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (align), pdata->pbar);
|
gtk_container_add (GTK_CONTAINER (align), pdata->pbar);
|
||||||
gtk_widget_show (pdata->pbar);
|
gtk_widget_show (pdata->pbar);
|
||||||
@ -4214,7 +4215,7 @@ parent.</para></listitem>
|
|||||||
|
|
||||||
<para>Ruler widgets are used to indicate the location of the mouse pointer
|
<para>Ruler widgets are used to indicate the location of the mouse pointer
|
||||||
in a given window. A window can have a vertical ruler spanning across
|
in a given window. A window can have a vertical ruler spanning across
|
||||||
the width and a horizontal ruler spanning down the height. A small
|
the height and a horizontal ruler spanning down the width. A small
|
||||||
triangular indicator on the ruler shows the exact location of the
|
triangular indicator on the ruler shows the exact location of the
|
||||||
pointer relative to the ruler.</para>
|
pointer relative to the ruler.</para>
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Create an Arrow widget with the specified parameters
|
/* Create an Arrow widget with the specified parameters
|
||||||
* and pack it into a button */
|
* and pack it into a button */
|
||||||
GtkWidget *create_arrow_button( GtkArrowType arrow_type,
|
static GtkWidget *create_arrow_button( GtkArrowType arrow_type,
|
||||||
GtkShadowType shadow_type )
|
GtkShadowType shadow_type )
|
||||||
{
|
{
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *arrow;
|
GtkWidget *arrow;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
int main( int argc,
|
int main( int argc,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
int main( int argc,
|
int main( int argc,
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Create a Button Box with the specified parameters */
|
/* Create a Button Box with the specified parameters */
|
||||||
GtkWidget *create_bbox( gint horizontal,
|
static GtkWidget *create_bbox( gint horizontal,
|
||||||
char *title,
|
char *title,
|
||||||
gint spacing,
|
gint spacing,
|
||||||
gint child_w,
|
gint child_w,
|
||||||
gint child_h,
|
gint child_h,
|
||||||
gint layout )
|
gint layout )
|
||||||
{
|
{
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *bbox;
|
GtkWidget *bbox;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Create a new hbox with an image and a label packed into it
|
/* Create a new hbox with an image and a label packed into it
|
||||||
* and return the box. */
|
* and return the box. */
|
||||||
|
|
||||||
GtkWidget *xpm_label_box( gchar *xpm_filename,
|
static GtkWidget *xpm_label_box( gchar *xpm_filename,
|
||||||
gchar *label_text )
|
gchar *label_text )
|
||||||
{
|
{
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
@ -34,8 +33,8 @@ GtkWidget *xpm_label_box( gchar *xpm_filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Our usual callback function */
|
/* Our usual callback function */
|
||||||
void callback( GtkWidget *widget,
|
static void callback( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
g_print ("Hello again - %s was pressed\n", (char *) data);
|
g_print ("Hello again - %s was pressed\n", (char *) data);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
@ -50,23 +49,22 @@ enum {
|
|||||||
* GtkCalendar
|
* GtkCalendar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void calendar_date_to_string (CalendarData *data,
|
static void calendar_date_to_string( CalendarData *data,
|
||||||
char *buffer,
|
char *buffer,
|
||||||
gint buff_len)
|
gint buff_len )
|
||||||
{
|
{
|
||||||
GDate *date;
|
GDate date;
|
||||||
guint year, month, day;
|
guint year, month, day;
|
||||||
|
|
||||||
gtk_calendar_get_date (GTK_CALENDAR (data->window),
|
gtk_calendar_get_date (GTK_CALENDAR (data->window),
|
||||||
&year, &month, &day);
|
&year, &month, &day);
|
||||||
date = g_date_new_dmy (day, month + 1, year);
|
g_date_set_dmy (&date, day, month + 1, year);
|
||||||
g_date_strftime (buffer, buff_len - 1, "%x", date);
|
g_date_strftime (buffer, buff_len - 1, "%x", &date);
|
||||||
|
|
||||||
g_date_free (date);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_set_signal_strings (char *sig_str,
|
static void calendar_set_signal_strings( char *sig_str,
|
||||||
CalendarData *data)
|
CalendarData *data )
|
||||||
{
|
{
|
||||||
const gchar *prev_sig;
|
const gchar *prev_sig;
|
||||||
|
|
||||||
@ -78,8 +76,8 @@ void calendar_set_signal_strings (char *sig_str,
|
|||||||
gtk_label_set_text (GTK_LABEL (data->last_sig), sig_str);
|
gtk_label_set_text (GTK_LABEL (data->last_sig), sig_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_month_changed (GtkWidget *widget,
|
static void calendar_month_changed( GtkWidget *widget,
|
||||||
CalendarData *data)
|
CalendarData *data )
|
||||||
{
|
{
|
||||||
char buffer[256] = "month_changed: ";
|
char buffer[256] = "month_changed: ";
|
||||||
|
|
||||||
@ -87,8 +85,8 @@ void calendar_month_changed (GtkWidget *widget,
|
|||||||
calendar_set_signal_strings (buffer, data);
|
calendar_set_signal_strings (buffer, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_day_selected (GtkWidget *widget,
|
static void calendar_day_selected( GtkWidget *widget,
|
||||||
CalendarData *data)
|
CalendarData *data )
|
||||||
{
|
{
|
||||||
char buffer[256] = "day_selected: ";
|
char buffer[256] = "day_selected: ";
|
||||||
|
|
||||||
@ -96,8 +94,8 @@ void calendar_day_selected (GtkWidget *widget,
|
|||||||
calendar_set_signal_strings (buffer, data);
|
calendar_set_signal_strings (buffer, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_day_selected_double_click (GtkWidget *widget,
|
static void calendar_day_selected_double_click ( GtkWidget *widget,
|
||||||
CalendarData *data)
|
CalendarData *data )
|
||||||
{
|
{
|
||||||
char buffer[256] = "day_selected_double_click: ";
|
char buffer[256] = "day_selected_double_click: ";
|
||||||
guint day;
|
guint day;
|
||||||
@ -115,8 +113,8 @@ void calendar_day_selected_double_click (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_prev_month (GtkWidget *widget,
|
static void calendar_prev_month( GtkWidget *widget,
|
||||||
CalendarData *data)
|
CalendarData *data )
|
||||||
{
|
{
|
||||||
char buffer[256] = "prev_month: ";
|
char buffer[256] = "prev_month: ";
|
||||||
|
|
||||||
@ -124,8 +122,8 @@ void calendar_prev_month (GtkWidget *widget,
|
|||||||
calendar_set_signal_strings (buffer, data);
|
calendar_set_signal_strings (buffer, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_next_month (GtkWidget *widget,
|
static void calendar_next_month( GtkWidget *widget,
|
||||||
CalendarData *data)
|
CalendarData *data )
|
||||||
{
|
{
|
||||||
char buffer[256] = "next_month: ";
|
char buffer[256] = "next_month: ";
|
||||||
|
|
||||||
@ -133,8 +131,8 @@ void calendar_next_month (GtkWidget *widget,
|
|||||||
calendar_set_signal_strings (buffer, data);
|
calendar_set_signal_strings (buffer, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_prev_year (GtkWidget *widget,
|
static void calendar_prev_year( GtkWidget *widget,
|
||||||
CalendarData *data)
|
CalendarData *data )
|
||||||
{
|
{
|
||||||
char buffer[256] = "prev_year: ";
|
char buffer[256] = "prev_year: ";
|
||||||
|
|
||||||
@ -142,8 +140,8 @@ void calendar_prev_year (GtkWidget *widget,
|
|||||||
calendar_set_signal_strings (buffer, data);
|
calendar_set_signal_strings (buffer, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_next_year (GtkWidget *widget,
|
static void calendar_next_year( GtkWidget *widget,
|
||||||
CalendarData *data)
|
CalendarData *data )
|
||||||
{
|
{
|
||||||
char buffer[256] = "next_year: ";
|
char buffer[256] = "next_year: ";
|
||||||
|
|
||||||
@ -152,7 +150,7 @@ void calendar_next_year (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void calendar_set_flags (CalendarData *calendar)
|
static void calendar_set_flags( CalendarData *calendar )
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gint options = 0;
|
gint options = 0;
|
||||||
@ -165,8 +163,8 @@ void calendar_set_flags (CalendarData *calendar)
|
|||||||
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
|
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_toggle_flag (GtkWidget *toggle,
|
static void calendar_toggle_flag( GtkWidget *toggle,
|
||||||
CalendarData *calendar)
|
CalendarData *calendar)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gint j;
|
gint j;
|
||||||
@ -180,8 +178,8 @@ void calendar_toggle_flag (GtkWidget *toggle,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_font_selection_ok (GtkWidget *button,
|
static void calendar_font_selection_ok( GtkWidget *button,
|
||||||
CalendarData *calendar)
|
CalendarData *calendar )
|
||||||
{
|
{
|
||||||
GtkRcStyle *style;
|
GtkRcStyle *style;
|
||||||
char *font_name;
|
char *font_name;
|
||||||
@ -202,8 +200,8 @@ void calendar_font_selection_ok (GtkWidget *button,
|
|||||||
gtk_widget_destroy (calendar->font_dialog);
|
gtk_widget_destroy (calendar->font_dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calendar_select_font (GtkWidget *button,
|
static void calendar_select_font( GtkWidget *button,
|
||||||
CalendarData *calendar)
|
CalendarData *calendar )
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
|
|
||||||
@ -233,7 +231,7 @@ void calendar_select_font (GtkWidget *button,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_calendar ()
|
static void create_calendar( void )
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *vbox, *vbox2, *vbox3;
|
GtkWidget *vbox, *vbox2, *vbox3;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
@ -10,8 +9,8 @@ GdkColor color;
|
|||||||
|
|
||||||
/* Color changed handler */
|
/* Color changed handler */
|
||||||
|
|
||||||
void color_changed_cb( GtkWidget *widget,
|
static void color_changed_cb( GtkWidget *widget,
|
||||||
GtkColorSelection *colorsel )
|
GtkColorSelection *colorsel )
|
||||||
{
|
{
|
||||||
GdkColor ncolor;
|
GdkColor ncolor;
|
||||||
|
|
||||||
@ -21,9 +20,9 @@ void color_changed_cb( GtkWidget *widget,
|
|||||||
|
|
||||||
/* Drawingarea event handler */
|
/* Drawingarea event handler */
|
||||||
|
|
||||||
gint area_event( GtkWidget *widget,
|
static gboolean area_event( GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer client_data )
|
gpointer client_data )
|
||||||
{
|
{
|
||||||
gint handled = FALSE;
|
gint handled = FALSE;
|
||||||
gint response;
|
gint response;
|
||||||
@ -49,7 +48,7 @@ gint area_event( GtkWidget *widget,
|
|||||||
/* Connect to the "color_changed" signal, set the client-data
|
/* Connect to the "color_changed" signal, set the client-data
|
||||||
* to the colorsel widget */
|
* to the colorsel widget */
|
||||||
g_signal_connect (G_OBJECT (colorsel), "color_changed",
|
g_signal_connect (G_OBJECT (colorsel), "color_changed",
|
||||||
G_CALLBACK (color_changed_cb), (gpointer)colorsel);
|
G_CALLBACK (color_changed_cb), (gpointer) colorsel);
|
||||||
|
|
||||||
/* Show the dialog */
|
/* Show the dialog */
|
||||||
response = gtk_dialog_run (GTK_DIALOG (colorseldlg));
|
response = gtk_dialog_run (GTK_DIALOG (colorseldlg));
|
||||||
@ -67,9 +66,9 @@ gint area_event( GtkWidget *widget,
|
|||||||
|
|
||||||
/* Close down and exit handler */
|
/* Close down and exit handler */
|
||||||
|
|
||||||
gint destroy_window( GtkWidget *widget,
|
static gboolean destroy_window( GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer client_data )
|
gpointer client_data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -95,7 +94,7 @@ gint main( gint argc,
|
|||||||
/* Attach to the "delete" and "destroy" events so we can exit */
|
/* Attach to the "delete" and "destroy" events so we can exit */
|
||||||
|
|
||||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||||
GTK_SIGNAL_FUNC (destroy_window), (gpointer)window);
|
GTK_SIGNAL_FUNC (destroy_window), (gpointer) window);
|
||||||
|
|
||||||
/* Create drawingarea, set size and catch button events */
|
/* Create drawingarea, set size and catch button events */
|
||||||
|
|
||||||
@ -111,7 +110,7 @@ gint main( gint argc,
|
|||||||
gtk_widget_set_events (drawingarea, GDK_BUTTON_PRESS_MASK);
|
gtk_widget_set_events (drawingarea, GDK_BUTTON_PRESS_MASK);
|
||||||
|
|
||||||
g_signal_connect (GTK_OBJECT (drawingarea), "event",
|
g_signal_connect (GTK_OBJECT (drawingarea), "event",
|
||||||
GTK_SIGNAL_FUNC (area_event), (gpointer)drawingarea);
|
GTK_SIGNAL_FUNC (area_event), (gpointer) drawingarea);
|
||||||
|
|
||||||
/* Add drawingarea to window, then show them both */
|
/* Add drawingarea to window, then show them both */
|
||||||
|
|
||||||
|
@ -1,26 +1,25 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
void enter_callback( GtkWidget *widget,
|
static void enter_callback( GtkWidget *widget,
|
||||||
GtkWidget *entry )
|
GtkWidget *entry )
|
||||||
{
|
{
|
||||||
const gchar *entry_text;
|
const gchar *entry_text;
|
||||||
entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
|
entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||||
printf("Entry contents: %s\n", entry_text);
|
printf ("Entry contents: %s\n", entry_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void entry_toggle_editable( GtkWidget *checkbutton,
|
static void entry_toggle_editable( GtkWidget *checkbutton,
|
||||||
GtkWidget *entry )
|
GtkWidget *entry )
|
||||||
{
|
{
|
||||||
gtk_editable_set_editable (GTK_EDITABLE (entry),
|
gtk_editable_set_editable (GTK_EDITABLE (entry),
|
||||||
GTK_TOGGLE_BUTTON (checkbutton)->active);
|
GTK_TOGGLE_BUTTON (checkbutton)->active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void entry_toggle_visibility( GtkWidget *checkbutton,
|
static void entry_toggle_visibility( GtkWidget *checkbutton,
|
||||||
GtkWidget *entry )
|
GtkWidget *entry )
|
||||||
{
|
{
|
||||||
gtk_entry_set_visibility (GTK_ENTRY (entry),
|
gtk_entry_set_visibility (GTK_ENTRY (entry),
|
||||||
GTK_TOGGLE_BUTTON (checkbutton)->active);
|
GTK_TOGGLE_BUTTON (checkbutton)->active);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Get the selected filename and print it to the console */
|
/* Get the selected filename and print it to the console */
|
||||||
void file_ok_sel( GtkWidget *w,
|
static void file_ok_sel( GtkWidget *w,
|
||||||
GtkFileSelection *fs )
|
GtkFileSelection *fs )
|
||||||
{
|
{
|
||||||
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* I'm going to be lazy and use some global variables to
|
/* I'm going to be lazy and use some global variables to
|
||||||
@ -10,8 +9,8 @@ gint y = 50;
|
|||||||
|
|
||||||
/* This callback function moves the button to a new position
|
/* This callback function moves the button to a new position
|
||||||
* in the Fixed container. */
|
* in the Fixed container. */
|
||||||
void move_button( GtkWidget *widget,
|
static void move_button( GtkWidget *widget,
|
||||||
GtkWidget *fixed )
|
GtkWidget *fixed )
|
||||||
{
|
{
|
||||||
x = (x + 30) % 300;
|
x = (x + 30) % 300;
|
||||||
y = (y + 50) % 300;
|
y = (y + 50) % 300;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
int main( int argc,
|
int main( int argc,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
#include <config.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk/gtkmain.h>
|
#include <gtk/gtkmain.h>
|
||||||
@ -30,23 +29,23 @@
|
|||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
|
|
||||||
static void gtk_dial_class_init (GtkDialClass *klass);
|
static void gtk_dial_class_init (GtkDialClass *klass);
|
||||||
static void gtk_dial_init (GtkDial *dial);
|
static void gtk_dial_init (GtkDial *dial);
|
||||||
static void gtk_dial_destroy (GtkObject *object);
|
static void gtk_dial_destroy (GtkObject *object);
|
||||||
static void gtk_dial_realize (GtkWidget *widget);
|
static void gtk_dial_realize (GtkWidget *widget);
|
||||||
static void gtk_dial_size_request (GtkWidget *widget,
|
static void gtk_dial_size_request (GtkWidget *widget,
|
||||||
GtkRequisition *requisition);
|
GtkRequisition *requisition);
|
||||||
static void gtk_dial_size_allocate (GtkWidget *widget,
|
static void gtk_dial_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static gint gtk_dial_expose (GtkWidget *widget,
|
static gboolean gtk_dial_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event);
|
GdkEventExpose *event);
|
||||||
static gint gtk_dial_button_press (GtkWidget *widget,
|
static gboolean gtk_dial_button_press (GtkWidget *widget,
|
||||||
GdkEventButton *event);
|
GdkEventButton *event);
|
||||||
static gint gtk_dial_button_release (GtkWidget *widget,
|
static gboolean gtk_dial_button_release (GtkWidget *widget,
|
||||||
GdkEventButton *event);
|
GdkEventButton *event);
|
||||||
static gint gtk_dial_motion_notify (GtkWidget *widget,
|
static gboolean gtk_dial_motion_notify (GtkWidget *widget,
|
||||||
GdkEventMotion *event);
|
GdkEventMotion *event);
|
||||||
static gboolean gtk_dial_timer (GtkDial *dial);
|
static gboolean gtk_dial_timer (GtkDial *dial);
|
||||||
|
|
||||||
static void gtk_dial_update_mouse (GtkDial *dial, gint x, gint y);
|
static void gtk_dial_update_mouse (GtkDial *dial, gint x, gint y);
|
||||||
static void gtk_dial_update (GtkDial *dial);
|
static void gtk_dial_update (GtkDial *dial);
|
||||||
@ -275,9 +274,9 @@ gtk_dial_size_allocate (GtkWidget *widget,
|
|||||||
dial->pointer_width = dial->radius / 5;
|
dial->pointer_width = dial->radius / 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean
|
||||||
gtk_dial_expose (GtkWidget *widget,
|
gtk_dial_expose( GtkWidget *widget,
|
||||||
GdkEventExpose *event)
|
GdkEventExpose *event )
|
||||||
{
|
{
|
||||||
GtkDial *dial;
|
GtkDial *dial;
|
||||||
GdkPoint points[6];
|
GdkPoint points[6];
|
||||||
@ -414,9 +413,9 @@ gtk_dial_expose (GtkWidget *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean
|
||||||
gtk_dial_button_press (GtkWidget *widget,
|
gtk_dial_button_press( GtkWidget *widget,
|
||||||
GdkEventButton *event)
|
GdkEventButton *event )
|
||||||
{
|
{
|
||||||
GtkDial *dial;
|
GtkDial *dial;
|
||||||
gint dx, dy;
|
gint dx, dy;
|
||||||
@ -458,9 +457,9 @@ gtk_dial_button_press (GtkWidget *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean
|
||||||
gtk_dial_button_release (GtkWidget *widget,
|
gtk_dial_button_release( GtkWidget *widget,
|
||||||
GdkEventButton *event)
|
GdkEventButton *event )
|
||||||
{
|
{
|
||||||
GtkDial *dial;
|
GtkDial *dial;
|
||||||
|
|
||||||
@ -487,9 +486,9 @@ gtk_dial_button_release (GtkWidget *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean
|
||||||
gtk_dial_motion_notify (GtkWidget *widget,
|
gtk_dial_motion_notify( GtkWidget *widget,
|
||||||
GdkEventMotion *event)
|
GdkEventMotion *event )
|
||||||
{
|
{
|
||||||
GtkDial *dial;
|
GtkDial *dial;
|
||||||
GdkModifierType mods;
|
GdkModifierType mods;
|
||||||
@ -533,7 +532,7 @@ gtk_dial_motion_notify (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_dial_timer (GtkDial *dial)
|
gtk_dial_timer( GtkDial *dial )
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (dial != NULL, FALSE);
|
g_return_val_if_fail (dial != NULL, FALSE);
|
||||||
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
|
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
|
||||||
@ -545,7 +544,7 @@ gtk_dial_timer (GtkDial *dial)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
|
gtk_dial_update_mouse( GtkDial *dial, gint x, gint y )
|
||||||
{
|
{
|
||||||
gint xc, yc;
|
gint xc, yc;
|
||||||
gfloat old_value;
|
gfloat old_value;
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* This is a callback function. The data arguments are ignored
|
/* This is a callback function. The data arguments are ignored
|
||||||
* in this example. More on callbacks below. */
|
* in this example. More on callbacks below. */
|
||||||
void hello( GtkWidget *widget,
|
static void hello( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
g_print ("Hello World\n");
|
g_print ("Hello World\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
gint delete_event( GtkWidget *widget,
|
static gboolean delete_event( GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
/* If you return FALSE in the "delete_event" signal handler,
|
/* If you return FALSE in the "delete_event" signal handler,
|
||||||
* GTK will emit the "destroy" signal. Returning TRUE means
|
* GTK will emit the "destroy" signal. Returning TRUE means
|
||||||
@ -29,8 +28,8 @@ gint delete_event( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Another callback */
|
/* Another callback */
|
||||||
void destroy( GtkWidget *widget,
|
static void destroy( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Our new improved callback. The data passed to this function
|
/* Our new improved callback. The data passed to this function
|
||||||
* is printed to stdout. */
|
* is printed to stdout. */
|
||||||
void callback( GtkWidget *widget,
|
static void callback( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
g_print ("Hello again - %s was pressed\n", (gchar *) data);
|
g_print ("Hello again - %s was pressed\n", (gchar *) data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* another callback */
|
/* another callback */
|
||||||
gint delete_event( GtkWidget *widget,
|
static gboolean delete_event( GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
int main( int argc,
|
int main( int argc,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Obligatory basic callback */
|
/* Obligatory basic callback */
|
||||||
@ -10,21 +9,21 @@ static void print_hello( GtkWidget *w,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* For the check button */
|
/* For the check button */
|
||||||
static void print_toggle(gpointer callback_data,
|
static void print_toggle( gpointer callback_data,
|
||||||
guint callback_action,
|
guint callback_action,
|
||||||
GtkWidget *menu_item)
|
GtkWidget *menu_item )
|
||||||
{
|
{
|
||||||
g_message ("Check button state - %d\n",
|
g_message ("Check button state - %d\n",
|
||||||
GTK_CHECK_MENU_ITEM(menu_item)->active);
|
GTK_CHECK_MENU_ITEM (menu_item)->active);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For the radio buttons */
|
/* For the radio buttons */
|
||||||
static void print_selected(gpointer callback_data,
|
static void print_selected( gpointer callback_data,
|
||||||
guint callback_action,
|
guint callback_action,
|
||||||
GtkWidget *menu_item)
|
GtkWidget *menu_item )
|
||||||
{
|
{
|
||||||
if(GTK_CHECK_MENU_ITEM(menu_item)->active)
|
if(GTK_CHECK_MENU_ITEM(menu_item)->active)
|
||||||
g_message("Radio button %d selected\n", callback_action);
|
g_message ("Radio button %d selected\n", callback_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
|
/* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
|
||||||
@ -50,7 +49,7 @@ static GtkItemFactoryEntry menu_items[] = {
|
|||||||
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
|
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
|
||||||
|
|
||||||
/* Returns a menubar widget made from the above menu */
|
/* Returns a menubar widget made from the above menu */
|
||||||
GtkWidget *get_menubar_menu( GtkWidget *window)
|
static GtkWidget *get_menubar_menu( GtkWidget *window )
|
||||||
{
|
{
|
||||||
GtkItemFactory *item_factory;
|
GtkItemFactory *item_factory;
|
||||||
GtkAccelGroup *accel_group;
|
GtkAccelGroup *accel_group;
|
||||||
@ -75,24 +74,26 @@ GtkWidget *get_menubar_menu( GtkWidget *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Popup the menu when the popup button is pressed */
|
/* Popup the menu when the popup button is pressed */
|
||||||
static gint popup_cb(GtkWidget *widget, GdkEvent *event, GtkWidget *menu)
|
static gboolean popup_cb( GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
GtkWidget *menu )
|
||||||
{
|
{
|
||||||
GdkEventButton *bevent = (GdkEventButton *)event;
|
GdkEventButton *bevent = (GdkEventButton *)event;
|
||||||
|
|
||||||
/* Only take button presses */
|
/* Only take button presses */
|
||||||
if(event->type != GDK_BUTTON_PRESS)
|
if (event->type != GDK_BUTTON_PRESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Show the menu */
|
/* Show the menu */
|
||||||
gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
|
gtk_menu_popup (GTK_MENU(menu), NULL, NULL,
|
||||||
NULL, NULL, bevent->button, bevent->time);
|
NULL, NULL, bevent->button, bevent->time);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same as with get_menubar_menu() but just return a button with a signal to
|
/* Same as with get_menubar_menu() but just return a button with a signal to
|
||||||
call a popup menu */
|
call a popup menu */
|
||||||
GtkWidget *get_popup_menu(void)
|
GtkWidget *get_popup_menu( void )
|
||||||
{
|
{
|
||||||
GtkItemFactory *item_factory;
|
GtkItemFactory *item_factory;
|
||||||
GtkWidget *button, *menu;
|
GtkWidget *button, *menu;
|
||||||
@ -101,21 +102,21 @@ GtkWidget *get_popup_menu(void)
|
|||||||
item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<main>",
|
item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<main>",
|
||||||
NULL);
|
NULL);
|
||||||
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
|
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
|
||||||
menu = gtk_item_factory_get_widget(item_factory, "<main>");
|
menu = gtk_item_factory_get_widget (item_factory, "<main>");
|
||||||
|
|
||||||
/* Make a button to activate the popup menu */
|
/* Make a button to activate the popup menu */
|
||||||
button = gtk_button_new_with_label("Popup");
|
button = gtk_button_new_with_label ("Popup");
|
||||||
/* Make the menu popup when clicked */
|
/* Make the menu popup when clicked */
|
||||||
g_signal_connect(G_OBJECT(button),
|
g_signal_connect (G_OBJECT(button),
|
||||||
"event",
|
"event",
|
||||||
G_CALLBACK(popup_cb),
|
G_CALLBACK(popup_cb),
|
||||||
(gpointer) menu);
|
(gpointer) menu);
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same again but return an option menu */
|
/* Same again but return an option menu */
|
||||||
GtkWidget *get_option_menu(void)
|
GtkWidget *get_option_menu( void )
|
||||||
{
|
{
|
||||||
GtkItemFactory *item_factory;
|
GtkItemFactory *item_factory;
|
||||||
GtkWidget *option_menu;
|
GtkWidget *option_menu;
|
||||||
@ -124,7 +125,7 @@ GtkWidget *get_option_menu(void)
|
|||||||
item_factory = gtk_item_factory_new (GTK_TYPE_OPTION_MENU, "<main>",
|
item_factory = gtk_item_factory_new (GTK_TYPE_OPTION_MENU, "<main>",
|
||||||
NULL);
|
NULL);
|
||||||
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
|
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
|
||||||
option_menu = gtk_item_factory_get_widget(item_factory, "<main>");
|
option_menu = gtk_item_factory_get_widget (item_factory, "<main>");
|
||||||
|
|
||||||
return option_menu;
|
return option_menu;
|
||||||
}
|
}
|
||||||
@ -157,8 +158,8 @@ int main( int argc,
|
|||||||
/* Note: all three menus are separately created, so they are not the
|
/* Note: all three menus are separately created, so they are not the
|
||||||
same menu */
|
same menu */
|
||||||
menubar = get_menubar_menu (window);
|
menubar = get_menubar_menu (window);
|
||||||
popup_button = get_popup_menu();
|
popup_button = get_popup_menu ();
|
||||||
option_menu = get_option_menu();
|
option_menu = get_option_menu ();
|
||||||
|
|
||||||
/* Pack it all together */
|
/* Pack it all together */
|
||||||
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
|
||||||
@ -171,5 +172,5 @@ int main( int argc,
|
|||||||
/* Finished! */
|
/* Finished! */
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static gint button_press (GtkWidget *, GdkEvent *);
|
static gboolean button_press (GtkWidget *, GdkEvent *);
|
||||||
static void menuitem_response (gchar *);
|
static void menuitem_response (gchar *);
|
||||||
|
|
||||||
int main( int argc,
|
int main( int argc,
|
||||||
@ -109,8 +108,8 @@ int main( int argc,
|
|||||||
* the button that was pressed.
|
* the button that was pressed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static gint button_press( GtkWidget *widget,
|
static gboolean button_press( GtkWidget *widget,
|
||||||
GdkEvent *event )
|
GdkEvent *event )
|
||||||
{
|
{
|
||||||
|
|
||||||
if (event->type == GDK_BUTTON_PRESS) {
|
if (event->type == GDK_BUTTON_PRESS) {
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* This function rotates the position of the tabs */
|
/* This function rotates the position of the tabs */
|
||||||
void rotate_book( GtkButton *button,
|
static void rotate_book( GtkButton *button,
|
||||||
GtkNotebook *notebook )
|
GtkNotebook *notebook )
|
||||||
{
|
{
|
||||||
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4);
|
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add/Remove the page tabs and the borders */
|
/* Add/Remove the page tabs and the borders */
|
||||||
void tabsborder_book( GtkButton *button,
|
static void tabsborder_book( GtkButton *button,
|
||||||
GtkNotebook *notebook )
|
GtkNotebook *notebook )
|
||||||
{
|
{
|
||||||
gint tval = FALSE;
|
gint tval = FALSE;
|
||||||
gint bval = FALSE;
|
gint bval = FALSE;
|
||||||
@ -26,8 +25,8 @@ void tabsborder_book( GtkButton *button,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Remove a page from the notebook */
|
/* Remove a page from the notebook */
|
||||||
void remove_book( GtkButton *button,
|
static void remove_book( GtkButton *button,
|
||||||
GtkNotebook *notebook )
|
GtkNotebook *notebook )
|
||||||
{
|
{
|
||||||
gint page;
|
gint page;
|
||||||
|
|
||||||
@ -38,9 +37,9 @@ void remove_book( GtkButton *button,
|
|||||||
gtk_widget_queue_draw (GTK_WIDGET (notebook));
|
gtk_widget_queue_draw (GTK_WIDGET (notebook));
|
||||||
}
|
}
|
||||||
|
|
||||||
gint delete( GtkWidget *widget,
|
static gboolean delete( GtkWidget *widget,
|
||||||
GtkWidget *event,
|
GtkWidget *event,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "gtk/gtk.h"
|
#include "gtk/gtk.h"
|
||||||
|
|
||||||
gint delete_event( GtkWidget *widget,
|
static gboolean delete_event( GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -15,11 +14,11 @@ gint delete_event( GtkWidget *widget,
|
|||||||
/* Make a new hbox filled with button-labels. Arguments for the
|
/* Make a new hbox filled with button-labels. Arguments for the
|
||||||
* variables we're interested are passed in to this function.
|
* variables we're interested are passed in to this function.
|
||||||
* We do not show the box, but do show everything inside. */
|
* We do not show the box, but do show everything inside. */
|
||||||
GtkWidget *make_box( gboolean homogeneous,
|
static GtkWidget *make_box( gboolean homogeneous,
|
||||||
gint spacing,
|
gint spacing,
|
||||||
gboolean expand,
|
gboolean expand,
|
||||||
gboolean fill,
|
gboolean fill,
|
||||||
guint padding )
|
guint padding )
|
||||||
{
|
{
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Create the list of "messages" */
|
/* Create the list of "messages" */
|
||||||
GtkWidget *create_list( void )
|
static GtkWidget *create_list( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
GtkWidget *scrolled_window;
|
GtkWidget *scrolled_window;
|
||||||
@ -58,7 +57,7 @@ when our window is realized. We could also force our window to be
|
|||||||
realized with gtk_widget_realize, but it would have to be part of
|
realized with gtk_widget_realize, but it would have to be part of
|
||||||
a hierarchy first */
|
a hierarchy first */
|
||||||
|
|
||||||
void insert_text (GtkTextBuffer *buffer)
|
static void insert_text( GtkTextBuffer *buffer )
|
||||||
{
|
{
|
||||||
GtkTextIter iter;
|
GtkTextIter iter;
|
||||||
|
|
||||||
@ -76,7 +75,7 @@ void insert_text (GtkTextBuffer *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create a scrolled text area that displays a "message" */
|
/* Create a scrolled text area that displays a "message" */
|
||||||
GtkWidget *create_text( void )
|
static GtkWidget *create_text( void )
|
||||||
{
|
{
|
||||||
GtkWidget *scrolled_window;
|
GtkWidget *scrolled_window;
|
||||||
GtkWidget *view;
|
GtkWidget *view;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
typedef struct _ProgressData {
|
typedef struct _ProgressData {
|
||||||
@ -11,7 +10,7 @@ typedef struct _ProgressData {
|
|||||||
|
|
||||||
/* Update the value of the progress bar so that we get
|
/* Update the value of the progress bar so that we get
|
||||||
* some movement */
|
* some movement */
|
||||||
gboolean progress_timeout( gpointer data )
|
static gboolean progress_timeout( gpointer data )
|
||||||
{
|
{
|
||||||
ProgressData *pdata = (ProgressData *)data;
|
ProgressData *pdata = (ProgressData *)data;
|
||||||
gdouble new_val;
|
gdouble new_val;
|
||||||
@ -38,8 +37,8 @@ gboolean progress_timeout( gpointer data )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Callback that toggles the text display within the progress bar trough */
|
/* Callback that toggles the text display within the progress bar trough */
|
||||||
void toggle_show_text( GtkWidget *widget,
|
static void toggle_show_text( GtkWidget *widget,
|
||||||
ProgressData *pdata )
|
ProgressData *pdata )
|
||||||
{
|
{
|
||||||
const gchar *text;
|
const gchar *text;
|
||||||
|
|
||||||
@ -51,8 +50,8 @@ void toggle_show_text( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Callback that toggles the activity mode of the progress bar */
|
/* Callback that toggles the activity mode of the progress bar */
|
||||||
void toggle_activity_mode( GtkWidget *widget,
|
static void toggle_activity_mode( GtkWidget *widget,
|
||||||
ProgressData *pdata )
|
ProgressData *pdata )
|
||||||
{
|
{
|
||||||
pdata->activity_mode = !pdata->activity_mode;
|
pdata->activity_mode = !pdata->activity_mode;
|
||||||
if (pdata->activity_mode)
|
if (pdata->activity_mode)
|
||||||
@ -63,8 +62,8 @@ void toggle_activity_mode( GtkWidget *widget,
|
|||||||
|
|
||||||
|
|
||||||
/* Callback that toggles the orientation of the progress bar */
|
/* Callback that toggles the orientation of the progress bar */
|
||||||
void toggle_orientation( GtkWidget *widget,
|
static void toggle_orientation( GtkWidget *widget,
|
||||||
ProgressData *pdata )
|
ProgressData *pdata )
|
||||||
{
|
{
|
||||||
switch (gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (pdata->pbar))) {
|
switch (gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (pdata->pbar))) {
|
||||||
case GTK_PROGRESS_LEFT_TO_RIGHT:
|
case GTK_PROGRESS_LEFT_TO_RIGHT:
|
||||||
@ -75,15 +74,15 @@ void toggle_orientation( GtkWidget *widget,
|
|||||||
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (pdata->pbar),
|
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (pdata->pbar),
|
||||||
GTK_PROGRESS_LEFT_TO_RIGHT);
|
GTK_PROGRESS_LEFT_TO_RIGHT);
|
||||||
break;
|
break;
|
||||||
default: ;
|
default:;
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Clean up allocated memory and remove the timer */
|
/* Clean up allocated memory and remove the timer */
|
||||||
void destroy_progress( GtkWidget *widget,
|
static void destroy_progress( GtkWidget *widget,
|
||||||
ProgressData *pdata)
|
ProgressData *pdata)
|
||||||
{
|
{
|
||||||
g_source_remove (pdata->timer);
|
g_source_remove (pdata->timer);
|
||||||
pdata->timer = 0;
|
pdata->timer = 0;
|
||||||
@ -129,6 +128,7 @@ int main( int argc,
|
|||||||
|
|
||||||
/* Create the GtkProgressBar */
|
/* Create the GtkProgressBar */
|
||||||
pdata->pbar = gtk_progress_bar_new ();
|
pdata->pbar = gtk_progress_bar_new ();
|
||||||
|
pdata->activity_mode = FALSE;
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (align), pdata->pbar);
|
gtk_container_add (GTK_CONTAINER (align), pdata->pbar);
|
||||||
gtk_widget_show (pdata->pbar);
|
gtk_widget_show (pdata->pbar);
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
gint close_application( GtkWidget *widget,
|
static gboolean close_application( GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1,34 +1,33 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
GtkWidget *hscale, *vscale;
|
GtkWidget *hscale, *vscale;
|
||||||
|
|
||||||
void cb_pos_menu_select( GtkWidget *item,
|
static void cb_pos_menu_select( GtkWidget *item,
|
||||||
GtkPositionType pos )
|
GtkPositionType pos )
|
||||||
{
|
{
|
||||||
/* Set the value position on both scale widgets */
|
/* Set the value position on both scale widgets */
|
||||||
gtk_scale_set_value_pos (GTK_SCALE (hscale), pos);
|
gtk_scale_set_value_pos (GTK_SCALE (hscale), pos);
|
||||||
gtk_scale_set_value_pos (GTK_SCALE (vscale), pos);
|
gtk_scale_set_value_pos (GTK_SCALE (vscale), pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_update_menu_select( GtkWidget *item,
|
static void cb_update_menu_select( GtkWidget *item,
|
||||||
GtkUpdateType policy )
|
GtkUpdateType policy )
|
||||||
{
|
{
|
||||||
/* Set the update policy for both scale widgets */
|
/* Set the update policy for both scale widgets */
|
||||||
gtk_range_set_update_policy (GTK_RANGE (hscale), policy);
|
gtk_range_set_update_policy (GTK_RANGE (hscale), policy);
|
||||||
gtk_range_set_update_policy (GTK_RANGE (vscale), policy);
|
gtk_range_set_update_policy (GTK_RANGE (vscale), policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_digits_scale( GtkAdjustment *adj )
|
static void cb_digits_scale( GtkAdjustment *adj )
|
||||||
{
|
{
|
||||||
/* Set the number of decimal places to which adj->value is rounded */
|
/* Set the number of decimal places to which adj->value is rounded */
|
||||||
gtk_scale_set_digits (GTK_SCALE (hscale), (gint) adj->value);
|
gtk_scale_set_digits (GTK_SCALE (hscale), (gint) adj->value);
|
||||||
gtk_scale_set_digits (GTK_SCALE (vscale), (gint) adj->value);
|
gtk_scale_set_digits (GTK_SCALE (vscale), (gint) adj->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_page_size( GtkAdjustment *get,
|
static void cb_page_size( GtkAdjustment *get,
|
||||||
GtkAdjustment *set )
|
GtkAdjustment *set )
|
||||||
{
|
{
|
||||||
/* Set the page size and page increment size of the sample
|
/* Set the page size and page increment size of the sample
|
||||||
* adjustment to the value specified by the "Page Size" scale */
|
* adjustment to the value specified by the "Page Size" scale */
|
||||||
@ -43,7 +42,7 @@ void cb_page_size( GtkAdjustment *get,
|
|||||||
g_signal_emit_by_name(G_OBJECT(set), "changed");
|
g_signal_emit_by_name(G_OBJECT(set), "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_draw_value( GtkToggleButton *button )
|
static void cb_draw_value( GtkToggleButton *button )
|
||||||
{
|
{
|
||||||
/* Turn the value display on the scale widgets off or on depending
|
/* Turn the value display on the scale widgets off or on depending
|
||||||
* on the state of the checkbutton */
|
* on the state of the checkbutton */
|
||||||
@ -53,9 +52,9 @@ void cb_draw_value( GtkToggleButton *button )
|
|||||||
|
|
||||||
/* Convenience functions */
|
/* Convenience functions */
|
||||||
|
|
||||||
GtkWidget *make_menu_item (gchar *name,
|
static GtkWidget *make_menu_item ( gchar *name,
|
||||||
GCallback callback,
|
GCallback callback,
|
||||||
gpointer data)
|
gpointer data )
|
||||||
{
|
{
|
||||||
GtkWidget *item;
|
GtkWidget *item;
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ GtkWidget *make_menu_item (gchar *name,
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void scale_set_default_values( GtkScale *scale )
|
static void scale_set_default_values( GtkScale *scale )
|
||||||
{
|
{
|
||||||
gtk_range_set_update_policy (GTK_RANGE (scale),
|
gtk_range_set_update_policy (GTK_RANGE (scale),
|
||||||
GTK_UPDATE_CONTINUOUS);
|
GTK_UPDATE_CONTINUOUS);
|
||||||
@ -78,7 +77,7 @@ void scale_set_default_values( GtkScale *scale )
|
|||||||
|
|
||||||
/* makes the sample window */
|
/* makes the sample window */
|
||||||
|
|
||||||
void create_range_controls( void )
|
static void create_range_controls( void )
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *box1, *box2, *box3;
|
GtkWidget *box1, *box2, *box3;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#define EVENT_METHOD(i, x) GTK_WIDGET_GET_CLASS(i)->x
|
#define EVENT_METHOD(i, x) GTK_WIDGET_GET_CLASS(i)->x
|
||||||
@ -8,9 +7,9 @@
|
|||||||
#define YSIZE 400
|
#define YSIZE 400
|
||||||
|
|
||||||
/* This routine gets control when the close button is clicked */
|
/* This routine gets control when the close button is clicked */
|
||||||
gint close_application( GtkWidget *widget,
|
static gboolean close_application( GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
@ -26,8 +25,8 @@
|
|||||||
static GdkPixmap *pixmap = NULL;
|
static GdkPixmap *pixmap = NULL;
|
||||||
|
|
||||||
/* Create a new backing pixmap of the appropriate size */
|
/* Create a new backing pixmap of the appropriate size */
|
||||||
static gint configure_event( GtkWidget *widget,
|
static gboolean configure_event( GtkWidget *widget,
|
||||||
GdkEventConfigure *event )
|
GdkEventConfigure *event )
|
||||||
{
|
{
|
||||||
if (pixmap)
|
if (pixmap)
|
||||||
g_object_unref (pixmap);
|
g_object_unref (pixmap);
|
||||||
@ -47,8 +46,8 @@ static gint configure_event( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw the screen from the backing pixmap */
|
/* Redraw the screen from the backing pixmap */
|
||||||
static gint expose_event( GtkWidget *widget,
|
static gboolean expose_event( GtkWidget *widget,
|
||||||
GdkEventExpose *event )
|
GdkEventExpose *event )
|
||||||
{
|
{
|
||||||
gdk_draw_drawable (widget->window,
|
gdk_draw_drawable (widget->window,
|
||||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
||||||
@ -77,12 +76,12 @@ static void draw_brush( GtkWidget *widget,
|
|||||||
update_rect.x, update_rect.y,
|
update_rect.x, update_rect.y,
|
||||||
update_rect.width, update_rect.height);
|
update_rect.width, update_rect.height);
|
||||||
gtk_widget_queue_draw_area (widget,
|
gtk_widget_queue_draw_area (widget,
|
||||||
update_rect.x, update_rect.y,
|
update_rect.x, update_rect.y,
|
||||||
update_rect.width, update_rect.height);
|
update_rect.width, update_rect.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint button_press_event( GtkWidget *widget,
|
static gboolean button_press_event( GtkWidget *widget,
|
||||||
GdkEventButton *event )
|
GdkEventButton *event )
|
||||||
{
|
{
|
||||||
if (event->button == 1 && pixmap != NULL)
|
if (event->button == 1 && pixmap != NULL)
|
||||||
draw_brush (widget, event->x, event->y);
|
draw_brush (widget, event->x, event->y);
|
||||||
@ -90,8 +89,8 @@ static gint button_press_event( GtkWidget *widget,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint motion_notify_event( GtkWidget *widget,
|
static gboolean motion_notify_event( GtkWidget *widget,
|
||||||
GdkEventMotion *event )
|
GdkEventMotion *event )
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
GdkModifierType state;
|
GdkModifierType state;
|
||||||
|
@ -18,14 +18,13 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Backing pixmap for drawing area */
|
/* Backing pixmap for drawing area */
|
||||||
static GdkPixmap *pixmap = NULL;
|
static GdkPixmap *pixmap = NULL;
|
||||||
|
|
||||||
/* Create a new backing pixmap of the appropriate size */
|
/* Create a new backing pixmap of the appropriate size */
|
||||||
static gint
|
static gboolean
|
||||||
configure_event (GtkWidget *widget, GdkEventConfigure *event)
|
configure_event (GtkWidget *widget, GdkEventConfigure *event)
|
||||||
{
|
{
|
||||||
if (pixmap)
|
if (pixmap)
|
||||||
@ -46,7 +45,7 @@ configure_event (GtkWidget *widget, GdkEventConfigure *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw the screen from the backing pixmap */
|
/* Redraw the screen from the backing pixmap */
|
||||||
static gint
|
static gboolean
|
||||||
expose_event (GtkWidget *widget, GdkEventExpose *event)
|
expose_event (GtkWidget *widget, GdkEventExpose *event)
|
||||||
{
|
{
|
||||||
gdk_draw_drawable (widget->window,
|
gdk_draw_drawable (widget->window,
|
||||||
@ -101,7 +100,7 @@ print_button_press (GdkDevice *device)
|
|||||||
g_print ("Button press on device '%s'\n", device->name);
|
g_print ("Button press on device '%s'\n", device->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean
|
||||||
button_press_event (GtkWidget *widget, GdkEventButton *event)
|
button_press_event (GtkWidget *widget, GdkEventButton *event)
|
||||||
{
|
{
|
||||||
print_button_press (event->device);
|
print_button_press (event->device);
|
||||||
@ -115,7 +114,7 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean
|
||||||
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
|
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
|
||||||
{
|
{
|
||||||
gdouble x, y;
|
gdouble x, y;
|
||||||
@ -177,6 +176,7 @@ create_input_dialog ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
void destroy( GtkWidget *widget,
|
static void destroy( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
void selection_received( GtkWidget *widget,
|
static void selection_received( GtkWidget *widget,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
gpointer data );
|
gpointer data );
|
||||||
|
|
||||||
/* Signal handler invoked when user clicks on the "Get Targets" button */
|
/* Signal handler invoked when user clicks on the "Get Targets" button */
|
||||||
void get_targets( GtkWidget *widget,
|
static void get_targets( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
static GdkAtom targets_atom = GDK_NONE;
|
static GdkAtom targets_atom = GDK_NONE;
|
||||||
GtkWidget *window = (GtkWidget *)data;
|
GtkWidget *window = (GtkWidget *)data;
|
||||||
@ -24,9 +23,9 @@ void get_targets( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Signal handler called when the selections owner returns the data */
|
/* Signal handler called when the selections owner returns the data */
|
||||||
void selection_received( GtkWidget *widget,
|
static void selection_received( GtkWidget *widget,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
GdkAtom *atoms;
|
GdkAtom *atoms;
|
||||||
GList *item_list;
|
GList *item_list;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -9,8 +8,8 @@ GtkWidget *selection_button;
|
|||||||
GtkWidget *selection_widget;
|
GtkWidget *selection_widget;
|
||||||
|
|
||||||
/* Callback when the user toggles the selection */
|
/* Callback when the user toggles the selection */
|
||||||
void selection_toggled( GtkWidget *widget,
|
static void selection_toggled( GtkWidget *widget,
|
||||||
gint *have_selection )
|
gint *have_selection )
|
||||||
{
|
{
|
||||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||||
{
|
{
|
||||||
@ -37,9 +36,9 @@ void selection_toggled( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Called when another application claims the selection */
|
/* Called when another application claims the selection */
|
||||||
gint selection_clear( GtkWidget *widget,
|
static gboolean selection_clear( GtkWidget *widget,
|
||||||
GdkEventSelection *event,
|
GdkEventSelection *event,
|
||||||
gint *have_selection )
|
gint *have_selection )
|
||||||
{
|
{
|
||||||
*have_selection = FALSE;
|
*have_selection = FALSE;
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (selection_button), FALSE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (selection_button), FALSE);
|
||||||
@ -48,11 +47,11 @@ gint selection_clear( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Supplies the current time as the selection. */
|
/* Supplies the current time as the selection. */
|
||||||
void selection_handle( GtkWidget *widget,
|
static void selection_handle( GtkWidget *widget,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
guint info,
|
guint info,
|
||||||
guint time_stamp,
|
guint time_stamp,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gchar *timestr;
|
gchar *timestr;
|
||||||
time_t current_time;
|
time_t current_time;
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static GtkWidget *spinner1;
|
static GtkWidget *spinner1;
|
||||||
|
|
||||||
void toggle_snap( GtkWidget *widget,
|
static void toggle_snap( GtkWidget *widget,
|
||||||
GtkSpinButton *spin )
|
GtkSpinButton *spin )
|
||||||
{
|
{
|
||||||
gtk_spin_button_set_snap_to_ticks (spin, GTK_TOGGLE_BUTTON (widget)->active);
|
gtk_spin_button_set_snap_to_ticks (spin, GTK_TOGGLE_BUTTON (widget)->active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggle_numeric( GtkWidget *widget,
|
static void toggle_numeric( GtkWidget *widget,
|
||||||
GtkSpinButton *spin )
|
GtkSpinButton *spin )
|
||||||
{
|
{
|
||||||
gtk_spin_button_set_numeric (spin, GTK_TOGGLE_BUTTON (widget)->active);
|
gtk_spin_button_set_numeric (spin, GTK_TOGGLE_BUTTON (widget)->active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void change_digits( GtkWidget *widget,
|
static void change_digits( GtkWidget *widget,
|
||||||
GtkSpinButton *spin )
|
GtkSpinButton *spin )
|
||||||
{
|
{
|
||||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinner1),
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinner1),
|
||||||
gtk_spin_button_get_value_as_int (spin));
|
gtk_spin_button_get_value_as_int (spin));
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_value( GtkWidget *widget,
|
static void get_value( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gchar buf[32];
|
gchar *buf;
|
||||||
GtkLabel *label;
|
GtkLabel *label;
|
||||||
GtkSpinButton *spin;
|
GtkSpinButton *spin;
|
||||||
|
|
||||||
spin = GTK_SPIN_BUTTON (spinner1);
|
spin = GTK_SPIN_BUTTON (spinner1);
|
||||||
label = GTK_LABEL (g_object_get_data (G_OBJECT (widget), "user_data"));
|
label = GTK_LABEL (g_object_get_data (G_OBJECT (widget), "user_data"));
|
||||||
if (GPOINTER_TO_INT (data) == 1)
|
if (GPOINTER_TO_INT (data) == 1)
|
||||||
sprintf (buf, "%d", gtk_spin_button_get_value_as_int (spin));
|
buf = g_strdup_printf ("%d", gtk_spin_button_get_value_as_int (spin));
|
||||||
else
|
else
|
||||||
sprintf (buf, "%0.*f", spin->digits,
|
buf = g_strdup_printf ("%0.*f", spin->digits,
|
||||||
gtk_spin_button_get_value (spin));
|
gtk_spin_button_get_value (spin));
|
||||||
gtk_label_set_text (label, buf);
|
gtk_label_set_text (label, buf);
|
||||||
|
g_free (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,28 +1,25 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
GtkWidget *status_bar;
|
GtkWidget *status_bar;
|
||||||
|
|
||||||
void push_item( GtkWidget *widget,
|
static void push_item( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
static int count = 1;
|
static int count = 1;
|
||||||
char buff[20];
|
gchar *buff;
|
||||||
|
|
||||||
g_snprintf (buff, 20, "Item %d", count++);
|
buff = g_strdup_printf ("Item %d", count++);
|
||||||
gtk_statusbar_push (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data), buff);
|
gtk_statusbar_push (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data), buff);
|
||||||
|
g_free (buff);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pop_item( GtkWidget *widget,
|
static void pop_item( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_statusbar_pop (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data));
|
gtk_statusbar_pop (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc,
|
int main( int argc,
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Our callback.
|
/* Our callback.
|
||||||
* The data passed to this function is printed to stdout */
|
* The data passed to this function is printed to stdout */
|
||||||
void callback( GtkWidget *widget,
|
static void callback( GtkWidget *widget,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
g_print ("Hello again - %s was pressed\n", (char *) data);
|
g_print ("Hello again - %s was pressed\n", (char *) data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This callback quits the program */
|
/* This callback quits the program */
|
||||||
gint delete_event( GtkWidget *widget,
|
static gboolean delete_event( GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data )
|
gpointer data )
|
||||||
{
|
{
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
#include <config.h>
|
|
||||||
#include <gtk/gtksignal.h>
|
#include <gtk/gtksignal.h>
|
||||||
#include <gtk/gtktable.h>
|
#include <gtk/gtktable.h>
|
||||||
#include <gtk/gtktogglebutton.h>
|
#include <gtk/gtktogglebutton.h>
|
||||||
@ -32,7 +31,7 @@ static void tictactoe_class_init (TictactoeClass *klass);
|
|||||||
static void tictactoe_init (Tictactoe *ttt);
|
static void tictactoe_init (Tictactoe *ttt);
|
||||||
static void tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt);
|
static void tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt);
|
||||||
|
|
||||||
static gint tictactoe_signals[LAST_SIGNAL] = { 0 };
|
static guint tictactoe_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GType
|
GType
|
||||||
tictactoe_get_type (void)
|
tictactoe_get_type (void)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "tictactoe.h"
|
#include "tictactoe.h"
|
||||||
|
Reference in New Issue
Block a user