t GTK+ Object # widget, [ W< z< sl. y Widget E / Xlib E 8 Csq ;, #,., $ Gtk widget object GWuS vv q. A o. # widget x C widget # X L. B #, D #( *), " #

Size: px
Start display at page:

Download "t GTK+ Object # widget, [ W< z< sl. y Widget E / Xlib E 8 Csq ;, #,., $ Gtk widget object GWuS vv q. A o. # widget x C widget # X L. B #, D #( *), " #"

Transcription

1 GTK Tutorial Ian Main Tony Gale 1998[ 5 24 ts liberta@cau.ac.kr, hanjiho@penta.co.kr 1998[ 5 25 C 1 < & 2 S B GTK Tutorial. GTK+ W W org/.? Z (3/??), Tutorial 1998/1/24 (, ;$ ^, P. ] ], u. Z & (?) :!(plain text) j. GTK+ Tutorial? 24$(Chapter) qpl $ 24$ == & [ L,^, L :, $ MU. L C; L s$(?) #" $, \ q Y u Xlib/Widget Programming E # q 3 8. # E, NIt I. :) 4 A t G. Z Y: t C? 7/,. Tutorial [ qt, q S # q : Z. GTK(GTK+) zg. y # (go linux) ] 3 : GTK+ FAQ L;,. 8t GTK q : us, < helloworld.c. L PXI7 7 & z< q o., G(signal)Y j (callback function) GTK; t. X #I;6 helloworld.c S x 8t, L G?z<. G, $o. C Widget C (packing) ] (9 P ` :) C z< L. C P qe g; Oq y, GTK+, t o$& :L "s # " i. t #B C (box)]y, C (table)]. Widget FAQ t s L, [t [ S,GTK+ Csq typedef structf...g WidgetObject " " 8u L. ] C++ t public member function 44 return type (*func pointer)(parameters,...) xs callback <. t func pointera NL, L # A "Csq (?)" 8 GTK P ;6 +. GTK+ 3 q 3 I. :)$

2 t GTK+ Object # widget, [ W< z< sl. y Widget E / Xlib E 8 Csq ;, #,., $ Gtk widget object GWuS vv q. A o. # widget x C widget # X L. B #, D #( *), " #(,, %,..) # ; q t?(?) [ # 7 _. j widget 5 widget y 5 E =;! widget. (label), x (tooltip), (progress bar), \(dialog box), (pixmap) #. "& t L\ 3(?) w. Tooltip x L u &, MacOS( :) t ( x P :[. Z v C. :)Z, 8t $? q t 3 5 7x ; q. B ' q; W ' A " P. :) C 7 t 8, C # (toolkit) N +. x C widget d! (notebook)y (scrolled 3 widget S : [ widget. X (Yahoo,Altavista,..) q, q "girl" *_ 8 N X ; I o? : 8 [ 9 ;., (scroll bar); f o. "girl" E ;P 8 G o? t W C I , L < (NEXT)>, W (page) [ L N. 3 W [ 3 d!.! widget 7 9(le manager);;$^ ; 9P. M$ _ (explorer)# TkDesk 7 [ 8, 7 Y I (item)!(list) qk. $ t,! Y, # _ x (selection) [ #. C L. - widget - (menu) L. GTK+ # # - # q s CW. L x c Fq, - fs s W $(factory) CW. - (pull-down)y >z(pop-up) ; ; o. L Y " " (- W$) C.! widget j! :`! widget [ z< L. widget! % # q L. [t M widget ', t I v q!' -> w. :) ; Preview widget r 6 [t w. Y&(?!) QC L $. (h *) [ L.! widget gtk tar.gz j t widget w. - I L # I L, 3(?) 5 P. :)

3 Widget 6 C@ ", C $ q (prototype) = < w. GTK+ t ; z<. X ;, B u. widget object (property) [. I, L I/O Idle sq (milliseconds), B, (monitoring) # q. C? 8!) +. ^^ Selection [ yg# % (editor) [ 8 x L, - t b (copy), (cut), W!(paste) #z. qe % t g; qnlo % Z 8 ; qn3 ;? C; r $? q E, $9 4 'X ' w. [C selection [. o$& q q L t,. ( [ qv, C; & # ; P. :) glib GTK+ FAQ t &, GTK+ U libc; I, glib. $ n t ^ C zx b < I, =; vu glib t qn 3? NIob 9o. ( : P $ t 3, printf; g print. )$ t U libc t CW M ^, s, z< L. (extrema)y, I (architecture) [G typedef s (data type), L # list) r w. U -? [ 5 8t g malloc/g free, glib: -? 6, "(timer), [ (string) P. L 2 /. GTK rc 7 G C 8 t rc7 ` # M? 9P. ^^ $ t ; q, [ C (binary,executable) P 3 ' EzA' t 3 (. GTK+ rc7 X q Y, [ (simbol). C rc7 L. widget $4 "Creating Your Own Widgets", " widget ". C Tictactoe widget q ; YA t ; s / L qnu. Widget & y widget,y Z ], =; L Jq,. x, : t 3 I "q%t\ ",, parent class x b. L widget b GY! 3 "" za bo. L $ t, 3 Y(?) widget q z [C> : C L w. $t$, C \ & L! (?) 4 $. GIMP, t NIb, L w. $9 ys 9 u!(low-level event) L. Xlib t? " #define \! S (bitwise operation) $o. \ t q# ;! 3u,9o? i $t [. widgety GTK (base) GDK(General Drawing Kits) t,.?,, ;\ nl 4 : P s 5o, Xlib

4 t. u ; q. Xlib t GC(Graphics Context) i ue q P # u gdk draw rectangle() i, P x z, _, [ ( x/>x/ x) # : GC 9$ nl, C ; : gdk draw rectangle t ; L GC J z. ] GTK+? & : :[ 8 Xlib t [: +. I # MUw! - - $ t ^ (?) $X,, & 8 L. Drawing tablet, " $X t f Z! $!(extended event) CW L P. t f =;! " ; I. :)q $ t, ^ $X(device) b L. GTK q 4 CX 4? L P. ) Contributing +. Credits [t C P 3P, Is $. [. Tutorial Copyright and Permissions Notice GPL? [t t, A. [ o. C; 3 26 [G liberta@zeus.phys.cau.ac.kr, L liberta@cau.ac.kr :) [t 8; A, L qe V z # : 3. GTK+Y $. :) (ts [t ; text t SGML L / [ 5 24 Tutorial S t q A. [t ; J P L 8 I ; ^ t 8; V+. ^^ [t s L ts P. G V#, > hanjiho@penta.co.kr - 4s 8X L9. ts GTK+ $.) C 2 < GTK(GIMP Toolkit) GIMP(General Image Manipulation Program). GTK Xlib : wrapper GDK(GIMP Drawing Kit) L. = ;! qc 53. GTK C Y. Peter Mattis petm@xcf.berkeley.edu Spencer Kimball spencer@xcf.berkeley.edu Josh MacDonald jmacd@xcf.berkeley.edu GTK : : q E (API, Application Programmers Interface). & C 5 P ]Y callback ( j );8q,.

5 @!(linked list) = ; Y, glib L 6=; vu X j q. gstrerror(), 5 qe vu I $# 5, :[, GTK m X 5. Z g malloc % " libc q. [t GTK L; <6,, y M. Csq N6 C qn3 NL, L;A., I 9, ; y X E 8,. c widget! GTK;?, 8, [t qn3 > 3 L Z " &* qe,, N s. GTK C++ 0 API, S,6, c C++ x 8, ( x. Z Objective C, GuileY., q t, 0 M9. [t ; GTK W qt qe [C # 3 N s 6,, [t; \,, L f. C 3 < 8t $9 ] GTK It, zx,. sc# ;$ / ftp.gtk.org /pub/gtk t ;K. GTK Z GTK GNU autoconf. S9,./congure help t U_. GTK t, ;. 200x200,, ML 7. #include <gtk/gtk.h> int main (int argc, char *argv[]) GtkWidget *window gtk_init (&argc, &argv) window = gtk_window_new (GTK_WINDOW_TOPLEVEL) gtk_widget_show (window) gtk_main () return 0? ] GTK q 5,, us # xs q gtk/gtk.h j,. gtk_init (&argc, &argv) GTK 5? t 3 gtk init(gint *argc, gchar ***argv) L., %m! 8 svy e # =; 6 6 gdk init(gint *argc, gchar ***argv) Jq. 5 # L, %m! G z 6, < ; I, I. --display --debug-level --no-xshm

6 --sync --show-events --no-show-events q M, + L,,! t C$.,? GTK q tf vu:!. v t L u. window = gtk_window_new (GTK_WINDOW_TOPLEVEL) gtk_widget_show (window) GTK WINDOW TOPLEVEL 9 $ Y XzA x0 ML, child; %m! 200x200 qkt,. gtk widget show() widget 6. GTK N s,l, t widget 3. v GTKs q;,. gtk_main () gtk main() GTK q : Z #. 8, GTK X!, I, Z 7 # 6 3. # t, X L. 3.1 GTK t Hello World C # widget( #), < hello world GTK u. /* helloworld.c */ #include <gtk/gtk.h> /* callback.. */ void hello (GtkWidget *widget, gpointer data) g_print ("Hello World\n") gint delete_event(gtkwidget *widget, GdkEvent *event, gpointer data) g_print ("delete event occured\n") /* "delete_event" * GTK TRUE, "destroy". FALSE *. * '?' *. */ TRUE main "delete_event" *. */ /* FALSE return (FALSE)

7 /* callback */ void destroy (GtkWidget *widget, gpointer data) gtk_main_quit () int main (int argc, char *argv[]) /* GtkWidget widget GtkWidget *window GtkWidget *button. */ /* GTK. *. */ gtk_init (&argc, &argv) /*. */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL) ( ), * delete_event(). * callback NULL. */ /* "delete_event" gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL) /* "destroy". * gtk_widget_destroy(), * "delete_event" callback 'TRUE'. */ gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (destroy), NULL) /* border width. */ gtk_container_border_width (GTK_CONTAINER (window), 10) /* "Hello World". */ button = gtk_button_new_with_label ("Hello World") /* "clicked" NULL hello() *. hello(). */ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (hello), NULL) /* "clicked" gtk_widget_destroy(window), *., 'destroy' *,. */ gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)) /*, GTK. */ gtk_container_add (GTK_CONTAINER (window), button) /* gtk_widget_show (button) widget. */

8 /*. */ gtk_widget_show (window) /* GTK gtk_main(). * ( * ). */ gtk_main () return Hello world gcc -Wall -g helloworld.c -o hello_world `gtk-config --cflags` \ `gtk-config --libs` 3, gtk 3 gtk-config,. gtk 5 7 t qe 7 X 'NL'. gtk-config --cflags 7 ; header 7 I Ib include % L, gtk-config --libs q b Y U& %. ; Y,. The GTK library (-lgtk), GDK widget. The GDK library (-lgdk), Xlib 8q wrapper. The glib library (-lglib), j j L 6, t 5, g print(). GTK glib L t sc# ;,., 18(glib) S. The Xlib library (-lx11), GDK 5 3. The Xext library (-lxext),, W -? pixmapy X $,. The math library GTK t GY callback Hello world & U_ Xt,! callback L Jq;. GTK! I; 6,, qe!; f t :< Cq; Jq; M G y. Cq J, " G" q. #, qe!; 8, P :< G widget " f" 3., GTK; z. # qe 8, G!I4 G z L : 8., Y q. gint gtk_signal_connect (GtkObject *object, gchar *name, GtkSignalFunc func, gpointer func_data)

9 G f widgetl,!i4l G. G : 6, P J va. # "callback " L 6 qk. void callback_func(gtkwidget *widget, gpointer callback_data) G f widget j ; L, gtk signal connect() P sqk A j. Hello world C t 5 Z,. gint gtk_signal_connect_object (GtkObject *object, gchar *name, GtkSignalFunc func, GtkObject *slot_object) gtk signal connect object() callback ; GTK object j, # > L gtk signal connect(). t : 8 callback?j b,. void callback_func (GtkObject *object) t object widget. q gtk signal connect object t callback z M,. hello world C t, s t G widget/object GTK :5L. ; L, t ; L callback t. GTK t GtkWidget j t, E gtk signal connect object() 8,. 8 t, callback 8;: A ;Kb ;,. 3.4 Hello World 0 ( B C : NUL, hello world C 0 &., # " "! callback. C t widgety A ;? X,,, q M., C qe # P ; N s A,. void hello (GtkWidget *widget, gpointer data) g_print ("Hello World\n") callback ". 9; q! 48 "delete event"; f 3. t! X b x., X L, A 6, Z & q [. callback ; GTK qe b N3. FALSE 8 GTK ; "destroy" G f, M L : 3. L TRUE, "destroy" G f L, "destroy" G 3.

10 gint delete_event(gtkwidget *widget, GdkEvent *event, gpointer data) g_print ("delete event occured\n") return (FALSE) gtk main quit(), [, Z callback ;., x M9, 8 N,t. void destroy (GtkWidget *widget, gpointer data) gtk_main_quit () main(), NL f, q Y ;,? GTK q main() #B ; L. int main (int argc, char *argv[]) t, GtkWidget us j xs., # I t 53. GtkWidget *window GtkWidget *button gtk init; #. Y ;,, # L, < t sq u., < t qe! tqc L, argc argv U& M, 3 t, q +I u u. gtk_init (&argc, &argv) ^ #., #. GtkWidget *window ; ; us -? ; q C C U& us ; 3,. ^ z, I gtk widget show(window) MU :[ C ML. tb 3,. window = gtk_window_new (GTK_WINDOW_TOPLEVEL) E ; 9, object ;. t "destory" G. G ; Y t 9 :( L ; "delete event" t TRUE :), Z 7h object widget x gtk widget destroy() : f., z, E?. t,, X t A destroy() NULL GTK [ 3. GTK OBJECT GTK SIGNAL FUNC 3 u 3 s6 j 6Y s. gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (destroy), NULL)

11 container object za s 5., 10 C 3. X 15(Widget za) section t P ;? 3,. L, GTK CONTAINER j 6 s. gtk_container_border_width (GTK_CONTAINER (window), 10) ^ # #., ^ GtkWidget us -? W L,, # 6, L button j ; ;. # 3 : "Hello World" ; 3,. button = gtk_button_new_with_label ("Hello World") t # g;., G IsL, "clicked" G f : hello() ;. A L, 0 t hello() callback & NULL u. <&, ; j # : "clicked" G f 3. gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (hello), NULL) Z 4 t #., 9 ; t, ; t "destroy" G qn3 v,. X t # 8$9 hello() callback ; L, q z t,. 8 v callback 8 6,,? n t. gtk widget destroy() ; GtkWidget *widget :[, t gtk signal connect() 5 ML gtk signal connect object() 7. gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)), C 6 t 3,. \ & 3., GTK 3, # # 3 X b ( N u. gtk_container_add (GTK_CONTAINER (window), button) C? z.!? G,? # qb!ul, GTK; widget " s " u. widget ;$ #. 0 t ; $9 L 4 #?j q 3 I, &?j : ; 3. gtk_widget_show (button) gtk_widget_show (window) L ], gtk main() t X t!; f 3 L,!; : G 4 widget,. gtk_main () L. gtk quit(); Cq t #3.

12 return 0 C, ; GTK # t # 8 widget "clicked" G f. A G!I7 G z L,, x & 3. C t ; # 8 hello() ; NULL L, q G ;., widget gtk widget destroy() t widget [., ; "destroy" G f 3 t L, "destroy" callback t GTK; [ 3,.! Z P [ K 5,. 3 8 "delete event" G f L "delete event". ; t TRUE 8 8 +L IX f M. FALSE 8 GTK "destroy" G f L "destroy" callback q GTK; [. 5^ $,, G t GY,6 P M > r. C 4 < X #I;6 4.1 Xt C t s@ 9 z<,x. gint, gchar # int char typedef., GS : 9 U,. 64! N7 32! "gint32" n [G 32! A typedef q,^ ;,. typedef \ & [:.? glib/ glib.h t A q (, gtk.h t j 3.). Z ; GtkObject :GtkWidget, s@,. GTK : zg,l, widget # object. 4.2 G X NI gtk signal connect xs Z 3 U_. gint gtk_signal_connect (GtkObject *object, gchar *name, GtkSignalFunc func, gpointer func_data) gint?, callback v. Xt m " GY object callback ; L,, K t,. v ;! t callback C$ u. void gtk_signal_disconnect (GtkObject *object, gint id) t, C$ L widgety signal connect widget v id J y G qv. Object t? G C$ Z,. gtk_signal_handlers_destroy (GtkObject *object)., J object t, & za? G C$ u.

13 4.3 \ Hello World Callback # C; cx hello world., Z < ts C C widget,. /* helloworld2.c */ #include <gtk/gtk.h> /* callback. *. */ void callback (GtkWidget *widget, gpointer data) g_print ("Hello again - %s was pressed\n", (char *) data) /* callback */ void delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) gtk_main_quit () int main (int argc, char *argv[]) /* GtkWidget widget GtkWidget *window GtkWidget *button GtkWidget *box1. */ /* GTK. *. */ gtk_init (&argc, &argv) /*. */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL) /*, "Hello Buttons!". */ gtk_window_set_title (GTK_WINDOW (window), "Hello Buttons!") /* GTK delete_event *. */ gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL) /* border width. */ gtk_container_border_width (GTK_CONTAINER (window), 10) /* widget. *. * widget. */ box1 = gtk_hbox_new(false, 0) /*. */ gtk_container_add (GTK_CONTAINER (window), box1) /* "Button 1". */ button = gtk_button_new_with_label ("Button 1") /* * "callback". */ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 1") /* gtk_container_add, *. */ gtk_box_pack_start(gtk_box(box1), button, TRUE, TRUE, 0) /*.

14 * GTK,. */ gtk_widget_show(button) /*. */ button = gtk_button_new_with_label ("Button 2") /* callback. *. */ "button 2" gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 2") gtk_box_pack_start(gtk_box(box1), button, TRUE, TRUE, 0) /* *. *. */ gtk_widget_show(button) gtk_widget_show(box1) gtk_widget_show (window) /*! */ gtk_main () return 0 C sl 7. [ t 9 $# < t t, L ( N,. XI "Quit" # q 8;, ^,. Z < q 6 gtk box pack start() sq. L L, [. L, gtkwindow new() Z dene GTK WINDOW DIALOG., 9 c \ 6, : 5 Kb. C 5 < C Widget ; qe q 8t, # # \ # n,. hello world C # widget L 0 t, 4 "pack" gtk container add. # ; # widget n :, qn3 n X Cq b? t "packing", #$. 5.1 packing C Xt C t, q. widget e C O, M widget x C. e C widget E, object 0 e t t Y. t Y. Y 4 K9 t qn3 S tp. ^ e gtk hbox new(), L t gtk vbox new(). gtk box pack start() gtk box pack end () x C 4 object X P. gtkbox pack start() t t I, L e t t C,. L gtk box pack end() C. Z widget A L, Y 7. C t gtk box pack start(),. Object Z x C$# widget. L P, widget C # j L widget, ; # K,.

15 , GTK ; widget n X N3 L 0 t : S< Z : 3. Z widget qn3 C qb = 0. ; \\ ", widget nl qt\ CW u. 5.2 & NI :[, GTK t C,?. 6, qn3 t 7,. ; : ; 3. <CENTER > <IMG SRC="gtk t ut p ackbox1:gif"vspace = "15"HSPACE = "10"WIDTH = "528"HEIGHT = "235"ALT ="BoxP ackingexampleimage">< =CENT ER> v = # ; L # e (hbox) j. gtk box pack e # C, 9,. # e C (, gtkbox pack start u )., gtk box pack start xs. void gtk_box_pack_start (GtkBox *box, GtkWidget *child, gint gint gint expand, fill, padding) object C L object. Object t? #,L, 0 t K # C 3. gtk box pack start() Z gtk box pack end() t expand ; TRUE :, widget W ; 6 q;3,. L, FALSE 8 widget :<& 3. expand FALSE 8 widget_ M 8 ; t gtk box pack start Z gtk box pack end q Y ; 3. ll TRUE : object W Cq. L FALSE 8 object W M., expand ; TRUE : Y;. ^ : ; ( e ). GtkWidget * gtk_hbox_new (gint homogeneous, gint spacing) thomogeneous K object ; Cq ( e E C, E m)., 6 8, gtk box pack expand sc# TRUE ;. t spacing( ; q 6 6 ) padding( C 6 6 ) > X? Spacing object P f #,6 padding object tf #,., > < & v,. <CENTER > <IMG ALIGN="center" SRC="gtk t ut p ackbox2:gif"width = "509"HEIGHT = "213"V SP ACE = "15"HSP ACE = "10"ALT ="BoxP ackingexampleimage">< =CENT ER> y q s ;. # S t, t [C. 7 t ; L gi.

16 5.3 C C /* packbox.c */ #include "gtk/gtk.h" void delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) gtk_main_quit () hbox. *. *,. */ /* Button_label GtkWidget *make_box (gint homogeneous, gint spacing, GtkWidget *box GtkWidget *button char padstr[80] /* homogenous spacing gint expand, gint fill, gint padding) hbox. */ box = gtk_hbox_new (homogeneous, spacing) /*. */ button = gtk_button_new_with_label ("gtk_box_pack") gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding) gtk_widget_show (button) button = gtk_button_new_with_label ("(box,") gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding) gtk_widget_show (button) button = gtk_button_new_with_label ("button,") gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding) gtk_widget_show (button) /* expand. */ if (expand == TRUE) else button = gtk_button_new_with_label ("TRUE,") button = gtk_button_new_with_label ("FALSE,") gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding) gtk_widget_show (button) /*,. */ button = gtk_button_new_with_label (fill? "TRUE," : "FALSE,") gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding) gtk_widget_show (button) sprintf (padstr, "%d) ", padding) button = gtk_button_new_with_label (padstr) gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding) gtk_widget_show (button) return box

17 int main (int argc, char *argv[]) GtkWidget *window GtkWidget *button GtkWidget *box1 GtkWidget *box2 GtkWidget *separator GtkWidget *label GtkWidget *quitbox int which /*! */ gtk_init (&argc, &argv) if (argc!= 2) fprintf (stderr, "usage: packbox num, where num is 1, 2, 3.\n") /* GTK, exit status 1. */ gtk_exit (1) which = atoi (argv[1]) /*. */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL) /* Main destroy. *. */ gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL) gtk_container_border_width (GTK_CONTAINER (window), 10) /* (vbox). *. * (.) */ box1 = gtk_vbox_new (FALSE, 0) switch (which) case 1: /*. */ label = gtk_label_new ("gtk_hbox_new (FALSE, 0) ") /*. widget *. */ gtk_misc_set_alignment (GTK_MISC (label), 0, 0) /* (vbox box1). vbox * widget. */ gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0) /*. */ gtk_widget_show (label)

18 /* make_box. */ box2 = make_box (FALSE, 0, FALSE, FALSE, 0) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) box2 = make_box (FALSE, 0, TRUE, FALSE, 0) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) box2 = make_box (FALSE, 0, TRUE, TRUE, 0) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) /* separator. *,. */ separator = gtk_hseparator_new () vbox. widget * vbox,. */ /* separator gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5) gtk_widget_show (separator) /*. */ label = gtk_label_new ("gtk_hbox_new (TRUE, 0) ") gtk_misc_set_alignment (GTK_MISC (label), 0, 0) gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0) gtk_widget_show (label) /* homogeneous, spacing, expand, fill, padding. */ box2 = make_box (TRUE, 0, TRUE, FALSE, 0) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) box2 = make_box (TRUE, 0, TRUE, TRUE, 0) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) /* separator */ separator = gtk_hseparator_new () /* gtk_box_pack_start 3 * expand, fill, padding. */ gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5) gtk_widget_show (separator) break case 2: /* * vbox. */. box1 main() label = gtk_label_new ("gtk_hbox_new (FALSE, 10) ") gtk_misc_set_alignment (GTK_MISC (label), 0, 0) gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0) gtk_widget_show (label) box2 = make_box (FALSE, 10, TRUE, FALSE, 0)

19 gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) box2 = make_box (FALSE, 10, TRUE, TRUE, 0) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) separator = gtk_hseparator_new () gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5) gtk_widget_show (separator) label = gtk_label_new ("gtk_hbox_new (FALSE, 0) ") gtk_misc_set_alignment (GTK_MISC (label), 0, 0) gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0) gtk_widget_show (label) box2 = make_box (FALSE, 0, TRUE, FALSE, 10) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) box2 = make_box (FALSE, 0, TRUE, TRUE, 10) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) separator = gtk_hseparator_new () gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5) gtk_widget_show (separator) break case 3: /* gtk_box_pack_end() widget *.,. */ box2 = make_box (FALSE, 0, FALSE, FALSE, 0) /*. */ label = gtk_label_new ("end") /* gtk_box_pack_end(), make_box() * hbox. gtk_box_pack_end (GTK_BOX (box2), label, FALSE, FALSE, 0) /*. */ gtk_widget_show (label) /* box2 box1. */ gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0) gtk_widget_show (box2) /* bottom separator. */ separator = gtk_hseparator_new () /* ( ) separator *. hbox 400 *, "end" hbox (separated) *., hbox widget *. */ gtk_widget_set_usize (separator, 400, 5) /* main() vbox(box1) separator *. */

20 gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5) gtk_widget_show (separator) /* hbox quitbox = gtk_hbox_new (FALSE, 0)..! */ /* quit. */ button = gtk_button_new_with_label ("Quit") /*. *, "destroy". */ gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)) /* quitbox * expand, fill, padding. */. gtk_box_pack_start gtk_box_pack_start (GTK_BOX (quitbox), button, TRUE, FALSE, 0) /* vbox(box1) quitbox. */ gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, FALSE, 0) /* widget vbox, main. */ gtk_container_add (GTK_CONTAINER (window), box1) /*. */ gtk_widget_show (button) gtk_widget_show (quitbox) gtk_widget_show (box1) /*. */ gtk_widget_show (window) /* gtk_main. */ gtk_main (). *. */ /* gtk_main_quit() gtk_exit() return C Z C -,., qe \ t Is,. t, widget Oq <: 3. widget ; za v W ; 3,. ] $9 b, gtk table new. GtkWidget* gtk_table_new (gint rows, gint columns, gint homogeneous) L, &.

21 homogeneous ; qn3 TRUE 8 t ;$ widget 0 3. Z FALSE 8 t ;$ m widget m, L t ;$ I widget C 0 3. Y 0 t n 3. t n gtk table new t, c ; =2 L =2, 3 za 3 8 us _vg t, s. K widget n 8. void gtk_table_attach (GtkTable GtkWidget gint gint gint gint gint gint gint gint *table, *child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding) table ; L child n L widget. Y attach widget n c 2x2 I d X # 8, L ; 8, leftattach=1, right attach=2, top attach=1, bottom attach=2, 3 qb. C, 2x2 x 8, left attach=0, right attach=2, top attach=0, bottom attach=1 L 8. xoptiony yoption C A,, ; s t OR S 8. Y. GTK FILL -GTKFILL za 8 ; widget : widget P ;? W. GTK SHRINK - widget : W : widget A\: I #t ; M3. c GTK SHRINK; za 8 widget v qq 4 3. GTK EXPAND -, za 8 + W 3. C. K t, d widget s q u. gtk table attach() ; L. t shortcut. void gtk_table_attach_defaults (GtkTable GtkWidget gint *table, *widget, left_attach,

22 gint gint gint right_attach, top_attach, bottom_attach) X Y %m! GTK FILLjGTK EXPAND, L X Y C. 0. #". Z gtk table set row spacing()y gtk table set col spacing()., sq Z spacing za. void gtk_table_set_row_spacing (GtkTable gint gint *table, row, spacing) L void gtk_table_set_col_spacing (GtkTable *table, gint gint column, spacing) qe t space, L t I sq,.? Y [ spacing P. void gtk_table_set_row_spacings (GtkTable *table, gint spacing) void gtk_table_set_col_spacings (GtkTable gint *table, spacing) Y t spacing M, r. 5.5 C C t 2x2 K # #. # nl quit # 8t I n. t 3. <CENTER > <IMG SRC="gtk t ut t able:gif"vspace = "15"HSPACE = "10"ALT = "T ablep ackingexampleimage"w IDTH ="180"HEIGHT = "120">< =CENT ER>. /* table.c */ #include <gtk/gtk.h> /* callback. * stdout. */ void callback (GtkWidget *widget, gpointer data) g_print ("Hello again - %s was pressed\n", (char *) data) /* callback */ void delete_event (GtkWidget *widget, gpointer data)

23 gtk_main_quit () int main (int argc, char *argv[]) GtkWidget *window GtkWidget *button GtkWidget *table gtk_init (&argc, &argv) /*. */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL) /*. */ gtk_window_set_title (GTK_WINDOW (window), "Table") /* GTK delete_event. */ gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL) /* border width. */ gtk_container_border_width (GTK_CONTAINER (window), 20) /* 2x2. */ table = gtk_table_new (2, 2, TRUE) /*. */ gtk_container_add (GTK_CONTAINER (window), table) /*. */ button = gtk_button_new_with_label ("button 1") /* "button 1" *. */ gtk_signal_connect (GTK_OBJECT (button), "clicked", "callback" GTK_SIGNAL_FUNC (callback), (gpointer) "button 1") /*. */ gtk_table_attach_defaults (GTK_TABLE(table), button, 0, 1, 0, 1) gtk_widget_show (button) /*. */ button = gtk_button_new_with_label ("button 2") /* "button 2" *. */ gtk_signal_connect (GTK_OBJECT (button), "clicked", "callback" GTK_SIGNAL_FUNC (callback), (gpointer) "button 2") /*. */ gtk_table_attach_defaults (GTK_TABLE(table), button, 1, 2, 0, 1)

24 gtk_widget_show (button) /* "Quit". */ button = gtk_button_new_with_label ("Quit") /* "delete_event" *. */ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (delete_event), NULL) /* "Quit". */ gtk_table_attach_defaults (GTK_TABLE(table), button, 0, 2, 1, 2) gtk_widget_show (button) gtk_widget_show (table) gtk_widget_show (window) gtk_main () return 0 C 6 < Widget GTK t widget : < Y. 1. gtk * new - ^ widget j.,? t &,. 2. : P? 3. Widget gtk container add()# gtk box pack start() : t widget x C K C. 5. gtk widget show() widget. gtk widget show() ; widget? 6 GTK 3 N L,, C u ;,., M3 gtk widget hide. Widget t M. 4;,, widget f # 3,, ;$ # 3 t? u ; q 3, -,. gtk widget show() 3 8 qe widget( # widget ) u ; $9 M. 6.1 j 6( C ) G 8t N9, GTK C 7., sq \ j 6! :#, L j 6 :#, sc# q. ; 3 == Y. GTK WIDGET(widget)

25 GTK OBJECT(object) GTK SIGNAL FUNC(function) GTK CONTAINER(container) GTK WINDOW(window) GTK BOX(box),? j! 5. C t,6, xs, :,. I GWuS t ",? GtkWidget GtkObject t 7f,., qe ; object u : q%t widget y - & GTK OBJECT() t. q. gtk_signal_connect(gtk_object(button), "clicked", GTK_SIGNAL_FUNC(callback_function), callback_data), # # object j! L, j callback j!. widget Z x C. I GWuS 8 \ widget GtkContainer t 7f N,. qe widget x C u J s GTK CONTAINER. 3 [t t a 3 q MU. # GTK 7 U_. P, xs 8t widget qn3 W, q M. 6.2 Widget GWuS L, widget? GWuS! ;. GtkObject +GtkData +GtkAdjustment `GtkTooltips `GtkWidget +GtkContainer +GtkBin +GtkAlignment +GtkEventBox +GtkFrame `GtkAspectFrame +GtkHandleBox +GtkItem +GtkListItem +GtkMenuItem `GtkCheckMenuItem `GtkRadioMenuItem `GtkTreeItem +GtkViewport `GtkWindow +GtkColorSelectionDialog +GtkDialog

26 `GtkInputDialog `GtkFileSelection +GtkBox +GtkButtonBox +GtkHButtonBox `GtkVButtonBox +GtkHBox +GtkCombo `GtkStatusbar `GtkVBox +GtkColorSelection `GtkGammaCurve +GtkButton +GtkOptionMenu `GtkToggleButton `GtkCheckButton `GtkRadioButton +GtkCList `GtkCTree +GtkFixed +GtkList +GtkMenuShell +GtkMenuBar `GtkMenu +GtkNotebook +GtkPaned +GtkHPaned `GtkVPaned +GtkScrolledWindow +GtkTable +GtkToolbar `GtkTree +GtkDrawingArea `GtkCurve +GtkEditable +GtkEntry `GtkSpinButton `GtkText +GtkMisc +GtkArrow +GtkImage +GtkLabel `GtkTipsQuery `GtkPixmap +GtkPreview +GtkProgressBar +GtkRange +GtkScale +GtkHScale `GtkVScale `GtkScrollbar +GtkHScrollbar `GtkVScrollbar +GtkRuler +GtkHRuler

27 `GtkVRuler `GtkSeparator +GtkHSeparator `GtkVSeparator 6.3 X[ widget widget [ ;,. cqe! j 8 GtkEventBox b,. 14(The EventBox Widget) section S. GtkAlignment GtkArrow GtkBin GtkBox GtkImage GtkItem GtkLabel GtkPaned GtkPixmap GtkScrolledWindow GtkSeparator GtkTable GtkViewport GtkAspectFrame GtkFrame GtkVPaned GtkHPaned GtkVBox GtkHBox GtkVSeparator GtkHSeparator widget L q ;6 GTK u G,. Z GTK j testgtk.c., gtk/testgtk.c t,. C 7 < # widget 7.1 ; # #widget t $ I., \ &. # ;. # gtk button new with labe() L, # gtk button new().,, ^ L gtk box pack start K object C 6, gtk container add # K C 8. C gtk button new Y #. ;, FqK # 6 t,,. /* buttons.c */ #include <gtk/gtk.h>

28 /* *. */ hbox. GtkWidget *xpm_label_box (GtkWidget *parent, gchar *xpm_filename, gchar *label_text) GtkWidget *box1 GtkWidget *label GtkWidget *pixmapwid GdkPixmap *pixmap GdkBitmap *mask GtkStyle *style /* xpm. */ box1 = gtk_hbox_new (FALSE, 0) gtk_container_border_width (GTK_CONTAINER (box1), 2) /*.. background, *. */ style = gtk_widget_get_style(parent) /* xpm. */ pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask, &style->bg[gtk_state_normal], xpm_filename) pixmapwid = gtk_pixmap_new (pixmap, mask) /*. */ label = gtk_label_new (label_text) /*. */ gtk_box_pack_start (GTK_BOX (box1), pixmapwid, FALSE, FALSE, 3) gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 3) gtk_widget_show(pixmapwid) gtk_widget_show(label) return (box1) /* callback. */ void callback (GtkWidget *widget, gpointer data) g_print ("Hello again - %s was pressed\n", (char *) data) int main (int argc, char *argv[]) /* GtkWidget widget GtkWidget *window GtkWidget *button GtkWidget *box1. */

29 gtk_init (&argc, &argv) /*. */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL) gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!") /*. */ gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_exit), NULL) /* border width. */ gtk_container_border_width (GTK_CONTAINER (window), 10) /*. */ button = gtk_button_new () /*. */ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "cool button") /*. */ box1 = xpm_label_box(window, "info.xpm", "cool button") /* widget gtk_widget_show(box1),. */ gtk_container_add (GTK_CONTAINER (button), box1) gtk_widget_show(button) gtk_container_add (GTK_CONTAINER (window), button) gtk_widget_show (window) /*. */ gtk_main () return 0 xpm label box x C; qe widget Y C 5,. 7.2 # # ; q \ qb > 8 ; #Y P., \ ;, ; s8 q# 3. Z 8, K q,. # 5 % # \ q5", # #Y % #.,? 3 8 > :,. ^ # 8,.

30 GtkWidget* gtk_toggle_button_new (void) GtkWidget* gtk_toggle_button_new_with_label (gchar *label) 8Q 9,, ; # widget Y [., #, L, y widget C q #. #Y % #, # \, I C t., qe callback t \!. # f G ( / / % # widget) "toggled" G. # \ 8 toggled G!I4 G z L,, callback?j,. void toggle_button_callback (GtkWidget *widget, gpointer if (GTK_TOGGLE_BUTTON (widget)->active) /*, up. */ data) else /* down. */ void gtk_toggle_button_set_state (GtkToggleButton *toggle_button, gint state) #Y,, t 7f % # \ 6 5. ; # J sl, L, \ I u TRUE Z FALSE J u. %m! K \, FALSE. ; gtk toggle button set state() 58 # t "clicked" G f t # \ ; C 3 r. void gtk_toggle_button_toggled (GtkToggleButton *toggle_button), & # L, "toggled" G f. 7.3 # # # t " Y \ U 3., #Y K!,! P L. qe q t t,., ; ; # t ;. GtkWidget* gtk_check_button_new (void) GtkWidget* gtk_check_button_new_with_label (gchar *label) new with label! ; L #. # \, # t.

31 7.4 % # % # q qt #B x / > L # Y P., q! t # x E 58 ^,. ^ % # 5. GtkWidget* gtk_radio_button_new (GSList *group) GtkWidget* gtk_radio_button_new_with_label (GSList *group, gchar *label) ;,. :<& X. NULL J b. L,. GSList* gtk_radio_button_group (GtkRadioButton *radio_button) L gtk radio button new Z gtk radio button new with label J u. t qe # %m! 3 <&, ^ f. void gtk_toggle_button_set_state (GtkToggleButton *toggle_button, gint state), # tz< 6, A & 0. # q. /* radiobuttons.c */ #include <gtk/gtk.h> #include <glib.h> void close_application( GtkWidget *widget, gpointer data ) gtk_main_quit() main(int argc,char *argv[]) static GtkWidget *window = NULL GtkWidget *box1 GtkWidget *box2 GtkWidget *button GtkWidget *separator GSList *group gtk_init(&argc,&argv) window = gtk_window_new (GTK_WINDOW_TOPLEVEL) gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC(close_application), NULL) gtk_window_set_title (GTK_WINDOW (window), "radio buttons") gtk_container_border_width (GTK_CONTAINER (window), 0)

32 box1 = gtk_vbox_new (FALSE, 0) gtk_container_add (GTK_CONTAINER (window), box1) gtk_widget_show (box1) box2 = gtk_vbox_new (FALSE, 10) gtk_container_border_width (GTK_CONTAINER (box2), 10) gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0) gtk_widget_show (box2) button = gtk_radio_button_new_with_label (NULL, "button1") gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0) gtk_widget_show (button) group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)) button = gtk_radio_button_new_with_label(group, "button2") gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE) gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0) gtk_widget_show (button) group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)) button = gtk_radio_button_new_with_label(group, "button3") gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0) gtk_widget_show (button) separator = gtk_hseparator_new () gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0) gtk_widget_show (separator) box2 = gtk_vbox_new (FALSE, 10) gtk_container_border_width (GTK_CONTAINER (box2), 10) gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0) gtk_widget_show (box2) button = gtk_button_new_with_label ("close") gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(close_application), GTK_OBJECT (window)) gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0) GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT) gtk_widget_grab_default (button) gtk_widget_show (button) gtk_widget_show (window) gtk_main() return(0) [$Y qe #; #! ; L qb ; v 8. button2 = gtk_radio_button_new_with_label( gtk_radio_button_group (GTK_RADIO_BUTTON (button1)), "button2")

33 C 8 < j widget 8.1 (label) GTK t s 5L p:,. [ X ; t G f M. c 8 EventBox widget. ^,. GtkWidget* gtk_label_new (char *str) # ; # 4L [.! 8,. void gtk_label_set (GtkLabel char *label, *str) qk (GTK LABEL() j! ) L, ^ [. ^ W E : S<. & [ L 8,. void gtk_label_get (GtkLabel char *label, **str) qp L, U L [. 8.2 x (tooltip widget) j qe ## widget = # "X 3 8! [ q# E ;.,,6, t t C z< 9. C L 8 GDK j testgtk.c S. # qe widget tooltip 5 M. ; ^ tooltip,., sq t s8. ; GtkTooltip tooltip. GtkTooltips *gtk_tooltips_new (void) ^ tooltipy, P widget 8,, 6. void gtk_tooltips_set_tip (GtkTooltips *tooltips, GtkWidget *widget, const gchar *tip_text, const gchar *tip_private) ; tooltipl, tooltip j 3 widget.! ; tooltip t L,. NULL v.,.

34 GtkTooltips *tooltips GtkWidget *button... tooltips = gtk_tooltips_new () button = gtk_button_new_with_label ("button 1")... gtk_tooltips_set_tip (tooltips, button, "This is button 1", NULL) Tooltip 5. t & 9. void gtk_tooltips_destroy (GtkTooltips *tooltips) q tooltip C$. void gtk_tooltips_enable (GtkTooltips *tooltips) Disable za tooltip enable. void gtk_tooltips_disable (GtkTooltips *tooltips) Enable za tooltip disable. void gtk_tooltips_set_delay (GtkTooltips *tooltips, gint delay) Tooltip q v# j widget "X 3 b, millisecond 6. %m! 1000millisecond, 1#. void gtk_tooltips_set_tips (GtkTooltips *tooltips, GtkWidget *widget, gchar *tips_text) yq tooltip! 4. void gtk_tooltips_set_colors (GtkTooltips *tooltips, GdkColor *background, GdkColor *foreground) Tooltip v _Y E_. qn3 _ za t? 9. Tooltip [,. \ N,. :) 8.3 (progress bar) z \ # 4 5. C 8 N9,,. # $ 9 ^ qs U_,. GtkWidget *gtk_progress_bar_new (void) C ; qpl,. void gtk_progress_bar_update (GtkProgressBar *pbar, gfloat percentage)

35 ; L, ' ' # 6., C 0 1 L, 0 100N! y,. ; I # Z %/ 3 Y 5. (section 16( I, L I/O Idle ) S.)? E gtk progress bar update ; 53., I z! C., Z, # v,. /* progressbar.c */ #include <gtk/gtk.h> static int ptimer = 0 int pstat = TRUE /*. pstat FALSE *,. */ gint progress (gpointer data) gfloat pvalue /*. */ pvalue = GTK_PROGRESS_BAR (data)->percentage if ((pvalue >= 1.0) (pstat == FALSE)) pvalue = 0.0 pstat = TRUE pvalue += 0.01 gtk_progress_bar_update (GTK_PROGRESS_BAR (data), pvalue) return TRUE /*. */ void progress_r (void) pstat = FALSE void destroy (GtkWidget *widget, gpointer data) gtk_main_quit () int main (int argc, char *argv[]) GtkWidget *window GtkWidget *button GtkWidget *label GtkWidget *table GtkWidget *pbar

36 gtk_init (&argc, &argv) window = gtk_window_new (GTK_WINDOW_TOPLEVEL) gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (destroy), NULL) gtk_container_border_width (GTK_CONTAINER (window), 10) table = gtk_table_new(3,2,true) gtk_container_add (GTK_CONTAINER (window), table) label = gtk_label_new ("Progress Bar Example") gtk_table_attach_defaults(gtk_table(table), label, 0,2,0,1) gtk_widget_show(label) /*,. */ pbar = gtk_progress_bar_new () gtk_table_attach_defaults(gtk_table(table), pbar, 0,2,1,2) gtk_widget_show (pbar) /* timeout. */ ptimer = gtk_timeout_add (100, progress, pbar) /*. */ button = gtk_button_new_with_label ("Reset") gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (progress_r), NULL) gtk_table_attach_defaults(gtk_table(table), button, 0,1,2,3) gtk_widget_show(button) button = gtk_button_new_with_label ("Cancel") gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (destroy), NULL) gtk_table_attach_defaults(gtk_table(table), button, 1,2,2,3) gtk_widget_show (button) gtk_widget_show(table) gtk_widget_show(window) gtk_main () return 0 : Y[ P. 5 t 0 N I. pbar = gtk_progress_bar_new () pbar ^ L. ptimer = gtk_timeout_add (100, progress, pbar)

37 t A < I, I b, I. pvalue = GTK_PROGRESS_BAR (data)->percentage t pvalue percentage bar & A sl. gtk_progress_bar_update (GTK_PROGRESS_BAR (data), pvalue), pvalue z!. L N,,,! 8.4 \ \ widget,, C, =; ; y C q # <. Dialog us,. struct GtkDialog GtkWindow window GtkWidget *vbox GtkWidget *action_area, & L, L vbox C L, separator, L # t "action area" hbox C. \widget P 3 >z - $# 5., A :,,, # <. GtkWidget* gtk_dialog_new (void) t^ 8 3. GtkWidget *window window = gtk_dialog_new (), \,L, qn3 3. t action area K # C. button =... gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0) gtk_widget_show (button) L C vbox # 8;. I. label = gtk_label_new ("Dialogs are groovy") gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), label, TRUE, TRUE, 0) gtk_widget_show (label)

38 \ C t, action area CancelY Ok #, L vbox P 3 ]q $# - L #tp x 0 # t G za. 8.5 j L us. ; 5, ;$ z X I # vt,.! 2_. GTK t, $9 GDK u GdkPixmap us qb. -? 7 q q. U_,. GdkPixmap *gdk_bitmap_create_from_data( GdkWindow *window, gchar gint *data, width, gint height ) -? 2_ single-plane,,! on/o # 6. width/height., E t y; t, GdkWindow j & ; 3. GdkPixmap* gdk_pixmap_create_from_data( GdkWindow gchar gint gint gint GdkColor *window, *data, width, height, depth, *fg, GdkColor *bg ), sq! depth(_ ) ; :5. fg bg foreground background _. GdkPixmap* gdk_pixmap_create_from_xpm( GdkWindow *window, GdkBitmap **mask, GdkColor *transparent_color, const gchar *filename ) XPM j X t q #., G 5L 6 y 7 j q s 2 /. 7 q 7 jy j L qb L,, us K. qe!; < b mask;@a. #"?! transparent color A _ ; 3., C; I 0,. GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window, GdkBitmap **mask, GdkColor gchar *transparent_color, **data) y XPM j t 4 j q ;. qe 7 q q.,.

39 /* XPM */ static const char * xpm_data[] = " ", " c None", ". c # ", "X c #FFFFFFFFFFFF", " ", "... ", ".XXX.X. ", ".XXX.XX. ", ".XXX.XXX. ", ".XXX... ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", "... ", " ", " " void gdk_pixmap_destroy( GdkPixmap *pixmap ) ; qe L Z ; E, gdk pixmap destory -?, s, ^ f. s qb. ; 8,, GTK widget v. GDK j t widget qb., t 3. GtkWidget* gtk_pixmap_new( GdkPixmap *pixmap, GdkBitmap *mask ) Z widget Y. guint gtk_pixmap_get_type( void ) void gtk_pixmap_set( GtkPixmap *pixmap, GdkPixmap GdkBitmap *val, *mask) void gtk_pixmap_get( GtkPixmap *pixmap, GdkPixmap **val, GdkBitmap **mask) gtk pixmap set widget & L. val GDK q. C # K O C. #include <gtk/gtk.h> /* Open-File static const char * xpm_data[] = " ", " c None", XPM */

40 ". c # ", "X c #FFFFFFFFFFFF", " ", "... ", ".XXX.X. ", ".XXX.XX. ", ".XXX.XXX. ", ".XXX... ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", ".XXXXXXX. ", "... ", " ", " " /* (delete_event ). */ void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) gtk_main_quit() /*. */ void button_clicked( GtkWidget *widget, gpointer data ) printf( "button clicked\n" ) int main( int argc, char *argv[] ) /* GtkWidget widget GtkWidget *window, *pixmapwid, *button GdkPixmap *pixmap GdkBitmap *mask GtkStyle *style /* main, *. */ gtk_init( &argc, &argv ). */ delete_event window = gtk_window_new( GTK_WINDOW_TOPLEVEL ) gtk_signal_connect( GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (close_application), NULL ) gtk_container_border_width( GTK_CONTAINER (window), 10 ) gtk_widget_show( window ) /* gdk. */ style = gtk_widget_get_style( window ) pixmap = gdk_pixmap_create_from_xpm_d( window->window, /* pixmap widget. */ &style->bg[gtk_state_normal], (gchar **)xpm_data ) &mask,

41 pixmapwid = gtk_pixmap_new( pixmap, mask ) gtk_widget_show( pixmapwid ) /* pixmap widget. */ button = gtk_button_new() gtk_container_add( GTK_CONTAINER(button), pixmapwid ) gtk_container_add( GTK_CONTAINER(window), button ) gtk_widget_show( button ) gtk_signal_connect( GTK_OBJECT(button), "clicked", /*. */ gtk_main () GTK_SIGNAL_FUNC(button_clicked), NULL ) return 0 & % icon0.xpm XPM 7 t, qb. /*. */ pixmap = gdk_pixmap_create_from_xpm( window->window, &mask, pixmapwid = gtk_pixmap_new( pixmap, mask ) gtk_widget_show( pixmapwid ) &style->bg[gtk_state_normal], "./icon0.xpm" ) gtk_container_add( GTK_CONTAINER(window), pixmapwid ) : > # y [G? \ P,. Y q t I X?j ; L. qqe 3 W t, #?j ; L q. 3 t "A?j :. "A?j : & E <,. E y ; _ L 8, 3 I q M EG P B M. C t y u. /* wheelbarrow.c */ #include <gtk/gtk.h> /* XPM */ static char * WheelbarrowFull_xpm[] = " ", " c None", ". c #DF7DCF3CC71B", "X c #965875D669A6", "o c #71C671C671C6", "O c #A699A289A699", "+ c # ", "@ c #8E C2", "# c #D75C7DF769A6", "$ c #F7DECF3CC71B", "% c #96588A288E38", "& c #A E79", "* c #8E E38",

42 "= c # ", "- c # ", " c #C71B30C230C2", ": c #C71B9A699658", "> c # ", ", c #20811C712081", "< c # ", "1 c # ", "2 c #DF7D4D344103", "3 c #79E769A671C6", "4 c # ", "5 c #41033CF34103", "6 c # ", "7 c #49241C711040", "8 c # ", "9 c # ", "0 c #69A ", "q c #B6DA71C65144", "w c #410330C238E3", "e c #CF3CBAEAB6DA", "r c #71C C2", "t c #EFBEDB6CD75C", "y c #28A ", "u c # ", "i c #596528A21861", "p c #71C ", "a c #A ", "s c #30C228A230C2", "d c #BEFBA289AEBA", "f c # ", "g c #30C230C230C2", "h c #8E ", "j c # ", "k c #38E30C300820", "l c #30C A2", "z c #38E328A238E3", "x c #514438E34924", "c c # ", "v c #30C C2", "b c #38E328A230C2", "n c #28A228A228A2", "m c #41032CB228A2", "M c # ", "N c #492438E34103", "B c #28A A2", "V c #A E3", "C c #30C21C711040", "Z c #30C ", "A c # ", "S c #618534D32081", "D c #38E31C711040", "F c # ", " ", ".XoO ", " +@#$%o& ",

43 " *=- #::o+ ", " >,<12#:34 ", " 45671#:X3 ", " +89<02qwo ", "e* >,67 ro ", "ty> ", "$2u+ ><ipas8* ", "%$ =* *3:.Xa.dfg> ", "Oh$ ya *3d.a8j,Xe.d3g8+ ", " Oh$ ka *3d$a8lz,,xxc:.e3g54 ", " Oh$ ko *pd$%svbzz,sxxxxfx..&wn> ", " *3dthwlsslszjzxxxxxxx3:td8M4 ", " *3d$XNlvvvlllm,mNwxxxxxxxfa.:,B* ", " ", " Oh$1hd5lllslllCCZrV#r#:#2AxxxxxxxxxcdwM* ", " OXq6c.%8vvvllZZiqqApA:mq:Xxcpcxxxxxfdc9* ", " ", " " +A26jguXtAZZZC7iDiCCrVVii7Cmmmxxxxxx%3g", " *#16jszN..3DZZZZrCVSA2rZrV7Dmmwxxxx&en", " p2yfvzssxe:fczzciid7iizdidsszwwxx8e*>", " OA1<jzxwwc:$d%NDZZZZCCCZCCZZCmxxfd.B ", " 3206Bwxxszx%et.eaAp77m77mmmf3&eeeg* ", ", " * 16=lsNwwNwgsvslbwwvccc3pcfu<o ", " p <69BvwwsszslllbBlllllllu<5+ ", " OS0y6FBlvvvzvzss,u=Blllj=54 ", " c1-699blvlllllu7k96mmmg4 ", " *10y8n6FjvllllB< ", " S-kg+>666<M<996-y6n<8* ", " p71=4 m69996kd8z-66698&& ", " &i0ycm6n4 ogk17,0<6666g ", " N-k-<> >=01-kuu666> ", ",6ky& &46-10ul,66, ", " Ou0<> o66y<ulw<66& ", " *kk5 >66By7=xu664 ", " <<M4 466lj<Mxu66o ", " *>> +66uv,zN666* ", " 566,xxj669 ", " 4666FF666> ", " >966666M ", " om6668+ ", " *4 ", " ", " " /* (delete_event ). */ void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) gtk_main_quit() int main (int argc, char *argv[]) GtkWidget *window, *pixmap, *fixed

44 GdkPixmap *gdk_pixmap GdkBitmap *mask GtkStyle *style GdkGC *gc /* main, delete_event *. main popup *. */ gtk_init (&argc, &argv) window = gtk_window_new( GTK_WINDOW_POPUP ) gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (close_application), NULL) gtk_widget_show (window) /* pixmap widget. */ style = gtk_widget_get_default_style() gc = style->black_gc gdk_pixmap = gdk_pixmap_create_from_xpm_d( window->window, &mask, &style->bg[gtk_state_normal], WheelbarrowFull_xpm ) pixmap = gtk_pixmap_new( gdk_pixmap, mask ) gtk_widget_show( pixmap ) /*, *. */ fixed = gtk_fixed_new() gtk_widget_set_usize( fixed, 200, 200 ) gtk_fixed_put( GTK_FIXED(fixed), pixmap, 0, 0 ) gtk_container_add( GTK_CONTAINER(window), fixed ) gtk_widget_show( fixed ) /* fixed widget. */ gtk_widget_shape_combine_mask( window, mask, 0, 0 ) /*. */ gtk_widget_set_uposition( window, 20, 400 ) gtk_widget_show( window ) gtk_main () return 0 y 3, #! G qe qv. = v # P : q # u. gtk_widget_set_events( window, gtk_widget_get_events( window ) GDK_BUTTON_PRESS_MASK ) gtk_signal_connect( GTK_OBJECT(window), "button_press_event", GTK_SIGNAL_FUNC(close_application), NULL )

45 8.6 (ruler) widget sq t j X ; 5. k ; e m ; ;. S X v (indicator); j A X u. y $9 qkb. e t q. GtkWidget *gtk_hruler_new(void) /* */ GtkWidget *gtk_vruler_new(void) /* */ ; q 8 QA A. QA GTK PIXELS# GTK INCHES, GTK CENTIMETERS #;. void gtk_ruler_set_metric( GtkRuler *ruler, GtkMetricType metric ) za GTK PIXELS. gtk_ruler_set_metric( GTK_RULER(ruler), GTK_PIXELS ) Z " qn3 # 4 = >Y v ; q% n= void gtk_ruler_set_range (GtkRuler *ruler, gfloat gfloat gfloat gfloat lower, upper, position, max_size) lower upper A L max size ; ;$ za. Position 4 v # X gtk_ruler_set_range( GTK_RULER(vruler), 0, 800, 0, 800) v (marking);, Y. gtk_ruler_set_range( GTK_RULER(vruler), 7, 16, 0, 20) v j \ : X ; S X v. ; j 0 3 L 8 motion notify event G motion notify event qb. "A 4? 0 3 Y. #define EVENT_METHOD(i, x) GTK_WIDGET_CLASS(GTK_OBJECT(i)->klass)->x gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event", (GtkSignalFunc)EVENT_METHOD(ruler, motion_notify_event), GTK_OBJECT(ruler) )

46 C e ; drawing area. drawing area 600 ky 400 m ;. e v L ; 100 v. Y drawing area X za P. /* rulers.c */ #include <gtk/gtk.h> #define EVENT_METHOD(i, x) GTK_WIDGET_CLASS(GTK_OBJECT(i)->klass)->x #define XSIZE 600 #define YSIZE 400 /* (close button). */ void close_application( GtkWidget *widget, gpointer data ) gtk_main_quit() /* */ int main( int argc, char *argv[] ) GtkWidget *window, *table, *area, *hrule, *vrule /* gtk.*/ gtk_init( &argc, &argv ) window = gtk_window_new( GTK_WINDOW_TOPLEVEL ) gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC( close_application ), NULL) gtk_container_border_width (GTK_CONTAINER (window), 10) /* drawing area table = gtk_table_new( 3, 2, FALSE ) */ gtk_container_add( GTK_CONTAINER(window), table ) area = gtk_drawing_area_new() gtk_drawing_area_size( (GtkDrawingArea *)area, XSIZE, YSIZE ) gtk_table_attach( GTK_TABLE(table), area, 1, 2, 1, 2, GTK_EXPAND GTK_FILL, GTK_FILL, 0, 0 ) gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK GDK_POINTER_MOTION_HINT_MASK ) /*. drawing area, motion_notify_event. */ hrule = gtk_hruler_new() gtk_ruler_set_metric( GTK_RULER(hrule), GTK_PIXELS ) gtk_ruler_set_range( GTK_RULER(hrule), 7, 13, 0, 20 ) gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event", (GtkSignalFunc)EVENT_METHOD(hrule, motion_notify_event), GTK_OBJECT(hrule) ) /* GTK_WIDGET_CLASS(GTK_OBJECT(hrule)->klass)->motion_notify_event, */ gtk_table_attach( GTK_TABLE(table), hrule, 1, 2, 0, 1,

47 GTK_EXPAND GTK_SHRINK GTK_FILL, GTK_FILL, 0, 0 ) /*. drawing area,, motion_notify_event. */ vrule = gtk_vruler_new() gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS ) gtk_ruler_set_range( GTK_RULER(vrule), 0, YSIZE, 10, YSIZE ) gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event", (GtkSignalFunc) GTK_WIDGET_CLASS(GTK_OBJECT(vrule)->klass)->motion_notify_event, GTK_OBJECT(vrule) ) gtk_table_attach( GTK_TABLE(table), vrule, 0, 1, 1, 2, GTK_FILL, GTK_EXPAND GTK_SHRINK GTK_FILL, 0, 0 ) /* */ gtk_widget_show( area ) gtk_widget_show( hrule ) gtk_widget_show( vrule ) gtk_widget_show( table ) gtk_widget_show( window ) gtk_main() return \ v v(statusbar) \ v v! - s 5 widget. widget! - [. 0 t & s3. q - v \ v v P b E, \ v v widget 'P ' u 5 Context Identier. qe context ;P = \ [ C - ;. - Context Identier t; I # q, $9 # t. \ v v ; q. GtkWidget* gtk_statusbar_new (void) ^ Context Identier context [ z<y u. guint gtk_statusbar_get_context_id (GtkStatusbar *statusbar, const gchar *context_description) \ v v Y. guint gtk_statusbar_push (GtkStatusbar *statusbar, guint context_id, gchar *text) void gtk_statusbar_pop (GtkStatusbar *statusbar) guint context_id) void gtk_statusbar_remove (GtkStatusbar *statusbar,

48 guint guint context_id, message_id) $9 gtk statusbar push \ v v ^ - 8; 5. # gtk statusbar remove 5 Message Identier. gtk statusbar remove s q Message Context Identier - \ v v t C$. gtk statusbar pop sq Context Identier C - 4 QC. C # 2 \ v v #. # # \ v v ^ - OL #" # Oq - C$. /* statusbar.c */ #include <gtk/gtk.h> #include <glib.h> GtkWidget *status_bar void push_item (GtkWidget *widget, gpointer data) static int count = 1 char buff[20] g_snprintf(buff, 20, "Item %d", count++) gtk_statusbar_push( GTK_STATUSBAR(status_bar), (guint) &data, buff) return void pop_item (GtkWidget *widget, gpointer data) gtk_statusbar_pop( GTK_STATUSBAR(status_bar), (guint) &data ) return int main (int argc, char *argv[]) GtkWidget *window GtkWidget *vbox GtkWidget *button int context_id gtk_init (&argc, &argv) /* */ window = gtk_window_new(gtk_window_toplevel) gtk_widget_set_usize( GTK_WIDGET (window), 200, 100) gtk_window_set_title(gtk_window (window), "GTK Statusbar Example") gtk_signal_connect(gtk_object (window), "delete_event", (GtkSignalFunc) gtk_exit, NULL) vbox = gtk_vbox_new(false, 1) gtk_container_add(gtk_container(window), vbox)

Container Widgets and Packing

Container Widgets and Packing Container Widgets and Packing As mentioned in Chapter 2, there are two kinds of containers, those that can hold no more than one child widget, and those that can hold more than one. Containers that can

More information

EE495K Slides by Avi Kak: OO for GUI Design (contd.)

EE495K Slides by Avi Kak: OO for GUI Design (contd.) EE495K Slides by Avi Kak: OO for GUI Design (contd.) 1 Date: Tue, 18 Feb 2003 09:42:33 CST To: kak@ecn.purdue.edu From: Newton Matthew-W18732 Subject: RE: Visit to Purdue! Return-Path:

More information

Lecture 3. GUI Programming part 1: GTK

Lecture 3. GUI Programming part 1: GTK INTRODUCTION TO DESIGN AUTOMATION Lecture 3. GUI Programming part 1: GTK Guoyong Shi, PhD shiguoyong@ic.sjtu.edu.cn School of Microelectronics Shanghai Jiao Tong University Fall 2010 2010-9-15 Slide 1

More information

Lesson 2: GTK+ Basics

Lesson 2: GTK+ Basics 1 A First GTK+ Program We will begin with a very simple GTK+ program in order to demonstrate some of the key tasks that every GTK+ main program must perform. The program, hello_world.c, is found in many

More information

GTK+ FAQ. Tony Gale Shawn Amundson Emmanuel Deloget

GTK+ FAQ. Tony Gale Shawn Amundson Emmanuel Deloget GTK+ FAQ Tony Gale Shawn Amundson Emmanuel Deloget GTK+ FAQ by Tony Gale, Shawn Amundson, and Emmanuel Deloget This document is intended to answer questions that are likely to be frequently asked by programmers

More information

OO for GUI Design (contd.) Questions:

OO for GUI Design (contd.) Questions: OO for GUI Design (contd.) Questions: 1 1. What is a window manager and what are its responsibilities? 2 2. How would you define an event in the context of GUI programming? 3 3. What is the first thing

More information

The FFI Reference Manual

The FFI Reference Manual The FFI Reference Manual a Foreign Function Interface (version 0.2) for MIT/GNU Scheme version 9.0.1 2011-09-19 by Matt Birkholz This manual documents FFI 0.2. Copyright c 1986, 1987, 1988, 1989, 1990,

More information

Programming with Clutter. Murray Cumming

Programming with Clutter. Murray Cumming Programming with Clutter Murray Cumming Programming with Clutter by Murray Cumming Copyright 2007, 2008 Openismus GmbH We very much appreciate any reports of inaccuracies or other errors in this document.

More information

for more please visit :

for more please visit : articlopedia.gigcities.com for more please visit : http://articlopedia.gigcities.com file:///d /important.html9/13/2006 8:50:19 PM Revisited: Building Cross Platform GUI Apps With PHP GTK PHP is not just

More information

Creating GNOME Applications with Glade. Part I: Introduction

Creating GNOME Applications with Glade. Part I: Introduction Creating GNOME Applications with Glade Part I: Introduction Glade 3 Glade 3 is a tool to enable quick and easy development of Uis for the GTK+ toolkit and GNOME desktop environment. User interfaces designed

More information

C SCI The X Window System Stewart Weiss

C SCI The X Window System Stewart Weiss The X Window System The X Window System is a networking and display protocol which provides windowing on bitmapped displays. X provides the basic framework for building GUI environments, such as drawing

More information

Maemo Diablo Reference Manual for maemo 4.1. Application Development

Maemo Diablo Reference Manual for maemo 4.1. Application Development Maemo Diablo Reference Manual for maemo 4.1 Application Development December 22, 2008 Contents 1 Application Development 3 1.1 Introduction.............................. 3 1.2 Typical Maemo GUI Application..................

More information

Find it faster at

Find it faster at Index Symbols # (comments), using with RC files, 326 & (ampersand), using with PHP-GTK applications, 23 * (asterisk) wildcard, using with style rules, 322 _ (underscore), using with mnemonics, 131 A -a

More information

EE495K Slides by Avi Kak: OO for GUI Design (contd.) Questions:

EE495K Slides by Avi Kak: OO for GUI Design (contd.) Questions: EE495K Slides by Avi Kak: OO for GUI Design (contd.) Questions: 1 1. What are the two features of every GUI program in Qt? 2 2. How are the parent-child connections established in the containment hierarchy

More information

Drawing in GTK+ Background. Windows and Clipping. CSci Graphical User Interface Programming Drawing in GTK+ Prof.

Drawing in GTK+ Background. Windows and Clipping. CSci Graphical User Interface Programming Drawing in GTK+ Prof. Background In order to understand how to draw in GTK, you rst have to understand something about how GTK draws widgets, because how GTK draws widgets has an important role in how you design your drawing

More information

Reference Manual for SLgtk Version Michael S. Noble, Jul 21, 2010

Reference Manual for SLgtk Version Michael S. Noble, Jul 21, 2010 Reference Manual for SLgtk Version 0.7.6 Michael S. Noble, mnoble@space.mit.edu Jul 21, 2010 ii Preface SLgtk is a software package which provides Gtk bindings for the S-Lang scripting language. Copyright

More information

COMP 2400 UNIX Tools

COMP 2400 UNIX Tools COMP 2400 UNIX Tools Christian Grothoff christian@grothoff.org http://grothoff.org/christian/ 1 GTK+ GTK+ = Gimp Tool Kit, Manipulation Program GIMP = GNU Image Basis for Gnome Written in C, bindings for

More information

C Libraries. Using GLib. Ph. D. Eng. Lucjan Miękina upel.agh.edu.pl/wimir/login/ Department of Robotics and Mechatronics 1/31

C Libraries. Using GLib. Ph. D. Eng. Lucjan Miękina upel.agh.edu.pl/wimir/login/ Department of Robotics and Mechatronics 1/31 1/31 C Libraries Using GLib Ph. D. Eng. Lucjan Miękina upel.agh.edu.pl/wimir/login/ Department of Robotics and Mechatronics January 10, 2017 2/31 Programming in C External libraries - GLib If you re writing

More information

Gjs/GTK+ 3 Tutorial Documentation

Gjs/GTK+ 3 Tutorial Documentation Gjs/GTK+ 3 Tutorial Documentation Release 0 Christian Bjartli Aug 28, 2017 Contents: 1 Installation 3 2 Getting Started 5 2.1 Simple Example............................................. 5 2.2 Extended

More information

Open source MySQL Browser for Open Innovation

Open source MySQL Browser for Open Innovation Open source MySQL Browser for Open Innovation Lecturer Radu Bucea-Manea-Tonis, PhD 1 1 mysqlbrowser.codeplex.com Abstract. Our purpose is to cross-compile MySQL driver source code for Linux on Windows

More information

EE495K Slides by Avi Kak: OO for GUI Design (second lecture) Questions:

EE495K Slides by Avi Kak: OO for GUI Design (second lecture) Questions: EE495K Slides by Avi Kak: OO for GUI Design (second lecture) Questions: 1 1. Much of the history of modern GUI programming can be traced back to X. What is X and what was it mainly intended for? 2 2. What

More information

Cake: a tool for adaptation of object code

Cake: a tool for adaptation of object code Cake: a tool for adaptation of object code Stephen Kell Stephen.Kell@cl.cam.ac.uk Computer Laboratory University of Cambridge Cake... p.1/32 Some familiar problems Software is expensive to develop expensive

More information

Automatically generated type-safe GTK+ binding for Dylan

Automatically generated type-safe GTK+ binding for Dylan Automatically generated type-safe GTK+ binding for Dylan Hannes Mehnert hannes@mehnert.org Dylan Hackers ABSTRACT We present an automated way to get language bindings for GTK+ for Dylan [2], an object-oriented

More information

INFORMATION SOCIETY TECHNOLOGIES (IST) PROGRAMME. Project IST MoWGLI. Report n. D4.a MathML Rendering/Browsing Engine

INFORMATION SOCIETY TECHNOLOGIES (IST) PROGRAMME. Project IST MoWGLI. Report n. D4.a MathML Rendering/Browsing Engine INFORMATION SOCIETY TECHNOLOGIES (IST) PROGRAMME Project IST-2001-33562 MoWGLI Report n. D4.a MathML Rendering/Browsing Engine Main Authors: H. Naciri, L. Padovani Project Acronym: MoWGLI Project full

More information

Maemo Diablo Source code for the LibOSSO RPC examples Training Material

Maemo Diablo Source code for the LibOSSO RPC examples Training Material Maemo Diablo Source code for the LibOSSO RPC examples Training Material February 9, 2009 Contents 1 Source code for the LibOSSO RPC examples 2 1.1 libosso-example-sync/libosso-rpc-sync.c..............

More information

Package RGtk2. R topics documented: August 29, Version Title R bindings for Gtk and above

Package RGtk2. R topics documented: August 29, Version Title R bindings for Gtk and above Package RGtk2 August 29, 2013 Version 2.20.25 Title R bindings for Gtk 2.8.0 and above Author Michael Lawrence and Duncan Temple Lang Depends R (>= 2.5.0)

More information

UNIVERSITÀ DEGLI STUDI DI MILANO Facoltà di Scienze Matematiche, Fisiche e Naturali Dipartimento di Scienze della Terra ALLEGATI ALLA TESI DI LAUREA

UNIVERSITÀ DEGLI STUDI DI MILANO Facoltà di Scienze Matematiche, Fisiche e Naturali Dipartimento di Scienze della Terra ALLEGATI ALLA TESI DI LAUREA UNIVERSITÀ DEGLI STUDI DI MILANO Facoltà di Scienze Matematiche, Fisiche e Naturali Dipartimento di Scienze della Terra ALLEGATI ALLA TESI DI LAUREA CODICI Relatore: Prof. Alberto Luigi Marcellini Correlatore:

More information

use lib "cygdrive/c/cygwin/usr/usr/lib/perl5/vendor_perl/5.10/i686-cygwin/gtk2.pm";

use lib cygdrive/c/cygwin/usr/usr/lib/perl5/vendor_perl/5.10/i686-cygwin/gtk2.pm; PERL Layout Module #!/usr/bin/perl print 'Hello world!"; exit; package Layout; use warnings; use Carp; use lib "cygdrive/c/cygwin/usr/usr/lib/perl5/vendor_perl/5.10/i686-cygwin/gtk2.pm"; use Glib qw/true

More information

Object-Oriented Programming

Object-Oriented Programming iuliana@cs.ubbcluj.ro Babes-Bolyai University 2018 1 / 33 Overview 1 2 3 4 5 6 2 / 33 I Qt is a cross-platform application and UI framework in C++. Using Qt, one can write GUI applications once and deploy

More information

CD _. _. 'p ~~M CD, CD~~~~V. C ~'* Co ~~~~~~~~~~~~- CD / X. pd.0 & CD. On 0 CDC _ C _- CD C P O ttic 2 _. OCt CD CD (IQ. q"3. 3 > n)1t.

CD _. _. 'p ~~M CD, CD~~~~V. C ~'* Co ~~~~~~~~~~~~- CD / X. pd.0 & CD. On 0 CDC _ C _- CD C P O ttic 2 _. OCt CD CD (IQ. q3. 3 > n)1t. n 5 L n q"3 +, / X g ( E 4 11 " ') $ n 4 ) w Z$ > _ X ~'* ) i 1 _ /3 L 2 _ L 4 : 5 n W 9 U~~~~~~ 5 T f V ~~~~~~~~~~~~ (Q ' ~~M 3 > n)1 % ~~~~V v,~~ _ + d V)m X LA) z~~11 4 _ N cc ', f 'd 4 5 L L " V +,

More information

PRINCIPLES OF OPERATING SYSTEMS

PRINCIPLES OF OPERATING SYSTEMS PRINCIPLES OF OPERATING SYSTEMS Tutorial-1&2: C Review CPSC 457, Spring 2015 May 20-21, 2015 Department of Computer Science, University of Calgary Connecting to your VM Open a terminal (in your linux machine)

More information

Location Based Authentication

Location Based Authentication University of New Orleans ScholarWorks@UNO University of New Orleans Theses and Dissertations Dissertations and Theses 5-20-2005 Location Based Authentication Seema Sharma University of New Orleans Follow

More information

Guile-GNOME: Atk. version , updated 9 December Bill Haneman Marc Mulcahy Padraig O Briain

Guile-GNOME: Atk. version , updated 9 December Bill Haneman Marc Mulcahy Padraig O Briain Guile-GNOME: Atk version 2.16.2, updated 9 December 2011 Bill Haneman Marc Mulcahy Padraig O Briain This manual is for (gnome atk) (version 2.16.2, updated 9 December 2011) Copyright 2001-2007 Bill Haneman,

More information

Beginner s Guide to scintilla: Syntax Highlighting & Code Folding for var aq. Andreas Tscharner

Beginner s Guide to scintilla: Syntax Highlighting & Code Folding for var aq. Andreas Tscharner Beginner s Guide to scintilla: Syntax Highlighting & Code Folding for var aq Andreas Tscharner April 18, 2014 Abstract Syntax Highlighting and Code Folding in Scintilla explained by the Klingon scripting

More information

Background Information About GTK+ and Related Libraries

Background Information About GTK+ and Related Libraries Background Information About GTK+ and Related Libraries The X Window System The X Window System is a networking and display protocol which provides windowing on bitmapped displays. X provides the basic

More information

CS , Spring 2002 Exam 2

CS , Spring 2002 Exam 2 Full Name: CS 15-213, Spring 2002 Exam 2 March 28, 2002 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write your answers

More information

Quick Reference Card Business Objects Toolbar Design Mode

Quick Reference Card Business Objects Toolbar Design Mode Icon Description Open in a new window Pin/Unpin this tab Close this tab File Toolbar New create a new document Open Open a document Select a Folder Select a Document Select Open Save Click the button to

More information

Core object model EO / EFL++

Core object model EO / EFL++ Core object model EO / EFL++ Carsten Haitzler Samsung Electronics Principal Engineer Enlightenment/EFL Founder c.haitzler@samsung.com EFL + Elementary 2 A toolkit somwhere between GTK+ and Qt in breadth

More information

CS 3113 Introduction to Operating Systems Midterm October 11, 2018

CS 3113 Introduction to Operating Systems Midterm October 11, 2018 General instructions: CS 3113 Introduction to Operating Systems Midterm October 11, 2018 Please wait to open this exam booklet until you are told to do so. This examination booklet has 10 pages. You also

More information

CS 3113 Introduction to Operating Systems Midterm October 11, 2018

CS 3113 Introduction to Operating Systems Midterm October 11, 2018 General instructions: CS 3113 Introduction to Operating Systems Midterm October 11, 2018 Please wait to open this exam booklet until you are told to do so. This examination booklet has 10 pages. You also

More information

Linux based 3G Multimedia Mobile-phone API Specification

Linux based 3G Multimedia Mobile-phone API Specification Linux based 3G Multimedia Mobile-phone API Specification [AP Framework] Draft 1.0 NEC Corporation Panasonic Mobile Communication Ltd. 1 Contents Preface...4 1. MSB...5 1.1Generating an Object...5 1.2 Destroying

More information

Notes on creating graphical output using X-11 graphics. Ubuntu Virtual Machine

Notes on creating graphical output using X-11 graphics. Ubuntu Virtual Machine Notes on creating graphical output using X-11 graphics Ubuntu Virtual Machine B. Wilkinson, Sept 4, 2014 Assignments and projects may require graphical output, which is especially relevant for problems

More information

Introduction to Lablgtk (from its internals) Adrien Nader - OCaml Users in PariS 1/34

Introduction to Lablgtk (from its internals) Adrien Nader - OCaml Users in PariS 1/34 Introduction to Lablgtk (from its internals) Adrien Nader - OCaml Users in PariS 1/34 Table Of Contents 1 Introduction 2 3 4 5 2/34 What is GTK+ Graphical toolkit available on many platforms C code with

More information

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems Programs CSCI 4061 Introduction to Operating Systems C Program Structure Libraries and header files Compiling and building programs Executing and debugging Instructor: Abhishek Chandra Assume familiarity

More information

ICS Tutorials: Basic Operations

ICS Tutorials: Basic Operations ICS Tutorials: Basic Operations This tutorial introduces the basic components of Builder Xcessory. For more detailed information, see the Builder Xcessory Reference Manual. This book is directly accessible

More information

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco CS 326 Operating Systems C Programming Greg Benson Department of Computer Science University of San Francisco Why C? Fast (good optimizing compilers) Not too high-level (Java, Python, Lisp) Not too low-level

More information

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0)

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0) CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0) Class Teacher: Pralay Mitra Department of Computer Science and Engineering Indian Institute of Technology Kharagpur A complete C program

More information

Localizing GTK+ Theppitak Karoonboonyanan January 2004

Localizing GTK+ Theppitak Karoonboonyanan January 2004 Localizing GTK+ Theppitak Karoonboonyanan thep@linux.thai.net January 2004 Abstract This paper summarizes information gathered by the author during contributing to Pango and GTK+ projects and developing

More information

CSE 124 Discussion (10/3) C/C++ Basics

CSE 124 Discussion (10/3) C/C++ Basics CSE 124 Discussion (10/3) C/C++ Basics Topics - main() function - Compiling with gcc/makefile - Primitives - Structs/Enums - Function calls/loops - C++ Classes/stdtl - Pointers/Arrays - Memory allocation/freeing

More information

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Adapted from the slides Revisões sobre Programação em C, Sérgio Crisóstomo Compilation #include int main()

More information

Layout and display. STILOG IST, all rights reserved

Layout and display. STILOG IST, all rights reserved 2 Table of Contents I. Main Window... 1 1. DEFINITION... 1 2. LIST OF WINDOW ELEMENTS... 1 Quick Access Bar... 1 Menu Bar... 1 Windows... 2 Status bar... 2 Pop-up menu... 4 II. Menu Bar... 5 1. DEFINITION...

More information

Guile-GNOME: Atk. version , updated 2 September Bill Haneman Marc Mulcahy Padraig O Briain

Guile-GNOME: Atk. version , updated 2 September Bill Haneman Marc Mulcahy Padraig O Briain Guile-GNOME: Atk version 2.15.93, updated 2 September 2007 Bill Haneman Marc Mulcahy Padraig O Briain This manual is for (gnome atk) (version 2.15.93, updated 2 September 2007) Copyright 2001-2007 Bill

More information

Introduction: Before start doing any code, there is some terms that one should be familiar with:

Introduction: Before start doing any code, there is some terms that one should be familiar with: Introduction: D-Bus is a message bus system, a simple way for applications to talk to one another, D-Bus supplies a system and a session daemons. The system daemon is launched at the system startup level

More information

Computer Labs: Lab 5 & Sprites

Computer Labs: Lab 5 & Sprites Computer Labs: Lab 5 & Sprites 2 o MIEIC Pedro F. Souto (pfs@fe.up.pt) November 17, 2017 Lab5: Video Card in Graphics Mode - 2nd Lab Class Write a set of functions (tentative): int video_test_xpm(char

More information

CMPT 300. Operating Systems. Brief Intro to UNIX and C

CMPT 300. Operating Systems. Brief Intro to UNIX and C CMPT 300 Operating Systems Brief Intro to UNIX and C Outline Welcome Review Questions UNIX basics and Vi editor Using SSH to remote access Lab2(4214) Compiling a C Program Makefile Basic C/C++ programming

More information

Lecture 03 Bits, Bytes and Data Types

Lecture 03 Bits, Bytes and Data Types Lecture 03 Bits, Bytes and Data Types Computer Languages A computer language is a language that is used to communicate with a machine. Like all languages, computer languages have syntax (form) and semantics

More information

Adding Dynamics. Introduction

Adding Dynamics. Introduction M-Graphic s User s Manual 11-1 Chapter 11 Adding Dynamics Introduction This chapter explains how to make single or multiple dynamic connections from display objects to points from OPC data servers. This

More information

Table Basics. The structure of an table

Table Basics. The structure of an table TABLE -FRAMESET Table Basics A table is a grid of rows and columns that intersect to form cells. Two different types of cells exist: Table cell that contains data, is created with the A cell that

More information

Dynamic memory allocation

Dynamic memory allocation Dynamic memory allocation outline Memory allocation functions Array allocation Matrix allocation Examples Memory allocation functions (#include ) malloc() Allocates a specified number of bytes

More information

Final Exam. Fall Semester 2016 KAIST EE209 Programming Structures for Electrical Engineering. Name: Student ID:

Final Exam. Fall Semester 2016 KAIST EE209 Programming Structures for Electrical Engineering. Name: Student ID: Fall Semester 2016 KAIST EE209 Programming Structures for Electrical Engineering Final Exam Name: This exam is open book and notes. Read the questions carefully and focus your answers on what has been

More information

Guile-GNOME: Libgnomecanvas

Guile-GNOME: Libgnomecanvas Guile-GNOME: Libgnomecanvas version 2.16.2, updated 9 December 2011 Federico Mena Quintero Raph Levien and others This manual is for (gnome libgnomecanvas) (version 2.16.2, updated 9 December 2011) Copyright

More information

Answer all questions. Write your answers only in the space provided. Full marks = 50

Answer all questions. Write your answers only in the space provided. Full marks = 50 Answer all questions. Write your answers only in the space provided. Full marks = 50 1. Answer the following: [2+3+2+1=8 marks] a) What are the minimum and maximum numbers that can be represented in 10-bit

More information

Week 2 Intro to the Shell with Fork, Exec, Wait. Sarah Diesburg Operating Systems CS 3430

Week 2 Intro to the Shell with Fork, Exec, Wait. Sarah Diesburg Operating Systems CS 3430 Week 2 Intro to the Shell with Fork, Exec, Wait Sarah Diesburg Operating Systems CS 3430 1 Why is the Shell Important? Shells provide us with a way to interact with the core system Executes programs on

More information

Rick Duley Perth, Western Australia 2009

Rick Duley Perth, Western Australia 2009 Rick Duley Perth, Western Australia 2009 Table of Contents 1 Preamble... 1 2 Introduction... 1 2.1 Why Verbose Code?... 1 2.2 On Being Methodical... 2 3 Getting GtkAda... 2 3.1 Glade... 2 3.2 GtkAda Documentation...

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

Graphics Graphics in the X Window System Frame Buffers

Graphics Graphics in the X Window System Frame Buffers 10 Graphics Graphics in GNOME inhabit the full gamut of libraries, from native X to the GNOME libraries, following a steady progression from raw and hard to use, to abstract and easy to use. Xlib offers

More information

How to learn C? CSCI [4 6]730: A C Refresher or Introduction. Diving In: A Simple C Program 1-hello-word.c

How to learn C? CSCI [4 6]730: A C Refresher or Introduction. Diving In: A Simple C Program 1-hello-word.c How to learn C? CSCI [4 6]730: A C Refresher or Introduction Hello Word! ~/ctutorial/ In addition to syntax you need to learn: the Tools. the Libraries. And the Documentation (how to access) Practice on

More information

ngaio.)' Thif. as you ore doubtless aware U the

ngaio.)' Thif. as you ore doubtless aware U the c G c2 VV VV $60 c V X G Y Y 4 4 2 G F cg V c / g q c c c g c c c g c c g c c c cg VY gc c //Y 0 G!«> ] gc g 25 c Y g) g! c cg c c X c c 5 Y g g F g F g F «g c 3 x «(c X c! c c c g F VG ) g < c c c c g

More information

VD Interfaces V0.1. Draft 2

VD Interfaces V0.1. Draft 2 VD Interfaces V0.1 Draft 2 Copyright 2009 Red Hat, Inc. Licensed under a Creative Commons Attribution-Share Alike 3.0 United States License (see http://creativecommons.org/licenses/by-sa/3.0/us/legalcode).

More information

Using Adobe Contribute 4 A guide for new website authors

Using Adobe Contribute 4 A guide for new website authors Using Adobe Contribute 4 A guide for new website authors Adobe Contribute allows you to easily update websites without any knowledge of HTML. This handout will provide an introduction to Adobe Contribute

More information

Representation of image data

Representation of image data Representation of image data Images (e.g. digital photos) consist of a rectanglular array of discrete picture elements called pixels. An image consisting of 200 pixels rows of 300 pixels per row contains

More information

CS 4300 Computer Graphics

CS 4300 Computer Graphics CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture 8 September 22, 2011 GUIs GUIs in modern operating systems cross-platform GUI frameworks common GUI widgets event-driven programming Model-View-Controller

More information

ADVENTURE_IO Input/Output format and libraries for ADVENTURE modules List of Input/Output Functions February 17, 2006

ADVENTURE_IO Input/Output format and libraries for ADVENTURE modules List of Input/Output Functions February 17, 2006 ADVENTURE_IO Input/Output format and libraries for ADVENTURE modules List of Input/Output Functions February 17, 2006 ADVENTURE Project Contents 1. Open/Close of Adv file... 3 2. Open/Close of AdvDocument...

More information

IC221: Systems Programming 12-Week Written Exam [SOLUTIONS]

IC221: Systems Programming 12-Week Written Exam [SOLUTIONS] IC221: Systems Programming 12-Week Written Exam [SOLUTIONS] April 2, 2014 Answer the questions in the spaces provided on the question sheets. If you run out of room for an answer, continue on the back

More information

Active Extenders MODELS PC/AT150 & PC/AT200. Hot Swap PC/AT Bus Extender Boards. User Manual. Revision 8.1. March 30, 1999.

Active Extenders MODELS PC/AT150 & PC/AT200. Hot Swap PC/AT Bus Extender Boards. User Manual. Revision 8.1. March 30, 1999. Active Extenders MODELS PC/AT150 & PC/AT200 Hot Swap PC/AT Bus Extender Boards User Manual Revision 8.1 March 30, 1999 Catalyst Enterprises, Inc. 1439 Torrington Court San Jose, CA 95120 (408) 268-4145

More information

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.

More information

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor CS 261 Fall 2017 Mike Lam, Professor C Introduction Variables, Memory Model, Pointers, and Debugging The C Language Systems language originally developed for Unix Imperative, compiled language with static

More information

ECE264 Spring 2013 Final Exam, April 30, 2013

ECE264 Spring 2013 Final Exam, April 30, 2013 ECE264 Spring 2013 Final Exam, April 30, 2013 In signing this statement, I hereby certify that the work on this exam is my own and that I have not copied the work of any other student while completing

More information

Forms iq Designer Training

Forms iq Designer Training Forms iq Designer Training Copyright 2008 Feith Systems and Software, Inc. All Rights Reserved. No part of this publication may be reproduced, transmitted, stored in a retrieval system, or translated into

More information

Programming Training. This Week: Tkinter for GUI Interfaces. Some examples

Programming Training. This Week: Tkinter for GUI Interfaces. Some examples Programming Training This Week: Tkinter for GUI Interfaces Some examples Tkinter Overview Set of widgets designed by John K. Ousterhout, 1987 Tkinter == Tool Kit Interface Mean to be driven by Tcl (Toolkit

More information

1 PartA. Lab#1 Solutions: COMP 3000A(Operating Systems) October 9, TheShell. 1.2 Help

1 PartA. Lab#1 Solutions: COMP 3000A(Operating Systems) October 9, TheShell. 1.2 Help Lab#1 Solutions: COMP 3000A(Operating Systems) October 9, 2007 In this lab, we will examine some core programs of the UNIX environment as implemented onthedebiangnu/linux4.0systemsinthelab.theseprogramsprovideawindowintothe

More information

A Comparison between DirectFB and X11 Graphics Library

A Comparison between DirectFB and X11 Graphics Library A Comparison between DirectFB and X11 Graphics Library Sung-Bong Jang 1, Jeong-Mi Kim 2 and Mi-Young Choi 2 1 Department of Industry-Academy Cooperation, Kumoh National Institute of Technology, 730701

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 12: Memory, Files and Bitoperations (pronobis@kth.se) Overview Overview Lecture 12: Memory, Files and Bit operations Wrap Up Main function; reading and writing Bitwise Operations Wrap Up Lecture

More information

Obtained the source code to gcc, one can just follow the instructions given in the INSTALL file for GCC.

Obtained the source code to gcc, one can just follow the instructions given in the INSTALL file for GCC. Building cross compilers Linux as the target platform Obtained the source code to gcc, one can just follow the instructions given in the INSTALL file for GCC. configure --target=i486-linux --host=xxx on

More information

ABOUT SHOES. P. O. HDACtAN, Opp. O.,Ii. * W.DEPOT. N. J.

ABOUT SHOES. P. O. HDACtAN, Opp. O.,Ii. * W.DEPOT. N. J. E Y E EEY FY E 7 882 39 c c x 6 F - 3Y E E E! - - - «-- - - «/ \!! / \- - 5 - c 7 7 6 50 0 00 ( E «0 -«800 0 00 00 2«! 75 495 ) 90 7 00 60 0 60 00 00 00 400 «-- c \ E - -! / «60 2 60 3 60 4 60 5 60 700

More information

CS 261 Fall Mike Lam, Professor. Structs and I/O

CS 261 Fall Mike Lam, Professor. Structs and I/O CS 261 Fall 2018 Mike Lam, Professor Structs and I/O Typedefs A typedef is a way to create a new type name Basically a synonym for another type Useful for shortening long types or providing more meaningful

More information

TxWin 5.xx Programming and User Guide

TxWin 5.xx Programming and User Guide TxWin 5.xx Programming and User Guide Jan van Wijk Brief programming and user guide for the open-source TxWin text UI library Presentation contents Interfacing, include files, LIBs The message event model

More information

EE 312 Fall 2018 Midterm 1 Version A October 10, 2018

EE 312 Fall 2018 Midterm 1 Version A October 10, 2018 EE 312 Fall 2018 Midterm 1 Version A October 10, 2018 I promise that all work on this exam is my own, that I have not received assistance on it, and that I am adhering to the University's honor code. Name:

More information

Recitation 2/18/2012

Recitation 2/18/2012 15-213 Recitation 2/18/2012 Announcements Buflab due tomorrow Cachelab out tomorrow Any questions? Outline Cachelab preview Useful C functions for cachelab Cachelab Part 1: you have to create a cache simulator

More information

38.1 Tk_ConfigureWidget 337

38.1 Tk_ConfigureWidget 337 1 Chapter 36 Introduction 323 36.1 What s in a widget? 324 36.2 Widgets are event-driven 325 36.3 Tk vs. Xlib 325 36.4 Square: an example widget 326 36.5 Design for re-usability 328 Chapter 37 Creating

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

MicroStrain LXRS Wireless Base Station EEPROM Map

MicroStrain LXRS Wireless Base Station EEPROM Map MicroStrain LXRS Wireless Base Station EEPROM Map EEPROM Address (Decimal) EEPROM Address (Hexidecimal) Nomenclature Valid Ranges Factory Init Value 0 0 Reserved - 65535-2 2 Reserved - 65535-4 4 Reserved

More information

Deep C. Multifile projects Getting it running Data types Typecasting Memory management Pointers. CS-343 Operating Systems

Deep C. Multifile projects Getting it running Data types Typecasting Memory management Pointers. CS-343 Operating Systems Deep C Multifile projects Getting it running Data types Typecasting Memory management Pointers Fabián E. Bustamante, Fall 2004 Multifile Projects Give your project a structure Modularized design Reuse

More information

Summary of Last Class. Processes. C vs. Java. C vs. Java (cont.) C vs. Java (cont.) Tevfik Ko!ar. CSC Systems Programming Fall 2008

Summary of Last Class. Processes. C vs. Java. C vs. Java (cont.) C vs. Java (cont.) Tevfik Ko!ar. CSC Systems Programming Fall 2008 CSC 4304 - Systems Programming Fall 2008 Lecture - II Basics of C Programming Summary of Last Class Basics of UNIX: logging in, changing password text editing with vi, emacs and pico file and director

More information

File IO and command line input CSE 2451

File IO and command line input CSE 2451 File IO and command line input CSE 2451 File functions Open/Close files fopen() open a stream for a file fclose() closes a stream One character at a time: fgetc() similar to getchar() fputc() similar to

More information

Outline. Computer programming. Debugging. What is it. Debugging. Hints. Debugging

Outline. Computer programming. Debugging. What is it. Debugging. Hints. Debugging Outline Computer programming Debugging Hints Gathering evidence Common C errors "Education is a progressive discovery of our own ignorance." Will Durant T.U. Cluj-Napoca - Computer Programming - lecture

More information

EE 312 Fall 2017 Midterm 1 October 12, 2017

EE 312 Fall 2017 Midterm 1 October 12, 2017 EE 312 Fall 2017 Midterm 1 October 12, 2017 Name: EID: Recitation time: Recitation TA (circle one): Colin Huy Give clear, legible answers. If you give more than one answer, we will randomly choose one

More information

SU 2017 May 18/23 LAB 3 Bitwise operations, Program structures, Functions (pass-by-value), local vs. global variables. Debuggers

SU 2017 May 18/23 LAB 3 Bitwise operations, Program structures, Functions (pass-by-value), local vs. global variables. Debuggers SU 2017 May 18/23 LAB 3 Bitwise operations, Program structures, Functions (pass-by-value), local vs. global variables. Debuggers 1. Problem A Pass-by-value, and trace a program with debugger 1.1 Specification

More information

Bridging Bonobo Components

Bridging Bonobo Components Bridging Bonobo Components Abdelmalek Squalli Houssaini A dissertation submitted to the University of Dublin in partial fulfilment of the requirements for the degree of Master of Science in Computer Science

More information

The Past, Present, and Future of SWT

The Past, Present, and Future of SWT The Past, Present, and Future of SWT Eric Williams Email: ericwill@redhat.com Twitter: @yyzericwill About me: Eric Williams - Studied computer science at the University of Toronto - Intern at Red Hat from

More information