当前位置: 技术问答>linux和unix
一个 困扰我很长时间的 GTK+ 里的问题,希望高手能给予帮助解答
来源: 互联网 发布时间:2016-01-29
本文导语: 今天写的GTK+的程序,程序如下: 1 #include 2 3 gint x = 50; 4 gint y = 50; 5 6 void move_button( GtkWidget * widget, GtkWidget * fixed ) 7 { 8 x = ( x...
今天写的GTK+的程序,程序如下:
1 #include
2
3 gint x = 50;
4 gint y = 50;
5
6 void move_button( GtkWidget * widget, GtkWidget * fixed )
7 {
8 x = ( x + 30 ) % 300;
9 y = ( y + 50 ) % 300;
10 gtk_fixed_move( GTK_FIXED( fixed ), widget, x, y );
11 }
12
13
14 int main( int argc, char * argv[] )
15 {
16 GtkWidget * window;
17 GtkWidget * fixed;
18 GtkWidget * button;
19
20 gtk_init( & argc, & argv );
21
22 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
23 gtk_window_set_title( GTK_WINDOW(window) , "fixed container" );
24
25 gtk_signal_connect( GTK_OBJECT( window ), "destory",
26 GTK_SIGNAL_FUNC( gtk_main_quit ) , NULL );
27
28 gtk_container_set_border_width( GTK_CONTAINER(window), 10 );
29
30 fixed = gtk_fixed_new();
31 gtk_container_add( GTK_CONTAINER( window ), fixed );
32 gtk_widget_show( fixed );
33 int i ;
34
35
36
37 for ( i = 1; i
1 #include
2
3 gint x = 50;
4 gint y = 50;
5
6 void move_button( GtkWidget * widget, GtkWidget * fixed )
7 {
8 x = ( x + 30 ) % 300;
9 y = ( y + 50 ) % 300;
10 gtk_fixed_move( GTK_FIXED( fixed ), widget, x, y );
11 }
12
13
14 int main( int argc, char * argv[] )
15 {
16 GtkWidget * window;
17 GtkWidget * fixed;
18 GtkWidget * button;
19
20 gtk_init( & argc, & argv );
21
22 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
23 gtk_window_set_title( GTK_WINDOW(window) , "fixed container" );
24
25 gtk_signal_connect( GTK_OBJECT( window ), "destory",
26 GTK_SIGNAL_FUNC( gtk_main_quit ) , NULL );
27
28 gtk_container_set_border_width( GTK_CONTAINER(window), 10 );
29
30 fixed = gtk_fixed_new();
31 gtk_container_add( GTK_CONTAINER( window ), fixed );
32 gtk_widget_show( fixed );
33 int i ;
34
35
36
37 for ( i = 1; i