Commit a2dafdfc authored by GMT 1999 Tony Gale's avatar GMT 1999 Tony Gale Committed by Tony Gale
Browse files

- Replace all uses of deprecated functions. - Replace menufactory example

Thu Jan 28 10:16:28 GMT 1999 Tony Gale  <gale@gtk.org>

        * docs/gtk_tut.sgml:
          - Replace all uses of deprecated functions.
          - Replace menufactory example with itemfactory example
            from Nick Scott <mendigo@geocities.com>
          - Minor bug fixes in the examples.
parent a7000587
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
This diff is collapsed.
This diff is collapsed.
......@@ -14,7 +14,7 @@ main (int argc, char *argv[])
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create an aspect_frame and add it to our toplevel window */
......
......@@ -18,7 +18,7 @@ GtkWidget *xpm_label_box( GtkWidget *parent,
/* Create box for xpm and label */
box1 = gtk_hbox_new (FALSE, 0);
gtk_container_border_width (GTK_CONTAINER (box1), 2);
gtk_container_set_border_width (GTK_CONTAINER (box1), 2);
/* Get the style of the button to get the
* background color. */
......@@ -77,7 +77,7 @@ int main( int argc,
/* Sets the border width of the window. */
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_realize(window);
/* Create a new button */
......
......@@ -31,7 +31,7 @@ gint main (int argc, gchar *argv[])
NULL);
vbox=gtk_vbox_new(FALSE, 5);
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
......
......@@ -64,14 +64,14 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_widget_show (check);
check = gtk_check_button_new_with_label("Visible");
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_visibility), entry);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_widget_show (check);
button = gtk_button_new_with_label ("Close");
......
......@@ -18,7 +18,7 @@ main (int argc, char *argv[])
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_exit), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create an EventBox and add it to our toplevel window */
......@@ -49,6 +49,6 @@ main (int argc, char *argv[])
gtk_main ();
return 0;
return(0);
}
/* example-end */
......@@ -64,7 +64,7 @@ int main( int argc,
GTK_SIGNAL_FUNC (destroy), NULL);
/* Sets the border width of the window. */
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Creates a new button with the label "Hello World". */
button = gtk_button_new_with_label ("Hello World");
......
......@@ -43,7 +43,7 @@ int main( int argc,
GTK_SIGNAL_FUNC (delete_event), NULL);
/* Sets the border width of the window. */
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* We create a box to pack widgets into. This is described in detail
* in the "packing" section. The box is not really visible, it
......
......@@ -61,7 +61,7 @@ gint main (int argc,
/* Inside the window we need a box to arrange the widgets
* vertically */
vbox=gtk_vbox_new(FALSE, 5);
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
......@@ -88,7 +88,7 @@ gint main (int argc,
/* We create a "Prison" to put a list item in ;) */
frame=gtk_frame_new("Prison");
gtk_widget_set_usize(frame, 200, 50);
gtk_container_border_width(GTK_CONTAINER(frame), 5);
gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
gtk_container_add(GTK_CONTAINER(vbox), frame);
gtk_widget_show(frame);
......
CC = gcc
all: menu menufactory
all: menu itemfactory
menu: menu.c
$(CC) `gtk-config --cflags` menu.c -o menu `gtk-config --libs`
menufactory: menufactory.o mfmain.o
$(CC) `gtk-config --libs` menufactory.o mfmain.o -o menufactory
menufactory.o: menufactory.c mfmain.h
$(CC) `gtk-config --cflags` -c menufactory.c -o menufactory.o
mfmain.o: mfmain.c mfmain.h menufactory.h
$(CC) `gtk-config --cflags` -c mfmain.c -o mfmain.o
itemfactory: itemfactory.c
$(CC) `gtk-config --cflags` itemfactory.c -o itemfactory `gtk-config --libs`
clean:
rm -f *.o menu menufactory
rm -f *.o menu itemfactory
/* example-start menu menufactory.c */
#include <gtk/gtk.h>
#include <strings.h>
#include "mfmain.h"
static void print_hello(GtkWidget *widget, gpointer data);
/* this is the GtkMenuEntry structure used to create new menus. The
* first member is the menu definition string. The second, the
* default accelerator key used to access this menu function with
* the keyboard. The third is the callback function to call when
* this menu item is selected (by the accelerator key, or with the
* mouse.) The last member is the data to pass to your callback function.
*/
static GtkMenuEntry menu_items[] =
{
{"<Main>/File/New", "<control>N", print_hello, NULL},
{"<Main>/File/Open", "<control>O", print_hello, NULL},
{"<Main>/File/Save", "<control>S", print_hello, NULL},
{"<Main>/File/Save as", NULL, NULL, NULL},
{"<Main>/File/<separator>", NULL, NULL, NULL},
{"<Main>/File/Quit", "<control>Q", file_quit_cmd_callback, "OK, I'll quit"},
{"<Main>/Options/Test", NULL, NULL, NULL}
};
static void
print_hello(GtkWidget *widget, gpointer data)
{
printf("hello!\n");
}
void get_main_menu(GtkWidget *window, GtkWidget ** menubar)
{
int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
GtkMenuFactory *factory;
GtkMenuFactory *subfactory;
factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
subfactory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
gtk_menu_factory_add_subfactory(factory, subfactory, "<Main>");
gtk_menu_factory_add_entries(factory, menu_items, nmenu_items);
gtk_window_add_accelerator_table(GTK_WINDOW(window), subfactory->table);
if (menubar)
*menubar = subfactory->widget;
}
/* example-end */
/* example-start menu menufactory.h */
#ifndef __MENUFACTORY_H__
#define __MENUFACTORY_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void get_main_menu (GtkWidget *, GtkWidget **menubar);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MENUFACTORY_H__ */
/* example-end */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment