本文整理汇总了C++中GTK_EVENT_BOX函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_EVENT_BOX函数的具体用法?C++ GTK_EVENT_BOX怎么用?C++ GTK_EVENT_BOX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_EVENT_BOX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mc_create_command_entry
void
mc_create_command_entry (MCData *mc)
{
mc->applet_box = icon_entry_new ();
mc->entry= ICON_ENTRY(mc->applet_box)->entry;
g_object_set_data (G_OBJECT (mc->applet_box), "mcdata", mc);
gtk_entry_set_max_length (GTK_ENTRY (mc->entry), MC_MAX_COMMAND_LENGTH);
mc->history_button = gtk_event_box_new ();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (mc->history_button), FALSE);
mc->history_image = gtk_image_new_from_stock ("gtk-go-down",
GTK_ICON_SIZE_MENU);
gtk_widget_show (mc->history_image);
gtk_container_add (GTK_CONTAINER (mc->history_button), mc->history_image);
icon_entry_pack_widget (ICON_ENTRY(mc->applet_box), mc->history_button, FALSE);
mc->file_select_button = gtk_event_box_new ();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (mc->file_select_button), FALSE);
mc->file_select_image = gtk_image_new_from_stock ("gtk-open",
GTK_ICON_SIZE_MENU);
gtk_widget_show (mc->file_select_image);
gtk_container_add (GTK_CONTAINER (mc->file_select_button), mc->file_select_image);
icon_entry_pack_widget (ICON_ENTRY(mc->applet_box),
mc->file_select_button, FALSE);
g_signal_connect (mc->entry, "key_press_event",
G_CALLBACK (command_key_event), mc);
g_signal_connect (mc->entry, "button_press_event",
G_CALLBACK (button_press_cb), mc);
g_signal_connect (mc->file_select_button, "button_press_event",
G_CALLBACK (button_press_hack), mc);
g_signal_connect (mc->history_button, "button_press_event",
G_CALLBACK (button_press_hack), mc);
if (!mc->preferences.show_default_theme)
{
gtk_widget_set_name (mc->entry, "minicommander-applet-entry");
mc_command_update_entry_color (mc);
}
else
gtk_widget_set_name (mc->entry,
"minicommander-applet-entry-default");
mc_command_update_entry_size (mc);
set_atk_name_description (mc->entry,
_("Command line"),
_("Type a command here and Gnome will execute it for you"));
}
示例2: assign_cellbutton
static GtkEventBox*
assign_cellbutton(UIMCandWinHorizontalGtk *horizontal_cwin,
gint cand_index, gint display_limit)
{
struct index_button *idxbutton;
int len;
GPtrArray *buttons;
buttons = horizontal_cwin->buttons;
len = buttons->len;
if (len <= cand_index) {
GtkWidget *button;
GtkWidget *label;
button = gtk_event_box_new();
gtk_event_box_set_above_child(GTK_EVENT_BOX(button), TRUE);
label = gtk_label_new("");
gtk_container_add(GTK_CONTAINER(button), label);
scale_label(GTK_EVENT_BOX(button), PANGO_SCALE_LARGE);
g_signal_connect(button, "button-press-event", G_CALLBACK(button_clicked), horizontal_cwin);
#if GTK_CHECK_VERSION(2, 90, 0)
g_signal_connect_after(label, "draw", G_CALLBACK(label_draw), horizontal_cwin);
#else
g_signal_connect_after(label, "expose-event", G_CALLBACK(label_exposed), horizontal_cwin);
#endif
#if GTK_CHECK_VERSION(3, 4, 0)
gtk_widget_set_hexpand(button, TRUE);
gtk_widget_set_vexpand(button, TRUE);
gtk_grid_attach(GTK_GRID(UIM_CAND_WIN_GTK(horizontal_cwin)->view), button,
cand_index, 0, 1, 1);
#else
gtk_table_attach_defaults(GTK_TABLE(UIM_CAND_WIN_GTK(horizontal_cwin)->view), button, cand_index, cand_index + 1, 0, 1);
#endif
idxbutton = g_malloc(sizeof(struct index_button));
if (idxbutton) {
idxbutton->button = GTK_EVENT_BOX(button);
clear_button(idxbutton, cand_index);
idxbutton->cand_index_in_page = cand_index;
}
g_ptr_array_add(horizontal_cwin->buttons, idxbutton);
} else {
idxbutton = g_ptr_array_index(buttons, cand_index);
idxbutton->cand_index_in_page = cand_index;
}
return idxbutton->button;
}
示例3: ccm_cell_extension_new
CCMCellExtension *
ccm_cell_extension_new (const gchar * path, int width)
{
g_return_val_if_fail (path != NULL, NULL);
CCMCellExtension *self = g_object_new (CCM_TYPE_CELL_EXTENSION, NULL);
GtkWidget *vbox, *hbox, *button;
self->priv->path = g_strdup (path);
vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (self), vbox);
// Name/description label
self->priv->name = gtk_label_new ("\n");
gtk_widget_set_size_request (self->priv->name, width - 4, -1);
gtk_label_set_use_markup (GTK_LABEL (self->priv->name), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (self->priv->name), TRUE);
gtk_widget_show (self->priv->name);
gtk_box_pack_start (GTK_BOX (vbox), self->priv->name, TRUE, TRUE, 0);
// Add activation line
hbox = gtk_hbox_new (FALSE, 5);
gtk_widget_show (hbox);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
self->priv->author = gtk_label_new ("");
gtk_label_set_use_markup (GTK_LABEL (self->priv->author), TRUE);
gtk_widget_show (self->priv->author);
gtk_box_pack_start (GTK_BOX (hbox), self->priv->author, TRUE, TRUE, 0);
self->priv->enable = gtk_label_new ("");
gtk_label_set_use_markup (GTK_LABEL (self->priv->enable), TRUE);
gtk_label_set_markup (GTK_LABEL (self->priv->enable), "<span size='small'>Enable</span>");
gtk_widget_show (self->priv->enable);
button = gtk_button_new ();
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (button), self->priv->enable);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_event_box_set_above_child (GTK_EVENT_BOX (self), FALSE);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (self), FALSE);
return self;
}
示例4: tabmanagergui_create_label
void tabmanagergui_create_label (GuTabPage* tp, gchar* labeltext) {
static unsigned count = 0;
GtkRcStyle* rcstyle = NULL;
GtkWidget* image = NULL;
GtkHBox* hbox;
tp->labelbox = gtk_event_box_new ();
hbox = GTK_HBOX (gtk_hbox_new (FALSE, 0));
tp->unsavednr = ++count;
gtk_event_box_set_visible_window (GTK_EVENT_BOX (tp->labelbox), FALSE);
gtk_container_add (GTK_CONTAINER(tp->labelbox), GTK_WIDGET (hbox));
tp->label = GTK_LABEL (gtk_label_new (labeltext));
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (tp->label), TRUE, TRUE, 5);
tp->button = GTK_BUTTON (gtk_button_new());
image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
gtk_button_set_image (tp->button, image);
g_object_set (tp->button, "relief", GTK_RELIEF_NONE,
"focus-on-click", FALSE, NULL);
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (tp->button), FALSE,FALSE,0);
rcstyle = gtk_rc_style_new ();
rcstyle->xthickness = rcstyle->ythickness = 0;
gtk_widget_modify_style (GTK_WIDGET (tp->button), rcstyle);
g_object_unref (rcstyle);
gtk_widget_show_all (GTK_WIDGET (hbox));
}
示例5: main
int main(int argc, char *argv[]){
GtkWidget *window, *eventbox, *label;
gtk_init (&argc,&argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
gtk_container_set_border_width (GTK_CONTAINER (window),10);
gtk_widget_set_size_request (window, 200, 50);
g_signal_connect (G_OBJECT (window),"destroy",
G_CALLBACK(destroy), NULL);
eventbox = gtk_event_box_new();
label = gtk_label_new ("Double-Click it!");
/* Set the order in which the widgets will recieve notification of events. */
gtk_event_box_set_above_child (GTK_EVENT_BOX (eventbox), FALSE);
g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (button_pressed), (gpointer) label);
gtk_container_add (GTK_CONTAINER (eventbox), label);
gtk_container_add (GTK_CONTAINER (window), eventbox);
/* ALlow the event box to catch button presses, realize the widget, and set the cursor that will be displayed when the mouse is over the event box*/
gtk_widget_set_events (eventbox, GDK_BUTTON_PRESS_MASK);
gtk_widget_realize(eventbox);
gdk_window_set_cursor (eventbox->window, gdk_cursor_new (GDK_HAND1));
gtk_widget_show_all (window);
gtk_main();
return 0;
}
示例6: gimp_color_bar_init
static void
gimp_color_bar_init (GimpColorBar *bar)
{
gtk_event_box_set_visible_window (GTK_EVENT_BOX (bar), FALSE);
bar->orientation = GTK_ORIENTATION_HORIZONTAL;
}
示例7: main
int
main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *eventbox;
GtkWidget *icon;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
icon = gtk_image_new_from_file ("bt-blocked.svg");
eventbox = gtk_event_box_new ();
gtk_widget_set_app_paintable(eventbox, TRUE);
g_signal_connect (G_OBJECT (eventbox), "draw", G_CALLBACK (draw_box_back), NULL);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (eventbox), TRUE);
gtk_container_add (GTK_CONTAINER (eventbox), icon);
gtk_container_add (GTK_CONTAINER (window), eventbox);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
示例8: g_set_error_literal
Splash *oregano_splash_new (GError **error)
{
GtkBuilder *gui;
Splash *sp;
GtkEventBox *event;
if ((gui = gtk_builder_new ()) == NULL) {
g_set_error_literal (error, OREGANO_ERROR, OREGANO_UI_ERROR_NO_BUILDER,
_ ("Failed to spawn builder"));
return NULL;
}
gtk_builder_set_translation_domain (gui, NULL);
if (gtk_builder_add_from_file (gui, OREGANO_UIDIR "/splash.ui", error) <= 0) {
return NULL;
}
sp = g_new0 (Splash, 1);
sp->can_destroy = FALSE;
sp->win = GTK_WINDOW (gtk_builder_get_object (gui, "splash"));
sp->lbl = GTK_LABEL (gtk_builder_get_object (gui, "label"));
sp->progress = GTK_WIDGET (gtk_builder_get_object (gui, "pbar"));
event = GTK_EVENT_BOX (gtk_builder_get_object (gui, "event"));
sp->event = GTK_WIDGET (event);
gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (sp->progress), 0.07);
gtk_widget_show_all (GTK_WIDGET (sp->win));
while (gtk_events_pending ())
gtk_main_iteration ();
return sp;
}
示例9: time_out_new
static TimeOutPlugin*
time_out_new (XfcePanelPlugin *plugin)
{
TimeOutPlugin *time_out;
GtkOrientation orientation;
/* Allocate memory for the plugin structure */
time_out = panel_slice_new0 (TimeOutPlugin);
/* Store pointer to the plugin */
time_out->plugin = plugin;
/* Create lock screen */
time_out->lock_screen = time_out_lock_screen_new ();
/* Connect to 'postpone' signal of the lock screen */
g_signal_connect (G_OBJECT (time_out->lock_screen), "postpone", G_CALLBACK (time_out_postpone), time_out);
/* Connect to 'resume' signal of the lock screen */
g_signal_connect (G_OBJECT (time_out->lock_screen), "resume", G_CALLBACK (time_out_resume), time_out);
/* Create countdowns */
time_out->break_countdown = time_out_countdown_new ();
time_out->lock_countdown = time_out_countdown_new ();
/* Connect to break countdown signals */
g_signal_connect (G_OBJECT (time_out->break_countdown), "update", G_CALLBACK (time_out_break_countdown_update), time_out);
g_signal_connect (G_OBJECT (time_out->break_countdown), "finish", G_CALLBACK (time_out_break_countdown_finish), time_out);
/* Connect to lock countdown signals */
g_signal_connect (G_OBJECT (time_out->lock_countdown), "update", G_CALLBACK (time_out_lock_countdown_update), time_out);
g_signal_connect (G_OBJECT (time_out->lock_countdown), "finish", G_CALLBACK (time_out_lock_countdown_finish), time_out);
/* Get the current orientation */
orientation = xfce_panel_plugin_get_orientation (plugin);
/* Create event box to catch user events */
time_out->ebox = gtk_event_box_new ();
gtk_event_box_set_visible_window(GTK_EVENT_BOX(time_out->ebox), FALSE);
gtk_widget_show (time_out->ebox);
/* Create flexible box which can do both, horizontal and vertical layout */
time_out->hvbox = xfce_hvbox_new (orientation, FALSE, 2);
gtk_container_add (GTK_CONTAINER (time_out->ebox), time_out->hvbox);
gtk_widget_show (time_out->hvbox);
/* Create time out icon */
time_out->panel_icon = gtk_image_new_from_icon_name ("xfce4-time-out-plugin", GTK_ICON_SIZE_DIALOG);
gtk_image_set_pixel_size (GTK_IMAGE (time_out->panel_icon), xfce_panel_plugin_get_size (time_out->plugin) - 8);
gtk_box_pack_start (GTK_BOX (time_out->hvbox), time_out->panel_icon, TRUE, TRUE, 0);
gtk_widget_show (time_out->panel_icon);
/* Create label for displaying the remaining time until the next break */
time_out->time_label = gtk_label_new (_("Inactive"));
gtk_misc_set_alignment (GTK_MISC (time_out->time_label), 0.5, 0.5);
gtk_box_pack_start (GTK_BOX (time_out->hvbox), time_out->time_label, TRUE, TRUE, 0);
gtk_widget_show (time_out->time_label);
return time_out;
}
示例10: gtk_event_box_new
static GtkWidget *ui_make_img_btn(char *img_btn)
{
GtkWidget *image;
GtkWidget *eventbox;
eventbox = gtk_event_box_new();
gtk_widget_set_events(eventbox, GDK_MOTION_NOTIFY | GDK_BUTTON_RELEASE
| GDK_BUTTON_PRESS
| GDK_ENTER_NOTIFY
| GDK_LEAVE_NOTIFY);
image = gtk_image_new_from_file(img_btn);
gtk_container_add(GTK_CONTAINER(eventbox), image);
/* set eventbox not visible, only accept event */
gtk_event_box_set_visible_window(GTK_EVENT_BOX(eventbox), FALSE);
/* just change the mouse style */
g_signal_connect(eventbox, "button_press_event", G_CALLBACK(e_img_btn_handle), NULL);
g_signal_connect(eventbox, "button_release_event", G_CALLBACK(e_img_btn_handle), NULL);
g_signal_connect(eventbox, "enter_notify_event", G_CALLBACK(e_img_btn_handle), NULL);
g_signal_connect(eventbox, "leave_notify_event", G_CALLBACK(e_img_btn_handle), NULL);
return eventbox;
}
示例11: colorful_tabs_deactivate_cb
static void
colorful_tabs_deactivate_cb (MidoriExtension* extension,
MidoriBrowser* browser)
{
guint i;
GtkWidget* view;
MidoriApp* app = midori_extension_get_app (extension);
g_signal_handlers_disconnect_by_func (
app, colorful_tabs_app_add_browser_cb, extension);
g_signal_handlers_disconnect_by_func (
browser, colorful_tabs_browser_add_tab_cb, extension);
g_signal_handlers_disconnect_by_func (
extension, colorful_tabs_deactivate_cb, browser);
i = 0;
while ((view = midori_browser_get_nth_tab (browser, i++)))
{
GtkWidget* label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
gtk_event_box_set_visible_window (GTK_EVENT_BOX (label), FALSE);
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, NULL);
gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (label))),
(GtkCallback) colorful_tabs_modify_fg,
NULL);
g_signal_handlers_disconnect_by_func (
view, colorful_tabs_view_notify_uri_cb, extension);
}
}
示例12: make_cancel_button
void make_cancel_button(GtkWidget *fixed_base)
{
GtkWidget *fixed;
GtkWidget *event_box;
GtkWidget *label;
fixed = fixed_base;
label = gtk_label_new(cancel_text);
gtk_widget_set_size_request(label, cancel_label_width, cancel_label_height);
gtk_widget_show(label);
GdkColor white = {0, 65535, 65535, 65535};
GtkRcStyle *rc_style = gtk_rc_style_new ();
rc_style->fg[GTK_STATE_NORMAL] = white;
rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG;
gtk_widget_modify_style(label, rc_style);
gtk_rc_style_unref(rc_style);
event_box = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(event_box), label);
gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
gtk_widget_show(event_box);
g_signal_connect(G_OBJECT(event_box), "enter_notify_event",
G_CALLBACK(cancel_enter), NULL);
g_signal_connect(G_OBJECT(event_box), "leave_notify_event",
G_CALLBACK(cancel_leave), NULL);
g_signal_connect(G_OBJECT(event_box), "button_press_event",
G_CALLBACK(cancel_press), NULL);
gtk_widget_show(event_box);
gtk_fixed_put(GTK_FIXED(fixed), event_box, cancel_label_pos_x, cancel_label_pos_y);
}
示例13: g_object_new
// Public functions
GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags)
{
GtkDarktableIcon *icon;
icon = g_object_new(dtgtk_icon_get_type(), NULL);
gtk_event_box_set_visible_window(GTK_EVENT_BOX(icon), FALSE);
icon->icon = paint;
icon->icon_flags = paintflags;
return (GtkWidget *)icon;
}
示例14: windowck_new
static WindowckPlugin * windowck_new(XfcePanelPlugin *plugin)
{
WindowckPlugin *wckp;
GtkOrientation orientation;
GtkWidget *label;
/* allocate memory for the plugin structure */
wckp = g_slice_new0 (WindowckPlugin);
/* pointer to plugin */
wckp->plugin = plugin;
/* read the user settings */
windowck_read(wckp);
/* get the current orientation */
orientation = xfce_panel_plugin_get_orientation(plugin);
/* not needed for shrink mode */
if (!wckp->prefs->size_mode == SHRINK)
xfce_panel_plugin_set_shrink (plugin, TRUE);
/* create some panel widgets */
wckp->ebox = gtk_event_box_new();
gtk_event_box_set_visible_window(GTK_EVENT_BOX(wckp->ebox), FALSE);
gtk_widget_set_name(wckp->ebox, "XfceWindowckPlugin");
wckp->alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
wckp->hvbox = xfce_hvbox_new(orientation, FALSE, 2);
/* some wckp widgets */
label = gtk_label_new("");
wckp->title = GTK_LABEL (label);
create_icon (wckp);
gtk_box_pack_start (GTK_BOX(wckp->hvbox), label, TRUE, TRUE, 0);
if (wckp->prefs->icon_on_right)
{
gtk_box_reorder_child (GTK_BOX (wckp->hvbox), GTK_WIDGET(wckp->icon->eventbox), 1);
}
gtk_container_add(GTK_CONTAINER(wckp->alignment), GTK_WIDGET(wckp->hvbox));
gtk_container_add(GTK_CONTAINER(wckp->ebox), wckp->alignment);
/* show widgets */
gtk_widget_show(wckp->ebox);
gtk_widget_show(wckp->alignment);
gtk_widget_show(wckp->hvbox);
gtk_widget_show(label);
return wckp;
}
示例15: mb_panel_applet_create
G_MODULE_EXPORT GtkWidget *
mb_panel_applet_create (const char *id, GtkOrientation orientation)
{
GtkWidget *box, *image;
box = gtk_event_box_new ();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (box), FALSE);
gtk_event_box_set_above_child (GTK_EVENT_BOX (box), TRUE);
gtk_widget_set_name (box, "MatchboxPanelKeyboard");
image = mb_panel_scaling_image2_new (orientation, "matchbox-keyboard");
gtk_container_add (GTK_CONTAINER (box), image);
g_signal_connect (box, "button-release-event", G_CALLBACK (on_toggled), NULL);
gtk_widget_show_all (box);
return box;
}