本文整理汇总了C++中GTK_BOX函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_BOX函数的具体用法?C++ GTK_BOX怎么用?C++ GTK_BOX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_BOX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mail_config_remote_backend_insert_widgets
static void
mail_config_remote_backend_insert_widgets (EMailConfigServiceBackend *backend,
GtkBox *parent)
{
EMailConfigRemoteBackend *remote_backend;
CamelProvider *provider;
CamelSettings *settings;
ESource *source;
ESourceBackend *extension;
EMailConfigServicePage *page;
EMailConfigServicePageClass *class;
GtkLabel *label;
GtkWidget *widget;
GtkWidget *container;
const gchar *backend_name;
const gchar *extension_name;
const gchar *text;
gchar *markup;
remote_backend = E_MAIL_CONFIG_REMOTE_BACKEND (backend);
page = e_mail_config_service_backend_get_page (backend);
source = e_mail_config_service_backend_get_source (backend);
settings = e_mail_config_service_backend_get_settings (backend);
class = E_MAIL_CONFIG_SERVICE_PAGE_GET_CLASS (page);
extension_name = class->extension_name;
extension = e_source_get_extension (source, extension_name);
backend_name = e_source_backend_get_backend_name (extension);
text = _("Configuration");
markup = g_markup_printf_escaped ("<b>%s</b>", text);
widget = gtk_label_new (markup);
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
g_free (markup);
widget = gtk_grid_new ();
gtk_widget_set_margin_left (widget, 12);
gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
container = widget;
widget = gtk_label_new_with_mnemonic (_("_Server:"));
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
gtk_widget_show (widget);
label = GTK_LABEL (widget);
widget = gtk_entry_new ();
gtk_widget_set_hexpand (widget, TRUE);
gtk_label_set_mnemonic_widget (label, widget);
gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
remote_backend->host_entry = widget; /* do not reference */
gtk_widget_show (widget);
widget = gtk_label_new_with_mnemonic (_("_Port:"));
gtk_grid_attach (GTK_GRID (container), widget, 2, 0, 1, 1);
gtk_widget_show (widget);
label = GTK_LABEL (widget);
widget = e_port_entry_new ();
gtk_label_set_mnemonic_widget (label, widget);
gtk_grid_attach (GTK_GRID (container), widget, 3, 0, 1, 1);
remote_backend->port_entry = widget; /* do not reference */
gtk_widget_show (widget);
widget = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_BUTTON);
g_object_set (G_OBJECT (widget),
"visible", FALSE,
"has-tooltip", TRUE,
"tooltip-text", _("Port number is not valid"),
NULL);
gtk_grid_attach (GTK_GRID (container), widget, 4, 0, 1, 1);
remote_backend->port_error_image = widget; /* do not reference */
widget = gtk_label_new_with_mnemonic (_("User_name:"));
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
gtk_widget_show (widget);
label = GTK_LABEL (widget);
widget = gtk_entry_new ();
gtk_widget_set_hexpand (widget, TRUE);
gtk_label_set_mnemonic_widget (label, widget);
gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 4, 1);
remote_backend->user_entry = widget; /* do not reference */
gtk_widget_show (widget);
text = _("Security");
markup = g_markup_printf_escaped ("<b>%s</b>", text);
widget = gtk_label_new (markup);
//.........这里部分代码省略.........
示例2: prefsbox_open
void
prefsbox_open (void)
{
GtkWidget *notebook;
GtkWidget *grid;
GtkWidget *controls_list;
GtkWidget *label;
GtkCellRenderer *renderer;
GtkListStore *model;
GtkTreeIter iter;
gint i;
if (prefsbox != NULL) {
gtk_window_present (GTK_WINDOW (prefsbox));
return;
}
prefsbox = gtk_dialog_new_with_buttons (_("Four-in-a-Row Preferences"),
GTK_WINDOW (app),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE,
GTK_RESPONSE_ACCEPT, NULL);
gtk_container_set_border_width (GTK_CONTAINER (prefsbox), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (prefsbox))),
2);
g_signal_connect (G_OBJECT (prefsbox), "destroy",
G_CALLBACK (gtk_widget_destroyed), &prefsbox);
notebook = gtk_notebook_new ();
gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (prefsbox))), notebook, TRUE, TRUE, 0);
/* game tab */
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
label = gtk_label_new (_("Game"));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), grid, label);
label = gtk_label_new (_("Player One:"));
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
combobox1 = gtk_combo_box_new ();
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox1), renderer, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox1), renderer, "text", 0);
model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
gtk_combo_box_set_model (GTK_COMBO_BOX (combobox1), GTK_TREE_MODEL (model));
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Human"), 1, LEVEL_HUMAN, -1);
if (p.level[PLAYER1] == LEVEL_HUMAN)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level one"), 1, LEVEL_WEAK, -1);
if (p.level[PLAYER1] == LEVEL_WEAK)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level two"), 1, LEVEL_MEDIUM, -1);
if (p.level[PLAYER1] == LEVEL_MEDIUM)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level three"), 1, LEVEL_STRONG, -1);
if (p.level[PLAYER1] == LEVEL_STRONG)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
g_signal_connect (combobox1, "changed", G_CALLBACK (on_select_player1), NULL);
gtk_grid_attach (GTK_GRID (grid), combobox1, 1, 0, 1, 1);
label = gtk_label_new (_("Player Two:"));
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
combobox2 = gtk_combo_box_new ();
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox2), renderer, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox2), renderer, "text", 0);
model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
gtk_combo_box_set_model (GTK_COMBO_BOX (combobox2), GTK_TREE_MODEL (model));
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Human"), 1, LEVEL_HUMAN, -1);
if (p.level[PLAYER2] == LEVEL_HUMAN)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level one"), 1, LEVEL_WEAK, -1);
if (p.level[PLAYER2] == LEVEL_WEAK)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level two"), 1, LEVEL_MEDIUM, -1);
if (p.level[PLAYER2] == LEVEL_MEDIUM)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level three"), 1, LEVEL_STRONG, -1);
if (p.level[PLAYER2] == LEVEL_STRONG)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
g_signal_connect (combobox2, "changed", G_CALLBACK (on_select_player2), NULL);
gtk_grid_attach (GTK_GRID (grid), combobox2, 1, 1, 1, 1);
//.........这里部分代码省略.........
示例3: gb_box_set_size
/* This updates the box size to the given value, adding placeholders or
deleting widgets as necessary. */
void
gb_box_set_size (GtkWidget * widget, gint size)
{
GtkWidget *new_child;
gint current_size = g_list_length (GTK_BOX (widget)->children);
gint i;
if (current_size < size)
{
/* This avoids any problems with redrawing the selection. */
editor_clear_selection (NULL);
for (i = 0; i < size - current_size; i++)
{
if (GTK_IS_BUTTON_BOX (widget))
{
new_child = gb_widget_new ("GtkButton", widget);
GTK_WIDGET_SET_FLAGS (new_child, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (widget), new_child, TRUE, TRUE, 0);
tree_add_widget (new_child);
}
else
{
new_child = editor_new_placeholder ();
gtk_box_pack_start (GTK_BOX (widget), new_child, TRUE, TRUE, 0);
}
}
}
else if (current_size > size)
{
GList *children, *elem;
GtkWidget *child;
gchar *error = NULL;
/* Get a list of children in the order they appear in the box, start at
the end and move backwards until we find a widget that can be
destroyed. If we can't find any, show a message box. */
children = gtk_container_get_children (GTK_CONTAINER (widget));
elem = g_list_last (children);
while (elem)
{
child = elem->data;
error = editor_can_delete_widget (child);
if (!error)
{
gtk_container_remove (GTK_CONTAINER (widget), child);
current_size--;
if (current_size == size)
break;
}
elem = elem->prev;
}
g_list_free (children);
if (current_size > size)
{
glade_util_show_message_box (error ? error
: _("Can't delete any children."),
widget);
}
}
}
示例4: uninstall_ui
/* Run a GUI to select and uninstall products */
int uninstall_ui(int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *widget;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *button;
GtkWidget *label;
const char *product_name;
product_t *product;
product_info_t *product_info;
product_component_t *component;
component_list *component_list, *addon_list;
char text[1024];
gtk_init(&argc,&argv);
/* Initialize Glade */
glade_init();
uninstall_glade = glade_xml_new(DATADIR "/uninstall.glade", "loki_uninstall");
/* Add all signal handlers defined in glade file */
glade_xml_signal_autoconnect(uninstall_glade);
/* Make sure the window is visible */
widget = glade_xml_get_widget(uninstall_glade, "uninstall_button");
if ( widget ) {
gtk_button_set_sensitive(widget, FALSE);
}
window = glade_xml_get_widget(uninstall_glade, "loki_uninstall");
gtk_widget_realize(window);
while( gtk_events_pending() ) {
gtk_main_iteration();
}
/* Add emergency signal handlers */
signal(SIGHUP, main_signal_abort);
signal(SIGINT, main_signal_abort);
signal(SIGQUIT, main_signal_abort);
signal(SIGTERM, main_signal_abort);
/* Fill in the list of products and components */
widget = glade_xml_get_widget(uninstall_glade, "uninstall_vbox");
if ( ! widget ) {
fprintf(stderr, _("No uninstall_vbox in glade file!\n"));
return(-1);
}
gtk_container_foreach(GTK_CONTAINER(widget), empty_container, widget);
for ( product_name=loki_getfirstproduct();
product_name;
product_name=loki_getnextproduct() ) {
/* See if we can open the product */
product = loki_openproduct(product_name);
if ( ! product ) {
continue;
}
/* See if we have permissions to remove the product */
product_info = loki_getinfo_product(product);
if ( ! check_permissions(product_info, 0) ) {
loki_closeproduct(product);
continue;
}
/* Add the product and components to our list */
strncpy(text, product_info->description, sizeof(text));
frame = gtk_frame_new(text);
gtk_container_set_border_width(GTK_CONTAINER(frame), 4);
gtk_box_pack_start(GTK_BOX(widget), frame, FALSE, TRUE, 0);
gtk_widget_show(frame);
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show(vbox);
component = loki_getdefault_component(product);
component_list = NULL;
if ( component ) {
component_list = create_component_list(product, product_info,
component);
strncpy(text, _("Complete uninstall"), sizeof(text));
button = gtk_check_button_new_with_label(text);
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(button), "toggled",
GTK_SIGNAL_FUNC(component_toggled_slot),
(gpointer)component_list);
gtk_object_set_data(GTK_OBJECT(button), "data",
(gpointer)component_list);
gtk_widget_show(button);
}
for ( component = loki_getfirst_component(product);
component;
component = loki_getnext_component(component) ) {
if ( loki_isdefault_component(component) ) {
continue;
}
addon_list = create_component_list(product, product_info,
component);
strncpy(text, loki_getname_component(component), sizeof(text));
button = gtk_check_button_new_with_label(text);
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(button), "toggled",
GTK_SIGNAL_FUNC(component_toggled_slot),
//.........这里部分代码省略.........
示例5: main
gint
main (gint argc, gchar * argv[])
{
IconBrowserData *data;
gchar **themes = NULL;
GList *ic, *icat;
GtkListStore *store;
GtkTreeSelection *sel;
GtkTreeViewColumn *col;
GtkCellRenderer *r;
GtkWidget *w, *p, *box, *t;
GOptionEntry entrs[] = {
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &themes, NULL, NULL},
{NULL}
};
data = g_new0 (IconBrowserData, 1);
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
data = g_new0 (IconBrowserData, 1);
/* initialize GTK+ and parse the command line arguments */
gtk_init_with_args (&argc, &argv, _("- Icon browser"), entrs, GETTEXT_PACKAGE, NULL);
/* load icon theme */
if (themes && themes[0])
{
data->theme = gtk_icon_theme_new ();
gtk_icon_theme_set_custom_theme (data->theme, themes[0]);
}
else
data->theme = gtk_icon_theme_get_default ();
/* create interface */
data->win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (data->win), _("Icon browser"));
gtk_window_set_icon_name (GTK_WINDOW (data->win), "gtk-info");
gtk_window_set_default_size (GTK_WINDOW (data->win), 500, 400);
g_signal_connect (G_OBJECT (data->win), "delete-event", G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (data->win), "key-press-event", G_CALLBACK (key_press_cb), NULL);
#if !GTK_CHECK_VERSION(3,0,0)
box = gtk_vbox_new (FALSE, 5);
#else
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
#endif
gtk_container_add (GTK_CONTAINER (data->win), box);
gtk_container_set_border_width (GTK_CONTAINER (data->win), 5);
/* create icon info box */
#if !GTK_CHECK_VERSION(3,0,0)
t = gtk_table_new (3, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (t), 5);
gtk_table_set_row_spacings (GTK_TABLE (t), 5);
#else
t = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (t), 5);
gtk_grid_set_column_spacing (GTK_GRID (t), 5);
#endif
gtk_box_pack_start (GTK_BOX (box), t, FALSE, FALSE, 2);
data->image = gtk_image_new_from_stock ("gtk-missing-image", GTK_ICON_SIZE_DIALOG);
#if !GTK_CHECK_VERSION(3,0,0)
gtk_table_attach (GTK_TABLE (t), data->image, 0, 1, 0, 3, GTK_FILL, 0, 0, 0);
#else
gtk_grid_attach (GTK_GRID (t), data->image, 0, 0, 1, 3);
#endif
w = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (w), _("<b>Name:</b>"));
gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5);
#if !GTK_CHECK_VERSION(3,0,0)
gtk_table_attach (GTK_TABLE (t), w, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
#else
gtk_grid_attach (GTK_GRID (t), w, 1, 0, 1, 1);
#endif
data->lname = gtk_label_new (NULL);
gtk_label_set_selectable (GTK_LABEL (data->lname), TRUE);
gtk_misc_set_alignment (GTK_MISC (data->lname), 0, 0.5);
#if !GTK_CHECK_VERSION(3,0,0)
gtk_table_attach (GTK_TABLE (t), data->lname, 2, 3, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
#else
gtk_grid_attach (GTK_GRID (t), data->lname, 2, 0, 1, 1);
gtk_widget_set_hexpand (data->lname, TRUE);
#endif
w = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (w), _("<b>Sizes:</b>"));
gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5);
#if !GTK_CHECK_VERSION(3,0,0)
gtk_table_attach (GTK_TABLE (t), w, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
#else
gtk_grid_attach (GTK_GRID (t), w, 1, 1, 1, 1);
#endif
//.........这里部分代码省略.........
示例6: gtk_accel_group_new
static GtkWidget *create_window(void)
{
GtkWidget *startwin;
GtkWidget *hlayout;
GtkWidget *banner;
GtkWidget *vlayout;
GtkWidget *tabs;
GtkWidget *configvlayout;
GtkWidget *configlayout;
GtkWidget *fullscreencheck;
GtkWidget *vmode3dlabel;
GtkWidget *inputdevlabel;
GtkWidget *inputmousecheck;
GtkWidget *inputjoycheck;
GtkWidget *vmode3dcombo;
GtkWidget *alwaysshowcheck;
GtkWidget *configtab;
GtkWidget *gamevlayout;
GtkWidget *gamelabel;
GtkWidget *gamescroll;
GtkWidget *gamelist;
GtkWidget *gametab;
GtkWidget *messagesscroll;
GtkWidget *messagestext;
GtkWidget *messagestab;
GtkWidget *buttons;
GtkWidget *cancelbutton;
GtkWidget *cancelbuttonalign;
GtkWidget *cancelbuttonlayout;
GtkWidget *cancelbuttonicon;
GtkWidget *cancelbuttonlabel;
GtkWidget *startbutton;
GtkWidget *startbuttonalign;
GtkWidget *startbuttonlayout;
GtkWidget *startbuttonicon;
GtkWidget *startbuttonlabel;
GtkAccelGroup *accel_group;
accel_group = gtk_accel_group_new ();
// Basic window
startwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (startwin), apptitle); // NOTE: use global app title
gtk_window_set_position (GTK_WINDOW (startwin), GTK_WIN_POS_CENTER);
gtk_window_set_resizable (GTK_WINDOW (startwin), FALSE);
gtk_window_set_type_hint (GTK_WINDOW (startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
// Horizontal layout of banner and controls
hlayout = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hlayout);
gtk_container_add (GTK_CONTAINER (startwin), hlayout);
// Banner
{
GdkPixbuf *pixbuf = load_banner();
banner = gtk_image_new_from_pixbuf(pixbuf);
g_object_unref((gpointer)pixbuf);
}
gtk_widget_show (banner);
gtk_box_pack_start (GTK_BOX (hlayout), banner, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (banner), 0.5, 0);
// Vertical layout of tab control and start+cancel buttons
vlayout = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vlayout);
gtk_box_pack_start (GTK_BOX (hlayout), vlayout, TRUE, TRUE, 0);
// Tab control
tabs = gtk_notebook_new ();
gtk_widget_show (tabs);
gtk_box_pack_start (GTK_BOX (vlayout), tabs, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (tabs), 4);
// Vertical layout of config page main body
configvlayout = gtk_vbox_new (FALSE, 0);
gtk_widget_show (configvlayout);
gtk_container_add (GTK_CONTAINER (tabs), configvlayout);
// Fixed-position layout of config page controls
configlayout = gtk_fixed_new ();
gtk_widget_show (configlayout);
gtk_box_pack_start (GTK_BOX (configvlayout), configlayout, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (configlayout), 6);
// Fullscreen checkbox
fullscreencheck = gtk_check_button_new_with_mnemonic ("_Fullscreen");
gtk_widget_show (fullscreencheck);
gtk_fixed_put (GTK_FIXED (configlayout), fullscreencheck, 248, 0);
gtk_widget_set_size_request (fullscreencheck, 85, 29);
gtk_widget_add_accelerator (fullscreencheck, "grab_focus", accel_group,
GDK_F, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// 3D video mode label
vmode3dlabel = gtk_label_new_with_mnemonic ("_Video mode:");
gtk_widget_show (vmode3dlabel);
gtk_fixed_put (GTK_FIXED (configlayout), vmode3dlabel, 0, 0);
gtk_widget_set_size_request (vmode3dlabel, 88, 29);
gtk_misc_set_alignment (GTK_MISC (vmode3dlabel), 0, 0.5);
//.........这里部分代码省略.........
示例7: create_window
static GtkWidget *
create_window (void)
{
GtkWidget *window;
GtkWidget *hbox, *vbox, *widget;
GtkWidget *swindow, *frame, *expander;
GtkWidget *paper_cntl, *items_cntl;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
hbox = gtk_hbox_new (FALSE, 2);
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
frame = gtk_frame_new ("SpreadTable");
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show (swindow);
gtk_container_add (GTK_CONTAINER (frame), swindow);
paper = egg_spread_table_new (GTK_ORIENTATION_VERTICAL, INITIAL_LINES);
egg_spread_table_set_vertical_spacing (EGG_SPREAD_TABLE (paper), INITIAL_VSPACING);
egg_spread_table_set_horizontal_spacing (EGG_SPREAD_TABLE (paper), INITIAL_HSPACING);
gtk_widget_show (paper);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swindow), paper);
/* Add SpreadTable test control frame */
expander = gtk_expander_new ("SpreadTable controls");
gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
paper_cntl = gtk_vbox_new (FALSE, 2);
gtk_widget_show (paper_cntl);
gtk_widget_show (expander);
gtk_container_add (GTK_CONTAINER (expander), paper_cntl);
gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);
/* Add Orientation control */
widget = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1);
gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the spread_table orientation");
gtk_box_pack_start (GTK_BOX (paper_cntl), widget, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (orientation_changed), paper);
/* Add horizontal/vertical spacing controls */
hbox = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox);
widget = gtk_label_new ("H Spacing");
gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
widget = gtk_spin_button_new_with_range (0, 30, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_HSPACING);
gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the horizontal spacing between children");
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL));
g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL));
gtk_box_pack_start (GTK_BOX (paper_cntl), hbox, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox);
widget = gtk_label_new ("V Spacing");
gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
widget = gtk_spin_button_new_with_range (0, 30, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_VSPACING);
gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the vertical spacing between children");
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL));
g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL));
//.........这里部分代码省略.........
示例8: anjuta_save_prompt_init
static void
anjuta_save_prompt_init(AnjutaSavePrompt *obj)
{
GtkWidget *vbox;
GtkWidget *treeview;
GtkListStore *store;
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
GtkWidget *label;
GtkWidget *scrolledwindow;
obj->priv = g_new0(AnjutaSavePromptPrivate, 1);
gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (obj), "Uninitialized");
gtk_window_set_resizable (GTK_WINDOW (obj), TRUE);
gtk_window_set_default_size (GTK_WINDOW (obj), 400, 300);
vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (obj))),
vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
label = gtk_label_new (_("Select the items to save:"));
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_misc_set_padding (GTK_MISC (label), 10, -1);
gtk_misc_set_alignment (GTK_MISC (label), 0, -1);
gtk_widget_show (label);
store = gtk_list_store_new (N_COLS, G_TYPE_BOOLEAN,
G_TYPE_STRING, G_TYPE_POINTER,
G_TYPE_POINTER, G_TYPE_POINTER);
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), scrolledwindow, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), 10);
gtk_widget_show (scrolledwindow);
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
g_object_unref (store);
gtk_container_add (GTK_CONTAINER (scrolledwindow), treeview);
gtk_widget_show (treeview);
label = gtk_label_new (_("If you do not save, all your changes will be lost."));
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_misc_set_padding (GTK_MISC (label), 10, -1);
gtk_misc_set_alignment (GTK_MISC (label), 0, -1);
gtk_widget_show (label);
renderer = gtk_cell_renderer_toggle_new ();
col = gtk_tree_view_column_new_with_attributes (_("Save"),
renderer,
"active", COL_SAVE_ENABLE,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), col);
renderer = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Item"),
renderer,
"markup", COL_LABEL,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), col);
gtk_dialog_add_buttons (GTK_DIALOG (obj), _("_Discard changes"),
ANJUTA_SAVE_PROMPT_RESPONSE_DISCARD,
GTK_STOCK_CANCEL,
ANJUTA_SAVE_PROMPT_RESPONSE_CANCEL,
GTK_STOCK_SAVE,
ANJUTA_SAVE_PROMPT_RESPONSE_SAVE_CLOSE,
NULL);
/* TRUE is the default and Gtk warns that this has no effect */
/* gtk_dialog_set_has_separator (GTK_DIALOG (obj), TRUE); */
gtk_dialog_set_default_response (GTK_DIALOG (obj),
ANJUTA_SAVE_PROMPT_RESPONSE_SAVE_CLOSE);
g_signal_connect (obj, "response",
G_CALLBACK (on_dialog_response),
obj);
obj->priv->treeview = treeview;
}
示例9: l_xrnngvn_p
int l_xrnngvn_p(class l_xrnngvn_rek *rek_poi,GtkWidget *wpredok)
{
class l_xrnngvn_p_data data;
char strsql[512];
data.rk=rek_poi;
data.window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);
sprintf(strsql,"%s %s",name_system,gettext("Поиск"));
gtk_window_set_title(GTK_WINDOW(data.window),strsql);
gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(l_xrnngvn_p_key_press),&data);
if(wpredok != NULL)
{
gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
//Удерживать окно над породившем его окном всегда
gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
//Закрыть окно если окно предок удалено
gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
}
GtkWidget *vbox = gtk_vbox_new (FALSE,1);
GtkWidget *hbox[KOLENTER];
for(int i=0; i < KOLENTER; i++)
hbox[i] = gtk_hbox_new (FALSE,1);
GtkWidget *hboxknop = gtk_hbox_new (FALSE,1);
gtk_container_add (GTK_CONTAINER (data.window), vbox);
for(int i=0; i < KOLENTER; i++)
gtk_container_add (GTK_CONTAINER (vbox), hbox[i]);
gtk_container_add (GTK_CONTAINER (vbox), hboxknop);
GtkWidget *label=gtk_label_new(gettext("Код"));
gtk_box_pack_start (GTK_BOX (hbox[E_KOD]), label, FALSE, FALSE,1);
data.entry[E_KOD] = gtk_entry_new_with_max_length (10);
gtk_box_pack_start (GTK_BOX (hbox[E_KOD]), data.entry[E_KOD], TRUE, TRUE,1);
gtk_signal_connect(GTK_OBJECT (data.entry[E_KOD]), "activate",GTK_SIGNAL_FUNC(l_xrnngvn_p_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_KOD]),data.rk->kod.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_KOD]),(gpointer)E_KOD);
label=gtk_label_new(gettext("Наименование"));
gtk_box_pack_start (GTK_BOX (hbox[E_NAIM]), label, FALSE, FALSE,1);
data.entry[E_NAIM] = gtk_entry_new_with_max_length (80);
gtk_box_pack_start (GTK_BOX (hbox[E_NAIM]), data.entry[E_NAIM], TRUE, TRUE,1);
gtk_signal_connect(GTK_OBJECT (data.entry[E_NAIM]), "activate",GTK_SIGNAL_FUNC(l_xrnngvn_p_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_NAIM]),data.rk->naim.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_NAIM]),(gpointer)E_NAIM);
GtkTooltips *tooltips[KOL_FK];
sprintf(strsql,"F2 %s",gettext("Поиск"));
data.knopka[FK2]=gtk_button_new_with_label(strsql);
tooltips[FK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK2],data.knopka[FK2],gettext("Начать поиск нужных записей"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK2]),"clicked",GTK_SIGNAL_FUNC(l_xrnngvn_p_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK2]),(gpointer)FK2);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK2], TRUE, TRUE,1);
sprintf(strsql,"F4 %s",gettext("Очистить"));
data.knopka[FK4]=gtk_button_new_with_label(strsql);
tooltips[FK4]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK4],data.knopka[FK4],gettext("Очистить меню от введеноой информации"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK4]),"clicked",GTK_SIGNAL_FUNC(l_xrnngvn_p_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK4]),(gpointer)FK4);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK4], TRUE, TRUE,1);
sprintf(strsql,"F10 %s",gettext("Выход"));
data.knopka[FK10]=gtk_button_new_with_label(strsql);
tooltips[FK10]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK10],data.knopka[FK10],gettext("Поиск не выполнять"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK10]),"clicked",GTK_SIGNAL_FUNC(l_xrnngvn_p_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK10]),(gpointer)FK10);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK10], TRUE, TRUE,1);
gtk_widget_grab_focus(data.entry[0]);
gtk_widget_show_all (data.window);
gtk_main();
if(wpredok != NULL)
gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));
return(data.voz);
}
示例10: main
int main(int argc, char *argv[]) {
gtk_init(&argc, &argv);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_window_set_title(GTK_WINDOW(window), "Label Demo");
GtkWidget *hbox = gtk_hbox_new(FALSE, 5);
gtk_container_add(GTK_CONTAINER(window), hbox);
gtk_widget_show(hbox);
GtkWidget *vbox = gtk_vbox_new(FALSE, 5);
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
gtk_widget_show(vbox);
GtkWidget *frame;
GtkWidget *label;
frame = gtk_frame_new("Normal Label");
label = gtk_label_new("This is a normal label.");
gtk_container_add(GTK_CONTAINER(frame), label);
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new("Multi-line Label");
label = gtk_label_new("This is a Multi-line \n label.");
gtk_container_add(GTK_CONTAINER(frame), label);
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new("Left Justed Label");
label = gtk_label_new("Left?.\nThis is the second line.");
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_container_add(GTK_CONTAINER(frame), label);
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new("Right Justed Label");
label = gtk_label_new("Right?.\nThis is the second line.");
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
gtk_container_add(GTK_CONTAINER(frame), label);
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
vbox = gtk_vbox_new(FALSE, 5);
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
frame = gtk_frame_new("Line wrapped label");
label = gtk_label_new("This is an example of a line-warpped label. It should not be taking up the entire width allocated to it, but automatically wraps the words to fit.");
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_container_add(GTK_CONTAINER(frame), label);
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new("Filled, wrapped label");
label = gtk_label_new("This is an example of a line-warpped label. It should not be taking up the entire width allocated to it, but automatically wraps the words to fit.");
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_FILL);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_container_add(GTK_CONTAINER(frame), label);
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new("Filled, wrapped label");
label = gtk_label_new("This is an example of a line-warpped \nlabel. It should not be taking up the entire width allocated to it, but automatically wraps the words to fit.");
gtk_label_set_pattern(GTK_LABEL(label), "_ _ ");
gtk_container_add(GTK_CONTAINER(frame), label);
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
示例11: create_2d_table_editor_group
G_MODULE_EXPORT gboolean create_2d_table_editor_group(GtkWidget *button)
{
GladeXML *main_xml = NULL;
GladeXML *xml = NULL;
GtkWidget *widget = NULL;
GtkWidget *window = NULL;
GtkWidget *notebook = NULL;
GtkWidget *curve = NULL;
GtkWidget *x_parent = NULL;
GtkWidget *y_parent = NULL;
GtkWidget *x_table = NULL;
GtkWidget *y_table = NULL;
GtkWidget *label = NULL;
GtkWidget *entry = NULL;
GtkWidget *dummy = NULL;
GtkWidget *gauge = NULL;
GtkWidget *parent = NULL;
GtkWidget *curve_parent = NULL;
CurveData *cdata = NULL;
GArray *x_entries = NULL;
GArray *y_entries = NULL;
GList *widget_list = NULL;
GList *curve_list = NULL;
GList *gauge_list = NULL;
gchar * tmpbuf = NULL;
gchar * filename = NULL;
gchar **vector = NULL;
GList ***ecu_widgets = NULL;
gint num_tabs = 0;
gint x_mult = 0;
gint y_mult = 0;
gint page = 0;
gint offset = 0;
gint i = 0;
gint j = 0;
gfloat tmpf = 0.0;
guint32 id = 0;
gint rows = 0;
gint table_num = 0;
Firmware_Details *firmware = NULL;
firmware = DATA_GET(global_data,"firmware");
ecu_widgets = DATA_GET(global_data,"ecu_widgets");
main_xml = (GladeXML *)DATA_GET(global_data,"main_xml");
if (!main_xml)
return FALSE;
xml = glade_xml_new(main_xml->filename,"table_editor_window",NULL);
window = glade_xml_get_widget(xml,"table_editor_window");
glade_xml_signal_autoconnect(xml);
g_signal_connect(G_OBJECT(window),"destroy_event",
G_CALLBACK(close_2d_editor),NULL);
g_signal_connect(G_OBJECT(window),"delete_event",
G_CALLBACK(close_2d_editor),NULL);
gtk_window_set_title(GTK_WINDOW(window),_("2D Table Group Editor"));
gtk_window_resize(GTK_WINDOW(window),800,530);
widget = glade_xml_get_widget(xml,"2d_close_button");
g_signal_connect_swapped(G_OBJECT(widget),"clicked",
G_CALLBACK(close_2d_editor),window);
widget = glade_xml_get_widget(xml,"get_data_button");
OBJ_SET(widget,"handler",GINT_TO_POINTER(READ_VE_CONST));
OBJ_SET_FULL(widget,"bind_to_list",g_strdup("get_data_buttons"),g_free);
bind_to_lists_f(widget,"get_data_buttons");
widget_list = g_list_prepend(widget_list,(gpointer)widget);
widget = glade_xml_get_widget(xml,"burn_data_button");
OBJ_SET(widget,"handler",GINT_TO_POINTER(BURN_MS_FLASH));
OBJ_SET_FULL(widget,"bind_to_list",g_strdup("burners"),g_free);
bind_to_lists_f(widget,"burners");
widget_list = g_list_prepend(widget_list,(gpointer)widget);
widget = glade_xml_get_widget(xml,"curve_editor_menuitem");
gtk_widget_set_sensitive(GTK_WIDGET(widget), FALSE);
widget = glade_xml_get_widget(xml,"close_menuitem");
OBJ_SET(widget,"window",(gpointer)window);
widget = glade_xml_get_widget(xml,"te_layout_hbox1");
gtk_widget_destroy(widget);
widget = glade_xml_get_widget(xml,"te_layout_vbox");
tmpbuf = OBJ_GET(button,"te_tables");
vector = parse_keys_f(tmpbuf,&num_tabs,",");
notebook = gtk_notebook_new();
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),GTK_POS_LEFT);
gtk_box_pack_start(GTK_BOX(widget),notebook,TRUE,TRUE,0);
for (j = 0;j < num_tabs;j++)
{
table_num = (gint)strtod(vector[j],NULL);
if (table_num >= firmware->total_te_tables)
{
warn_user_f("Requested to create 2D table editor window for an undefined (out of range) table ID");
return FALSE;
}
//.........这里部分代码省略.........
示例12: _camera_import_dialog_new
void _camera_import_dialog_new(_camera_import_dialog_t *data)
{
data->dialog=gtk_dialog_new_with_buttons(_("import images from camera"),NULL,GTK_DIALOG_MODAL,_("cancel"),GTK_RESPONSE_NONE,C_("camera import", "import"),GTK_RESPONSE_ACCEPT,NULL);
GtkWidget *content = gtk_dialog_get_content_area (GTK_DIALOG (data->dialog));
// List - setup store
data->store = gtk_list_store_new (2,GDK_TYPE_PIXBUF,G_TYPE_STRING);
// IMPORT PAGE
data->import.page=gtk_vbox_new(FALSE,5);
gtk_container_set_border_width(GTK_CONTAINER(data->import.page),5);
// Top info
data->import.info=gtk_label_new( _("please wait while prefetching thumbnails of images from camera...") );
gtk_label_set_single_line_mode( GTK_LABEL(data->import.info) , FALSE );
gtk_misc_set_alignment(GTK_MISC(data->import.info), 0.0, 0.0);
gtk_box_pack_start(GTK_BOX(data->import.page),data->import.info,FALSE,FALSE,0);
// jobcode
data->import.jobname=_camera_import_gconf_widget(data,_("jobcode"),"plugins/capture/camera/import/jobcode");
gtk_box_pack_start(GTK_BOX(data->import.page),GTK_WIDGET(data->import.jobname->widget),FALSE,FALSE,0);
// Create the treview with list model data store
data->import.treeview=gtk_scrolled_window_new(NULL,NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(data->import.treeview),GTK_POLICY_NEVER,GTK_POLICY_ALWAYS);
gtk_container_add(GTK_CONTAINER(data->import.treeview), gtk_tree_view_new());
GtkTreeView *treeview=GTK_TREE_VIEW(gtk_bin_get_child(GTK_BIN(data->import.treeview)));
GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new( );
GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes( _("thumbnail") , renderer,"pixbuf",0, (char *)NULL);
gtk_tree_view_append_column( treeview , column);
renderer = gtk_cell_renderer_text_new( );
column = gtk_tree_view_column_new_with_attributes( _("storage file"), renderer, "text", 1, (char *)NULL);
gtk_tree_view_append_column( treeview , column);
gtk_tree_view_column_set_expand( column, TRUE);
GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
gtk_tree_selection_set_mode(selection,GTK_SELECTION_MULTIPLE);
gtk_tree_view_set_model(treeview,GTK_TREE_MODEL(data->store));
gtk_tree_view_set_headers_visible(treeview,FALSE);
gtk_box_pack_start(GTK_BOX(data->import.page),data->import.treeview,TRUE,TRUE,0);
// SETTINGS PAGE
data->settings.page=gtk_vbox_new(FALSE,5);
gtk_container_set_border_width(GTK_CONTAINER(data->settings.page),5);
// general settings
gtk_box_pack_start(GTK_BOX(data->settings.page),dtgtk_label_new(_("general"),DARKTABLE_LABEL_TAB|DARKTABLE_LABEL_ALIGN_RIGHT),FALSE,FALSE,0);
// ignoring of jpegs. hack while we don't handle raw+jpeg in the same directories.
data->settings.general.ignore_jpeg = gtk_check_button_new_with_label (_("ignore JPEG files"));
g_object_set(data->settings.general.ignore_jpeg, "tooltip-text", _("do not load files with an extension of .jpg or .jpeg. this can be useful when there are raw+JPEG in a directory."), NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->settings.general.ignore_jpeg), dt_conf_get_bool("ui_last/import_ignore_jpegs"));
gtk_box_pack_start(GTK_BOX(data->settings.page), data->settings.general.ignore_jpeg, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT(data->settings.general.ignore_jpeg), "clicked",G_CALLBACK (_check_button_callback),data);
GtkWidget *hbox=gtk_hbox_new(FALSE,5);
data->settings.general.date_override=gtk_check_button_new_with_label(_("override today's date"));
gtk_box_pack_start(GTK_BOX(hbox),data->settings.general.date_override,FALSE,FALSE,0);
g_object_set(data->settings.general.date_override,"tooltip-text",_("check this, if you want to override the timestamp used when expanding variables:\n$(YEAR), $(MONTH), $(DAY),\n$(HOUR), $(MINUTE), $(SECONDS)"),(char *)NULL);
data->settings.general.date_entry=gtk_entry_new();
gtk_widget_set_sensitive( data->settings.general.date_entry, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->settings.general.date_override)));
gtk_box_pack_start(GTK_BOX(hbox),data->settings.general.date_entry,TRUE,TRUE,0);
g_signal_connect (G_OBJECT (data->settings.general.date_override), "clicked",G_CALLBACK (_check_button_callback),data);
gtk_box_pack_start(GTK_BOX(data->settings.page),hbox,FALSE,FALSE,0);
// THE NOTEBOOK
data->notebook=gtk_notebook_new();
gtk_notebook_append_page(GTK_NOTEBOOK(data->notebook),data->import.page,gtk_label_new(_("images")));
gtk_notebook_append_page(GTK_NOTEBOOK(data->notebook),data->settings.page,gtk_label_new(_("settings")));
// end
gtk_box_pack_start(GTK_BOX(content),data->notebook,TRUE,TRUE,0);
//gtk_widget_set_size_request(content, DT_PIXEL_APPLY_DPI(400), DT_PIXEL_APPLY_DPI(400));
}
示例13: podzapusl
//.........这里部分代码省略.........
gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);
sprintf(strsql,"%s %s",name_system,gettext("Подтверждение записи"));
gtk_window_set_title (GTK_WINDOW (data.window),strsql);
gtk_container_set_border_width (GTK_CONTAINER (data.window), 5);
gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(podzapusl_v_key_press),&data);
if(wpredok != NULL)
{
gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
//Удерживать окно над породившем его окном всегда
gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
//Закрыть окно если окно предок удалено
gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
}
GtkWidget *label=gtk_label_new(gettext("Подтверждение записи"));
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
GtkWidget *hbox[KOLENTER];
for(int i=0; i < KOLENTER; i++)
hbox[i] = gtk_hbox_new (FALSE, 0);
GtkWidget *hboxradio = gtk_hbox_new (FALSE, 0);
GtkWidget *hboxknop = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (data.window), vbox);
gtk_container_add (GTK_CONTAINER (vbox), label);
for(int i=0; i < KOLENTER; i++)
gtk_container_add (GTK_CONTAINER (vbox), hbox[i]);
gtk_container_add (GTK_CONTAINER (vbox), hboxradio);
gtk_container_add (GTK_CONTAINER (vbox), hboxknop);
sprintf(strsql,"%s",gettext("Дата подтверждения"));
label=gtk_label_new(iceb_u_toutf(strsql));
data.entry[E_DATAP] = gtk_entry_new_with_max_length (10);
gtk_box_pack_start (GTK_BOX (hbox[E_DATAP]), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox[E_DATAP]), data.entry[E_DATAP], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_DATAP]), "activate",GTK_SIGNAL_FUNC(podzapusl_v_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_DATAP]),data.datap.ravno());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_DATAP]),(gpointer)E_DATAP);
label=gtk_label_new(gettext("Количество"));
data.entry[E_KOLIH] = gtk_entry_new_with_max_length (20);
gtk_box_pack_start (GTK_BOX (hbox[E_KOLIH]), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox[E_KOLIH]), data.entry[E_KOLIH], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_KOLIH]), "activate",GTK_SIGNAL_FUNC(podzapusl_v_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_KOLIH]),data.kolih.ravno());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_KOLIH]),(gpointer)E_KOLIH);
GtkTooltips *tooltips[KOL_F_KL];
sprintf(strsql,"F2 %s",gettext("Запись"));
data.knopka[FK2]=gtk_button_new_with_label(strsql);
tooltips[FK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK2],data.knopka[FK2],gettext("Запись введенной в меню информации"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK2]),"clicked",GTK_SIGNAL_FUNC(podzapusl_v_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK2]),(gpointer)FK2);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK2], TRUE, TRUE, 0);
sprintf(strsql,"F4 %s",gettext("Очистить"));
data.knopka[FK4]=gtk_button_new_with_label(strsql);
tooltips[FK4]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK4],data.knopka[FK4],gettext("Очистить меню от введенной информации"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK4]),"clicked",GTK_SIGNAL_FUNC(podzapusl_v_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK4]),(gpointer)FK4);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK4], TRUE, TRUE, 0);
sprintf(strsql,"F10 %s",gettext("Выход"));
data.knopka[FK10]=gtk_button_new_with_label(strsql);
tooltips[FK10]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK10],data.knopka[FK10],gettext("Завершение работы в этом окне"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK10]),"clicked",GTK_SIGNAL_FUNC(podzapusl_v_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK10]),(gpointer)FK10);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK10], TRUE, TRUE, 0);
gtk_widget_grab_focus(data.entry[0]);
gtk_widget_show_all (data.window);
gtk_main();
if(wpredok != NULL)
gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));
return(data.voz);
}
示例14: gtk_window_new
GtkWidget *create_input_window()
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *hbox1, *hbox2, *hbox3;
GtkWidget *label, *label2;
GtkWidget *scrollwin;
GtkWidget *text_view;
GtkWidget *button, *button2;
GtkWidget *progress_bar;
/* window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Typer");
gtk_window_set_default_size(GTK_WINDOW(window), 800, 400);
// gtk_window_set_deletable(GTK_WINDOW(window), FALSE);
gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_container_border_width(GTK_CONTAINER(window), 10);
g_signal_connect(
GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL);
vbox = gtk_vbox_new(FALSE, 10);
hbox1 = gtk_hbox_new(FALSE, 10);
label = gtk_label_new("Text:");
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox1,
FALSE, FALSE, 0);
/* center text view */
text_view = gtk_text_view_new();
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text_view), GTK_WRAP_CHAR);
input_text_buffer_origin =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view));
g_object_ref(input_text_buffer_origin);
scrollwin = gtk_scrolled_window_new(
NULL,
gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(text_view)));
gtk_scrolled_window_set_policy(
GTK_SCROLLED_WINDOW(scrollwin),
GTK_POLICY_NEVER,
GTK_POLICY_ALWAYS);
gtk_scrolled_window_set_shadow_type(
GTK_SCROLLED_WINDOW(scrollwin),
GTK_SHADOW_IN);
gtk_container_add(GTK_CONTAINER(scrollwin), text_view);
gtk_box_pack_start(GTK_BOX(vbox), scrollwin,
TRUE, TRUE, 0);
/* progress bar */
label2 = gtk_label_new("Progress: ");
progress_bar = gtk_progress_bar_new();
hbox3 = gtk_hbox_new(FALSE, 10);
gtk_box_pack_start(GTK_BOX(hbox3), label2, FALSE, FALSE, 0);
gtk_box_pack_start(
GTK_BOX(hbox3), progress_bar,
FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox3, FALSE, FALSE, 0);
/* period setting */
GtkWidget *hbox5 = gtk_hbox_new(FALSE, 10);
gtk_box_pack_start(
GTK_BOX(hbox5), gtk_label_new("Period: "),
FALSE, FALSE, 0);
btn_prev_period = gtk_button_new_with_label("<<");
g_signal_connect(
GTK_OBJECT(btn_prev_period), "clicked",
GTK_SIGNAL_FUNC(prev_period), NULL);
gtk_box_pack_start(GTK_BOX(hbox5), btn_prev_period, FALSE, FALSE, 0);
lbl_period = gtk_label_new(NULL);
load_current_period();
gtk_box_pack_start(GTK_BOX(hbox5), lbl_period, FALSE, FALSE, 0);
btn_next_period = gtk_button_new_with_label(">>");
g_signal_connect(
GTK_OBJECT(btn_next_period), "clicked",
GTK_SIGNAL_FUNC(next_period), NULL);
gtk_box_pack_start(GTK_BOX(hbox5), btn_next_period, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox5, FALSE, FALSE, 0);
/* buttons on the BOTTOM */
hbox2 = gtk_hbox_new(FALSE, 10);
button = gtk_button_new_with_label("Send");
gtk_widget_set_size_request(button, 100, 40);
g_signal_connect(
GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(send_button_clicked), NULL);
gtk_box_pack_end(GTK_BOX(hbox2), button, FALSE, FALSE, 0);
button2 = gtk_button_new_with_label("STOP!");
gtk_widget_set_size_request(button2, 100, 40);
g_signal_connect(
GTK_OBJECT(button2), "clicked",
GTK_SIGNAL_FUNC(stop_button_clicked), NULL);
gtk_box_pack_end(GTK_BOX(hbox2), button2, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(window), vbox);
input_send_button = button;
//.........这里部分代码省略.........
示例15: esd_gtk_option_dialog
void
esd_gtk_option_dialog()
{
GtkWidget *window, *label, *accept, *cancel;
GtkWidget *on, *off;
char *option;
window = gtk_dialog_new();
accept = gtk_button_new_with_label(" Accept ");
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area), accept,
TRUE, TRUE, 0);
cancel = gtk_button_new_with_label(" Cancel ");
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area), cancel,
TRUE, TRUE, 0);
label = gtk_label_new(" ESD Record Mode: ");
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), label,
TRUE, TRUE, 5);
on = gtk_radio_button_new_with_label(NULL, "On");
off = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(on)), "Off");
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), on,
TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), off,
TRUE, TRUE, 0);
option = datasrc->save_option(1); /* format will be "esdrecord=%d" */
if (option) temp_rec = option[10] - '0';
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON(on), temp_rec == 1);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON(off), temp_rec == 0);
gtk_signal_connect(GTK_OBJECT(on), "clicked",
GTK_SIGNAL_FUNC(esdrecord), (gpointer) 1);
gtk_signal_connect(GTK_OBJECT(off), "clicked",
GTK_SIGNAL_FUNC(esdrecord), (gpointer) 0);
gtk_signal_connect_object(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTK_OBJECT(window));
gtk_signal_connect(GTK_OBJECT(accept), "clicked",
GTK_SIGNAL_FUNC(esd_save_values), NULL);
gtk_signal_connect_object_after(GTK_OBJECT(accept), "clicked",
GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTK_OBJECT(window));
gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked",
GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTK_OBJECT(window));
GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
GTK_WIDGET_SET_FLAGS(accept, GTK_CAN_DEFAULT);
gtk_widget_grab_default(accept);
gtk_widget_show(on);
gtk_widget_show(off);
gtk_widget_show(accept);
gtk_widget_show(cancel);
gtk_widget_show(label);
gtk_widget_show(window);
}