~canonical-dx-team/ubuntu/maverick/gtk+2.0/menuproxy

« back to all changes in this revision

Viewing changes to docs/tutorial/html/x1370.html

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-05-04 12:24:25 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20070504122425-0m8midgzrp40y8w2
Tags: 2.10.12-1ubuntu1
* Sync with Debian
* New upstream version:
  Fixed bugs:
  - 379414 file chooser warnings when changing path in the entry
  - 418585 GtkFileChooserDefault sizing code is not DPI independent
  - 419568 Crash in search if start with special letter
  - 435062 build dies with icon cache validation
  - 379399 Segfault to call gtk_print_operation_run twice.
  - 387889 cups backend has problems when there are too many printers
  - 418531 invalid read to gtkicontheme.c gtk_icon_theme_lookup_icon...
  - 423916 crash in color scheme code
  - 424042 Segmentation fault while quickly pressing Alt+arrows
  - 415260 Protect against negative indices when setting values in G...
  - 419171 XGetVisualInfo() may not set nxvisuals
  - 128852 Gdk cursors don't look good on win32
  - 344657 Ctrl-H doesn't toggle "Show Hidden Files" setting
  - 345345 PrintOperation::paginate is not emitted for class handler
  - 347567 GtkPrintOperation::end-print is not emitted if it's cance...
  - 369112 gtk_ui_manager_add_ui should accept unnamed separator
  - 392015 Selected menu item invisible on Windows Vista
  - 399253 MS-Windows Theme Bottom Tab placement rendering glitches
  - 399425 gtk_input_dialog_fill_axes() adds child to gtkscrolledwin...
  - 403251 [patch] little memory leak in GtkPrintJob
  - 403267 [patch] memory leak in GtkPageSetupUnixDialog
  - 403470 MS-Windows Theme tab placement other than on top leaks a ...
  - 404506 Windows system fonts that have multi-byte font names cann...
  - 405089 Incorrect window placement for GtkEventBox private window
  - 405515 Minor leak in gtkfilesystemmodel.c
  - 405539 gdk_pixbuf_save() for PNG saver can return FALSE without ...
  - 415681 gdk_window_clear_area includes an extra line and column o...
  - 418219 GtkRecentChooser should apply filter before sorting and c...
  - 418403 Scroll to printer after selecting it from settings
  - 421985 _gtk_print_operation_platform_backend_launch_preview
  - 421990 gtk_print_job_get_surface
  - 421993 gtk_print_operation_init
  - 423064 Conditional jump or move depends on uninitialised value(s...
  - 423722 Fix printing header in gtk-demo
  - 424168 gtk_print_operation_run on async preview
  - 425655 Don't install gtk+-unix-print-2.0.pc on non-UNIX platforms
  - 425786 GDK segfaults if XineramaQueryScreens fails
  - 428665 Lpr Backend gets stuck in infinite loop during gtk_enumer...
  - 429902 GtkPrintOperation leaks cairo contextes
  - 431997 First delay of GdkPixbufAnimationIter is wrong
  - 433242 Inconsistent scroll arrow position calculations
  - 433972 Placing gtk.Expander inside a gtk.TextView() changes gtk....
  - 434261 _gtk_toolbar_elide_underscores incorrectly handles some s...
  - 383354 ctrl-L should make 'Location' entry disappear
  - 418673 gtk_recent_manager_add_item
  - 429732 gtk_accel_group_finalize accesses invalid memory
  - 435028 WM_CLIENT_LEADER is wrong on the leader_window
  - 431067 Background of the header window is not updated
  - 338843 add recent files support inside the ui manager
  - 148535 add drop shadow to menus, tooltips, etc. under Windows XP
* debian/control.in:
  - Conflicts on ubuntulooks (<= 0.9.11-1)
* debian/patches/15_default-fallback-icon-theme.patch:
  - patch from Debian, fallback on gnome icon theme

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>Scrolled Windows</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REL="HOME"
 
10
TITLE="GTK+ 2.0 Tutorial"
 
11
HREF="book1.html"><LINK
 
12
REL="UP"
 
13
TITLE="Container Widgets"
 
14
HREF="c1228.html"><LINK
 
15
REL="PREVIOUS"
 
16
TITLE="Viewports"
 
17
HREF="x1354.html"><LINK
 
18
REL="NEXT"
 
19
TITLE="Button Boxes"
 
20
HREF="x1392.html"></HEAD
 
21
><BODY
 
22
CLASS="SECT1"
 
23
BGCOLOR="#FFFFFF"
 
24
TEXT="#000000"
 
25
LINK="#0000FF"
 
26
VLINK="#840084"
 
27
ALINK="#0000FF"
 
28
><DIV
 
29
CLASS="NAVHEADER"
 
30
><TABLE
 
31
SUMMARY="Header navigation table"
 
32
WIDTH="100%"
 
33
BORDER="0"
 
34
CELLPADDING="0"
 
35
CELLSPACING="0"
 
36
><TR
 
37
><TH
 
38
COLSPAN="3"
 
39
ALIGN="center"
 
40
>GTK+ 2.0 Tutorial</TH
 
41
></TR
 
42
><TR
 
43
><TD
 
44
WIDTH="10%"
 
45
ALIGN="left"
 
46
VALIGN="bottom"
 
47
><A
 
48
HREF="x1354.html"
 
49
ACCESSKEY="P"
 
50
>&#60;&#60;&#60; Previous</A
 
51
></TD
 
52
><TD
 
53
WIDTH="80%"
 
54
ALIGN="center"
 
55
VALIGN="bottom"
 
56
>Container Widgets</TD
 
57
><TD
 
58
WIDTH="10%"
 
59
ALIGN="right"
 
60
VALIGN="bottom"
 
61
><A
 
62
HREF="x1392.html"
 
63
ACCESSKEY="N"
 
64
>Next &#62;&#62;&#62;</A
 
65
></TD
 
66
></TR
 
67
></TABLE
 
68
><HR
 
69
ALIGN="LEFT"
 
70
WIDTH="100%"></DIV
 
71
><DIV
 
72
CLASS="SECT1"
 
73
><H1
 
74
CLASS="SECT1"
 
75
><A
 
76
NAME="SEC-SCROLLEDWINDOWS"
 
77
>Scrolled Windows</A
 
78
></H1
 
79
><P
 
80
>Scrolled windows are used to create a scrollable area with another
 
81
widget inside it. You may insert any type of widget into a scrolled
 
82
window, and it will be accessible regardless of the size by using the
 
83
scrollbars.</P
 
84
><P
 
85
>The following function is used to create a new scrolled window.</P
 
86
><TABLE
 
87
BORDER="0"
 
88
BGCOLOR="#E0E0E0"
 
89
WIDTH="100%"
 
90
><TR
 
91
><TD
 
92
><PRE
 
93
CLASS="PROGRAMLISTING"
 
94
>GtkWidget *gtk_scrolled_window_new( GtkAdjustment *hadjustment,
 
95
                                    GtkAdjustment *vadjustment );</PRE
 
96
></TD
 
97
></TR
 
98
></TABLE
 
99
><P
 
100
>Where the first argument is the adjustment for the horizontal
 
101
direction, and the second, the adjustment for the vertical direction.
 
102
These are almost always set to NULL.</P
 
103
><TABLE
 
104
BORDER="0"
 
105
BGCOLOR="#E0E0E0"
 
106
WIDTH="100%"
 
107
><TR
 
108
><TD
 
109
><PRE
 
110
CLASS="PROGRAMLISTING"
 
111
>void gtk_scrolled_window_set_policy( GtkScrolledWindow *scrolled_window,
 
112
                                     GtkPolicyType      hscrollbar_policy,
 
113
                                     GtkPolicyType      vscrollbar_policy );</PRE
 
114
></TD
 
115
></TR
 
116
></TABLE
 
117
><P
 
118
>This sets the policy to be used with respect to the scrollbars.
 
119
The first argument is the scrolled window you wish to change. The second
 
120
sets the policy for the horizontal scrollbar, and the third the policy for 
 
121
the vertical scrollbar.</P
 
122
><P
 
123
>The policy may be one of <TT
 
124
CLASS="LITERAL"
 
125
>GTK_POLICY_AUTOMATIC</TT
 
126
> or
 
127
<TT
 
128
CLASS="LITERAL"
 
129
>GTK_POLICY_ALWAYS</TT
 
130
>. <TT
 
131
CLASS="LITERAL"
 
132
>GTK_POLICY_AUTOMATIC</TT
 
133
> will automatically
 
134
decide whether you need scrollbars, whereas <TT
 
135
CLASS="LITERAL"
 
136
>GTK_POLICY_ALWAYS</TT
 
137
>
 
138
will always leave the scrollbars there.</P
 
139
><P
 
140
>You can then place your object into the scrolled window using the
 
141
following function.</P
 
142
><TABLE
 
143
BORDER="0"
 
144
BGCOLOR="#E0E0E0"
 
145
WIDTH="100%"
 
146
><TR
 
147
><TD
 
148
><PRE
 
149
CLASS="PROGRAMLISTING"
 
150
>void gtk_scrolled_window_add_with_viewport( GtkScrolledWindow *scrolled_window,
 
151
                                            GtkWidget         *child);</PRE
 
152
></TD
 
153
></TR
 
154
></TABLE
 
155
><P
 
156
>Here is a simple example that packs a table with 100 toggle buttons
 
157
into a scrolled window. I've only commented on the parts that may be
 
158
new to you.</P
 
159
><P
 
160
><SPAN
 
161
CLASS="INLINEMEDIAOBJECT"
 
162
><IMG
 
163
SRC="images/scrolledwin.png"></SPAN
 
164
></P
 
165
><TABLE
 
166
BORDER="0"
 
167
BGCOLOR="#E0E0E0"
 
168
WIDTH="100%"
 
169
><TR
 
170
><TD
 
171
><PRE
 
172
CLASS="PROGRAMLISTING"
 
173
>&#13;#include &#60;stdio.h&#62;
 
174
#include &#60;gtk/gtk.h&#62;
 
175
 
 
176
static void destroy( GtkWidget *widget,
 
177
                     gpointer   data )
 
178
{
 
179
    gtk_main_quit ();
 
180
}
 
181
 
 
182
int main( int   argc,
 
183
          char *argv[] )
 
184
{
 
185
    static GtkWidget *window;
 
186
    GtkWidget *scrolled_window;
 
187
    GtkWidget *table;
 
188
    GtkWidget *button;
 
189
    char buffer[32];
 
190
    int i, j;
 
191
    
 
192
    gtk_init (&#38;argc, &#38;argv);
 
193
    
 
194
    /* Create a new dialog window for the scrolled window to be
 
195
     * packed into.  */
 
196
    window = gtk_dialog_new ();
 
197
    g_signal_connect (G_OBJECT (window), "destroy",
 
198
                      G_CALLBACK (destroy), NULL);
 
199
    gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example");
 
200
    gtk_container_set_border_width (GTK_CONTAINER (window), 0);
 
201
    gtk_widget_set_size_request (window, 300, 300);
 
202
    
 
203
    /* create a new scrolled window. */
 
204
    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
 
205
    
 
206
    gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
 
207
    
 
208
    /* the policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS.
 
209
     * GTK_POLICY_AUTOMATIC will automatically decide whether you need
 
210
     * scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars
 
211
     * there.  The first one is the horizontal scrollbar, the second, 
 
212
     * the vertical. */
 
213
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
 
214
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
 
215
    /* The dialog window is created with a vbox packed into it. */                                                              
 
216
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)-&#62;vbox), scrolled_window, 
 
217
                        TRUE, TRUE, 0);
 
218
    gtk_widget_show (scrolled_window);
 
219
    
 
220
    /* create a table of 10 by 10 squares. */
 
221
    table = gtk_table_new (10, 10, FALSE);
 
222
    
 
223
    /* set the spacing to 10 on x and 10 on y */
 
224
    gtk_table_set_row_spacings (GTK_TABLE (table), 10);
 
225
    gtk_table_set_col_spacings (GTK_TABLE (table), 10);
 
226
    
 
227
    /* pack the table into the scrolled window */
 
228
    gtk_scrolled_window_add_with_viewport (
 
229
                   GTK_SCROLLED_WINDOW (scrolled_window), table);
 
230
    gtk_widget_show (table);
 
231
    
 
232
    /* this simply creates a grid of toggle buttons on the table
 
233
     * to demonstrate the scrolled window. */
 
234
    for (i = 0; i &#60; 10; i++)
 
235
       for (j = 0; j &#60; 10; j++) {
 
236
          sprintf (buffer, "button (%d,%d)\n", i, j);
 
237
          button = gtk_toggle_button_new_with_label (buffer);
 
238
          gtk_table_attach_defaults (GTK_TABLE (table), button,
 
239
                                     i, i+1, j, j+1);
 
240
          gtk_widget_show (button);
 
241
       }
 
242
    
 
243
    /* Add a "close" button to the bottom of the dialog */
 
244
    button = gtk_button_new_with_label ("close");
 
245
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
 
246
                              G_CALLBACK (gtk_widget_destroy),
 
247
                              G_OBJECT (window));
 
248
    
 
249
    /* this makes it so the button is the default. */
 
250
    
 
251
    GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
 
252
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)-&#62;action_area), button, TRUE, TRUE, 0);
 
