📄 z144.html
字号:
GdkModifierType accel_mods); /* Explicit focus */ void (* grab_focus) (GtkWidget *widget); /* Events */ gint (* event) (GtkWidget *widget, GdkEvent *event); gint (* button_press_event) (GtkWidget *widget, GdkEventButton *event); gint (* button_release_event) (GtkWidget *widget, GdkEventButton *event); gint (* motion_notify_event) (GtkWidget *widget, GdkEventMotion *event); gint (* delete_event) (GtkWidget *widget, GdkEventAny *event); gint (* destroy_event) (GtkWidget *widget, GdkEventAny *event); gint (* expose_event) (GtkWidget *widget, GdkEventExpose *event); gint (* key_press_event) (GtkWidget *widget, GdkEventKey *event); gint (* key_release_event) (GtkWidget *widget, GdkEventKey *event); gint (* enter_notify_event) (GtkWidget *widget, GdkEventCrossing *event); gint (* leave_notify_event) (GtkWidget *widget, GdkEventCrossing *event); gint (* configure_event) (GtkWidget *widget, GdkEventConfigure *event); gint (* focus_in_event) (GtkWidget *widget, GdkEventFocus *event); gint (* focus_out_event) (GtkWidget *widget, GdkEventFocus *event); gint (* map_event) (GtkWidget *widget, GdkEventAny *event); gint (* unmap_event) (GtkWidget *widget, GdkEventAny *event); gint (* property_notify_event) (GtkWidget *widget, GdkEventProperty *event); gint (* selection_clear_event) (GtkWidget *widget, GdkEventSelection *event); gint (* selection_request_event) (GtkWidget *widget, GdkEventSelection *event); gint (* selection_notify_event) (GtkWidget *widget, GdkEventSelection *event); gint (* proximity_in_event) (GtkWidget *widget, GdkEventProximity *event); gint (* proximity_out_event) (GtkWidget *widget, GdkEventProximity *event); gint (* visibility_notify_event) (GtkWidget *widget, GdkEventVisibility *event); gint (* client_event) (GtkWidget *widget, GdkEventClient *event); gint (* no_expose_event) (GtkWidget *widget, GdkEventAny *event); /* Selection */ void (* selection_get) (GtkWidget *widget, GtkSelectionData *selection_data, guint info, guint time); void (* selection_received) (GtkWidget *widget, GtkSelectionData *selection_data, guint time); /* Source side drag signals */ void (* drag_begin) (GtkWidget *widget, GdkDragContext *context); void (* drag_end) (GtkWidget *widget, GdkDragContext *context); void (* drag_data_get) (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time); void (* drag_data_delete) (GtkWidget *widget, GdkDragContext *context); /* Target side drag signals */ void (* drag_leave) (GtkWidget *widget, GdkDragContext *context, guint time); gboolean (* drag_motion) (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time); gboolean (* drag_drop) (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time); void (* drag_data_received) (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time); /* Action signals */ void (* debug_msg) (GtkWidget *widget, const gchar *string); /* Padding for future expansion */ GtkFunction pad1; GtkFunction pad2; GtkFunction pad3; GtkFunction pad4;}; </pre> </td> </tr> </table> <p> Most of the functions in <span class="STRUCTNAME"> GtkWidgetClass</span> are registered as default handlers for signals. The exceptions are <span class="STRUCTNAME"> show_all</span> and <span class="STRUCTNAME"> hide_all</span>, which are class functions only. Of course, <span class="STRUCTNAME">GtkWidgetClass</span> inherits the five class functions and single signal (<span class="SYMBOL">"destroy"</span>) from <span class= "STRUCTNAME">GtkObjectClass</span>. This chapter will describe the important methods in more detail; also, <a href="sec-gdkevent.html">the section called <i>Events</i> in the chapter called <i>GDK Basics</i></a> is important for understanding the event methods. <a href= "sec-widgetindetail.html">the section called <i><tt class="CLASSNAME">GtkWidget</tt> In Detail</i></a> describes the default implementation of each method in some detail. </p> <div class="SECT3"> <h3 class="SECT3"> <a name="SEC-OVERRIDESIGNALS">Overridable Signals</a> </h3> <p> You may notice that <span class="STRUCTNAME"> GtkWidgetClass</span> contains two signal identifiers in addition to function pointers. These are 0 by default; otherwise, they indicate the signal to emit to "activate" the widget, or to set its scroll adjustments. </p> <p> The <span class="STRUCTNAME">activate_signal</span> is emitted when the user presses the space bar or Enter key while the widget is focused; for buttons, it will be the <span class="SYMBOL">"clicked"</span> signal, for menu items, the <span class="SYMBOL"> "activate"</span> signal. </p> <p> The <span class="STRUCTNAME"> set_scroll_adjustments_signal</span> is used by <tt class="CLASSNAME">GtkScrolledWindow</tt> to set the scroll adjustments used by the widget. <tt class= "CLASSNAME">GtkLayout</tt>, <tt class="CLASSNAME"> GtkCList</tt>, and others have a signal to set the scroll adjustments. </p> <p> These two hacks are necessary because GTK+ 1.2 does not support interfaces or multiple inheritance. (A future version of GTK+ may support interfaces similar in spirit to Java's interfaces.) Ideally, there would be "GtkActivatable" and "GtkScrollable" base classes or interfaces, and all widgets supporting these actions would derive from them. Including the two signal IDs in <span class="STRUCTNAME">GtkWidgetClass</span> is a short-term workaround. </p> </div> </div> </div> <div class="NAVFOOTER"> <br> <br> <table width="100%" border="0" bgcolor="#ffffff" cellpadding= "1" cellspacing="0"> <tr> <td width="25%" bgcolor="#ffffff" align="left"> <a href="cha-widget.html"><font color="#0000ff" size= "2"><b><<< Previous</b></font></a> </td> <td width="25%" colspan="2" bgcolor="#ffffff" align= "center"> <font color="#0000ff" size="2"><b><a href="ggad.html"> <font color="#0000ff" size="2"><b> Home</b></font></a></b></font> </td> <td width="25%" bgcolor="#ffffff" align="right"> <a href="z147.html"><font color="#0000ff" size="2"><b> Next >>></b></font></a> </td> </tr> <tr> <td colspan="2" align="left"> <font color="#000000" size="2"><b>Writing a <tt class= "CLASSNAME">GtkWidget</tt></b></font> </td> <td colspan="2" align="right"> <font color="#000000" size="2"><b>An Example: The <tt class="CLASSNAME">GtkEv</tt> Widget</b></font> </td> </tr> </table> </div> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -