Gtkruler It can be a vertical or horizontal ruler, you can set its upper and lower bounds, you can also make the game icon above it move with the mouse, you can use gtk_hruler_new () or Gtk_vruler_new () is used to create horizontal or vertical ruler components. Using gtk_ruler_set_metric (), you can set measurement units and values: Gtk_pixels (pixels), gtk_inches (), and gtk_centimeters (public keys ).You can set the zookeeper of gtkrases:
Void gtk_ruler_set_range (gtkruler * rrange,
Gdouble lower,
Gdouble upper,
Gdouble position,
Gdouble max_size );
The lower and upper are used to set the upper and lower bounds of the ruler, and the position is used to set the display position of the current small game standard, max_size is used to calculate the scale and the accuracy of the number. The smaller the number, the ruler scale or number indicates a larger number. If you want to move the game icon on the ruler to the mouse's position, first, the mouse's moving component must be able to accept the mouse's moving event, for example, set gtkwindow to accept mouse Motion Events:
Gtk_widget_set_events (window, gdk_pointer_motion_mask |
Gdk_pointer_motion_hint_mask );
The motion_policy_event message of mouse movement must be sent to the motion_policy_event function of gtkruler. For example:
# Define event_method (I, x) gtk_widget_get_class (I)-> X
G_signal_connect_swapped (g_object (window), "motion_policy_event ",
G_callback (event_method (hrule, motion_policy_event )),
Hrule );
The following example shows how to make the gtkrkrand keyboard move on the gtkwindow. The location of the gtkruler is based on the gtktable :
#include <gtk/gtk.h>
#define EVENT_METHOD(i, x) GTK_WIDGET_GET_CLASS(i)->x
int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *table; GtkWidget *hrule; GtkWidget *vrule;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW (window), "GtkRuler"); gtk_window_set_default_size(GTK_WINDOW(window), 600, 400);
gtk_widget_set_events(window, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
table = gtk_table_new (2, 2, FALSE); gtk_container_add(GTK_CONTAINER(window), table);
hrule = gtk_hruler_new(); gtk_ruler_set_metric(GTK_RULER(hrule), GTK_PIXELS); gtk_ruler_set_range(GTK_RULER(hrule), 7, 13, 0, 20); g_signal_connect_swapped(G_OBJECT(window), "motion_notify_event", G_CALLBACK(EVENT_METHOD(hrule, motion_notify_event)), hrule); gtk_table_attach(GTK_TABLE(table), hrule, 1, 2, 0, 1, GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0);
vrule = gtk_vruler_new(); gtk_ruler_set_metric(GTK_RULER(vrule), GTK_PIXELS); gtk_ruler_set_range(GTK_RULER(vrule), 0, 400, 10, 400); g_signal_connect_swapped(G_OBJECT(window), "motion_notify_event", G_CALLBACK(EVENT_METHOD(vrule, motion_notify_event)), vrule); gtk_table_attach(GTK_TABLE(table), vrule, 0, 1, 1, 2, GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0);
g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); gtk_widget_show_all(window); gtk_main();
return 0; } The result of a line is as follows:
|
|
|
Genuine iPhone msn Finally |
|
| The official edition features a complete set of functions. It is safe to use and free of trial! |
| More messages .. |
|
| Technical skills to find out how powerful your computer is! |
|
| With the most cool connected computer and sharing it with your friends, you will have the chance to become a big fan! |
| More messages .. |
|
|
|
Impr |