253
    
 
254
    /* This grabs this button to be the default button. Simply hitting
 
255
     * the "Enter" key will cause this button to activate. */
 
256
    gtk_widget_grab_default (button);
 
257
    gtk_widget_show (button);
 
258
    
 
259
    gtk_widget_show (window);
 
260
    
 
261
    gtk_main();
 
262
    
 
263
    return 0;
 
264
}</PRE
 
265
></TD
 
266
></TR
 
267
></TABLE
 
268
><P
 
269
>Try playing with resizing the window. You'll notice how the scrollbars
 
270
react. You may also wish to use the gtk_widget_set_size_request() call to set
 
271
the default size of the window or other widgets.</P
 
272
></DIV
 
273
><DIV
 
274
CLASS="NAVFOOTER"
 
275
><HR
 
276
ALIGN="LEFT"
 
277
WIDTH="100%"><TABLE
 
278
SUMMARY="Footer navigation table"
 
279
WIDTH="100%"
 
280
BORDER="0"
 
281
CELLPADDING="0"
 
282
CELLSPACING="0"
 
283
><TR
 
284
><TD
 
285
WIDTH="33%"
 
286
ALIGN="left"
 
287
VALIGN="top"
 
288
><A
 
289
HREF="x1354.html"
 
290
ACCESSKEY="P"
 
