Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.sao.ru/cats/~satr/GGAD/z94.html
Дата изменения: Wed Jul 12 23:54:36 2000
Дата индексирования: Mon Oct 1 23:59:32 2012
Кодировка:

Поисковые слова: scientist
Finishing Touches

Finishing Touches

Really polished application windows behave well on small screens, and set hints so the window manager can keep track of them.

Adapting to Screen Size

The functions in Figure 12 allow you to query the size of the screen in pixels. You can use this information to adjust the layout of your application window; for example, if you know your usual application window is too large for a 640 by 480 display, you could provide an alternative widget layout for small screens. Applications that automatically adapt to the screen size are very impressive.

Of course, you should leave control in the hands of the user; users with large screens might want the small version of your application anyway, and you should always try to respond sensibly if the user resizes the window. Use the screen size to select the best default from among your application's possible configurations.

#include <gdk/gdk.h>

gint gdk_screen_width(void);

gint gdk_screen_height(void);

Figure 12. Querying Screen Size

Setting Window Class Hints

The "class hint" is a property of GtkWindow window managers can read to decide how to treat the window. Most window managers allow you to set icons and other properties based on the class hint. Two elements make up the hint. The wmclass_name field should be unique for each kind of toplevel window in an application (such as the main window or a tools dialog). The wmclass_class field is conventionally set to the name of the application, capitalized. For example: xterm windows set these properties to xterm (name) and XTerm (class). The GIMP toolbox sets its name to toolbox and its class to Gimp. The gtk_window_set_wmclass() function sets these hints for GtkWindow.

#include <gtk/gtkwindow.h>

void gtk_window_set_wmclass(GtkWindow* window, const gchar* wmclass_name, const gchar* wmclass_class);

Figure 13. Setting Class Hints