Mercurial > emacs
comparison man/xresmini.texi @ 70510:fc945cb968d9
Added GTK part
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sun, 07 May 2006 19:38:49 +0000 |
parents | 4e4de282af95 |
children | b7261e09f8e4 |
comparison
equal
deleted
inserted
replaced
70509:35036885ffb9 | 70510:fc945cb968d9 |
---|---|
294 @end table | 294 @end table |
295 | 295 |
296 @node GTK resources | 296 @node GTK resources |
297 @appendixsec GTK resources | 297 @appendixsec GTK resources |
298 | 298 |
299 @c Waiting for contents | 299 The most common way to customize the GTK widgets Emacs uses (menus, dialogs |
300 tool bars and scroll bars) is by choosing an appropriate theme, for example | |
301 with the GNOME theme selector. You can also do Emacs specific customization | |
302 by inserting GTK style directives in the file @file{~/.emacs.d/gtkrc}. Some GTK | |
303 themes ignore customizations in @file{~/.emacs.d/gtkrc} so not everything | |
304 works with all themes. To customize Emacs font, background, faces, etc., use | |
305 the normal X resources (@pxref{Resources}). We will present some examples of | |
306 customizations here, but for a more detailed description, see the online manual. | |
307 | |
308 The first example is just one line. It changes the font on all GTK widgets | |
309 to courier with size 12: | |
310 | |
311 @smallexample | |
312 gtk-font-name = "courier 12" | |
313 @end smallexample | |
314 | |
315 The thing to note is that the font name is not an X font name, like | |
316 -*-helvetica-medium-r-*--*-120-*-*-*-*-*-*, but a Pango font name. A Pango | |
317 font name is basically of the format "family style size", where the style | |
318 is optional as in the case above. A name with a style could be for example: | |
319 | |
320 @smallexample | |
321 gtk-font-name = "helvetica bold 10" | |
322 @end smallexample | |
323 | |
324 To customize widgets you first define a style and then apply the style to | |
325 the widgets. Here is an example that sets the font for menus, but not | |
326 for other widgets: | |
327 | |
328 @smallexample | |
329 # @r{Define the style @samp{menufont}.} | |
330 style "menufont" | |
331 @{ | |
332 font_name = "helvetica bold 14" # This is a Pango font name | |
333 @} | |
334 | |
335 # @r{Specify that widget type @samp{*emacs-menuitem*} uses @samp{menufont}.} | |
336 widget "*emacs-menuitem*" style "menufont" | |
337 @end smallexample | |
338 | |
339 The widget name in this example contains wildcards, so the style will be | |
340 applied to all widgets that match "*emacs-menuitem*". The widgets are | |
341 named by the way they are contained, from the outer widget to the inner widget. | |
342 So to apply the style "my_style" (not shown) with the full, absolute name, for | |
343 the menubar and the scroll bar in Emacs we use: | |
344 | |
345 @smallexample | |
346 widget "Emacs.pane.menubar" style "my_style" | |
347 widget "Emacs.pane.emacs.verticalScrollBar" style "my_style" | |
348 @end smallexample | |
349 | |
350 But to aoid having to type it all, wildcards are often used. @samp{*} | |
351 matches zero or more characters and @samp{?} matches one character. So "*" | |
352 matches all widgets. | |
353 | |
354 Each widget has a class (for example GtkMenuItem) and a name (emacs-menuitem). | |
355 You can assign styles by name or by class. In this example we have used the | |
356 class: | |
357 | |
358 @smallexample | |
359 style "menufont" | |
360 @{ | |
361 font_name = "helvetica bold 14" | |
362 @} | |
363 | |
364 widget_class "*GtkMenuBar" style "menufont" | |
365 @end smallexample | |
366 | |
367 @noindent | |
368 The names and classes for the GTK widgets Emacs uses are: | |
369 | |
370 @multitable {@code{verticalScrollbar plus}} {@code{GtkFileSelection} and some} | |
371 @item @code{emacs-filedialog} | |
372 @tab @code{GtkFileSelection} | |
373 @item @code{emacs-dialog} | |
374 @tab @code{GtkDialog} | |
375 @item @code{Emacs} | |
376 @tab @code{GtkWindow} | |
377 @item @code{pane} | |
378 @tab @code{GtkVHbox} | |
379 @item @code{emacs} | |
380 @tab @code{GtkFixed} | |
381 @item @code{verticalScrollBar} | |
382 @tab @code{GtkVScrollbar} | |
383 @item @code{emacs-toolbar} | |
384 @tab @code{GtkToolbar} | |
385 @item @code{menubar} | |
386 @tab @code{GtkMenuBar} | |
387 @item @code{emacs-menuitem} | |
388 @tab anything in menus | |
389 @end multitable | |
390 | |
391 GTK absolute names are quite strange when it comes to menus | |
392 and dialogs. The names do not start with @samp{Emacs}, as they are | |
393 free-standing windows and not contained (in the GTK sense) by the | |
394 Emacs GtkWindow. To customize the dialogs and menus, use wildcards like this: | |
395 | |
396 @smallexample | |
397 widget "*emacs-dialog*" style "my_dialog_style" | |
398 widget "*emacs-filedialog* style "my_file_style" | |
399 widget "*emacs-menuitem* style "my_menu_style" | |
400 @end smallexample | |
401 | |
402 If you specify a customization in @file{~/.emacs.d/gtkrc}, then it | |
403 automatically applies only to Emacs, since other programs don't read | |
404 that file. For example, the drop down menu in the file dialog can not | |
405 be customized by any absolute widget name, only by an absolute class | |
406 name. This is because the widgets in the drop down menu do not | |
407 have names and the menu is not contained in the Emacs GtkWindow. To | |
408 have all menus in Emacs look the same, use this in | |
409 @file{~/.emacs.d/gtkrc}: | |
410 | |
411 @smallexample | |
412 widget_class "*Menu*" style "my_menu_style" | |
413 @end smallexample | |
414 | |
415 Here is a more elaborate example, showing how to change the parts of | |
416 the scroll bar: | |
417 | |
418 @smallexample | |
419 style "scroll" | |
420 @{ | |
421 fg[NORMAL] = "red"@ @ @ @ @ # @r{The arrow color.} | |
422 bg[NORMAL] = "yellow"@ @ # @r{The thumb and background around the arrow.} | |
423 bg[ACTIVE] = "blue"@ @ @ @ # @r{The trough color.} | |
424 bg[PRELIGHT] = "white"@ # @r{The thumb color when the mouse is over it.} | |
425 @} | |
426 | |
427 widget "*verticalScrollBar*" style "scroll" | |
428 @end smallexample | |
300 | 429 |
301 @ignore | 430 @ignore |
302 arch-tag: e1856f29-2482-42c0-a990-233cdccd1f21 | 431 arch-tag: e1856f29-2482-42c0-a990-233cdccd1f21 |
303 @end ignore | 432 @end ignore |