291
>&#60;&#60;&#60; Previous</A
 
292
></TD
 
293
><TD
 
294
WIDTH="34%"
 
295
ALIGN="center"
 
296
VALIGN="top"
 
297
><A
 
298
HREF="book1.html"
 
299
ACCESSKEY="H"
 
300
>Home</A
 
301
></TD
 
302
><TD
 
303
WIDTH="33%"
 
304
ALIGN="right"
 
305
VALIGN="top"
 
306
><A
 
307
HREF="x1392.html"
 
308
ACCESSKEY="N"
 
309
>Next &#62;&#62;&#62;</A
 
310
></TD
 
311
></TR
 
312
><TR
 
313
><TD
 
314
WIDTH="33%"
 
315
ALIGN="left"
 
316
VALIGN="top"
 
317
>Viewports</TD
 
318
><TD
 
319
WIDTH="34%"
 
320
ALIGN="center"
 
321
VALIGN="top"
 
322
><A
 
323
HREF="c1228.html"
 
324
ACCESSKEY="U"
 
325
>Up</A
 
326
></TD
 
327
><TD
 
328
WIDTH="33%"
 
329
ALIGN="right"
 
330
VALIGN="top"
 
331
>Button Boxes</TD
 
332
></TR
 
333
></TABLE
 
334
></DIV
 
335
></BODY
 
336
></HTML
 
337
>
 
 
b'\\ No newline at end of file'