• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GTK_OBJECT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_OBJECT函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_OBJECT函数的具体用法?C++ GTK_OBJECT怎么用?C++ GTK_OBJECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_OBJECT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: create_romPropDialog

/*********************************************************************************************************
 * dialog creation
 */
int
create_romPropDialog( void )
{
	GtkWidget *button_ok, *button_cancel;
	GtkWidget *frame;
	GtkWidget *table;
	GtkWidget *label;
	GtkWidget *button;

	g_RomPropDialog.dialog = gtk_dialog_new();
	gtk_container_set_border_width( GTK_CONTAINER(g_RomPropDialog.dialog), 10 );
	gtk_window_set_title( GTK_WINDOW(g_RomPropDialog.dialog), tr("Rom Properties") );
	gtk_signal_connect(GTK_OBJECT(g_RomPropDialog.dialog), "delete_event",
				GTK_SIGNAL_FUNC(delete_question_event), (gpointer)NULL );

	// rom info
	frame = gtk_frame_new( tr("Rom Info") );
	gtk_box_pack_start( GTK_BOX(GTK_DIALOG(g_RomPropDialog.dialog)->vbox), frame, TRUE, TRUE, 0 );

	table = gtk_table_new( 7, 3, FALSE );
	gtk_container_set_border_width( GTK_CONTAINER(table), 10 );
	gtk_table_set_col_spacings( GTK_TABLE(table), 10 );
	gtk_container_add( GTK_CONTAINER(frame), table );

	label = gtk_label_new( tr("Rom Name") );
	g_RomPropDialog.romNameEntry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.romNameEntry), FALSE );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 0, 1 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.romNameEntry, 1, 3, 0, 1 );

	label = gtk_label_new( tr("Size") );
	g_RomPropDialog.sizeEntry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.sizeEntry), FALSE );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 1, 2 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.sizeEntry, 1, 3, 1, 2 );

	label = gtk_label_new( tr("Country") );
	g_RomPropDialog.countryEntry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.countryEntry), FALSE );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 2, 3 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.countryEntry, 1, 3, 2, 3 );

	label = gtk_label_new( tr("Ini Code") );
	g_RomPropDialog.iniCodeEntry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.iniCodeEntry), FALSE );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 3, 4 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.iniCodeEntry, 1, 3, 3, 4 );

	label = gtk_label_new( tr("MD5 Checksum") );
	g_RomPropDialog.md5Entry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.md5Entry), FALSE );
	button = gtk_button_new_with_label( tr("Calculate") );
	gtk_signal_connect( GTK_OBJECT(button), "clicked",
				GTK_SIGNAL_FUNC(callback_calculateMd5Clicked), (gpointer)NULL );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 4, 5 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.md5Entry, 1, 2, 4, 5 );
	gtk_table_attach_defaults( GTK_TABLE(table), button, 2, 3, 4, 5 );

	frame = gtk_frame_new( tr("Comments") );
	gtk_box_pack_start( GTK_BOX(GTK_DIALOG(g_RomPropDialog.dialog)->vbox), frame, TRUE, TRUE, 0 );

	g_RomPropDialog.commentsEntry = gtk_entry_new();
	gtk_entry_set_max_length( GTK_ENTRY(g_RomPropDialog.commentsEntry), 199 );

	gtk_container_add( GTK_CONTAINER(frame), g_RomPropDialog.commentsEntry );

	// ok/cancel button
	button_ok = gtk_button_new_with_label( tr("Ok") );
	gtk_box_pack_start( GTK_BOX(GTK_DIALOG(g_RomPropDialog.dialog)->action_area), button_ok, TRUE, TRUE, 0 );
	gtk_signal_connect( GTK_OBJECT(button_ok), "clicked",
				GTK_SIGNAL_FUNC(callback_okClicked), (gpointer)NULL );

	button_cancel = gtk_button_new_with_label( tr("Cancel") );
	gtk_box_pack_start( GTK_BOX(GTK_DIALOG(g_RomPropDialog.dialog)->action_area), button_cancel, TRUE, TRUE, 0 );
	gtk_signal_connect( GTK_OBJECT(button_cancel), "clicked",
				GTK_SIGNAL_FUNC(callback_cancelClicked), (gpointer)NULL );

	return 0;
}
开发者ID:GPDP2,项目名称:mupen64,代码行数:82,代码来源:romproperties.c


示例2: Popup

/*
 * Popup
 *
 * Display a popup dialog window with a message and an 
 * "Ok" button
 */
void Popup (char *szMessage)
{
    static GtkWidget *label;
    GtkWidget *button;
    GtkWidget *dialog_window;

    /* --- Create a dialog window --- */
    dialog_window = gtk_dialog_new ();
    gtk_window_set_policy(GTK_WINDOW (dialog_window),FALSE,FALSE,FALSE); 
    /* --- Trap the window close signal to release the grab --- */
    gtk_signal_connect (GTK_OBJECT (dialog_window), "destroy",
	                GTK_SIGNAL_FUNC (ClosingDialog),
	                &dialog_window);

    /* --- Add a title to the window --- */
    gtk_window_set_title (GTK_WINDOW (dialog_window), "HEY...!!!");

    /* --- Create a small border --- */
    gtk_container_border_width (GTK_CONTAINER (dialog_window), 5);

    /*
     * --- Create the message
     */

    /* --- Create the message in a label --- */
    label = gtk_label_new (szMessage);

    /* --- Put some room around the label --- */
    gtk_misc_set_padding (GTK_MISC (label), 10, 10);

    /* --- Add the label to the dialog --- */
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox), 
                        label, TRUE, TRUE, 0);

    /* --- Make the label visible --- */
    gtk_widget_show (label);

    /* 
     * --- "ok" button
     */ 

    /* --- Create the "ok" button --- */
    button = gtk_button_new_with_label ("Ok");

    /* --- Need to close the window if they press "ok" --- */
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
	                GTK_SIGNAL_FUNC (CloseDialog),
	                dialog_window);

    /* --- Allow it to be the default button --- */
    GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);

    /* --- Add the button to the dialog --- */
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area), 
			  button, TRUE, TRUE, 0);

    /* --- Make the button the default button --- */
    gtk_widget_grab_default (button);

    /* --- Make the button visible --- */
    gtk_widget_show (button);

    /* --- Make the dialog visible --- */
    gtk_window_set_position(GTK_WINDOW(dialog_window),GTK_WIN_POS_CENTER);
    gtk_widget_show (dialog_window);

    gtk_grab_add (dialog_window);
}
开发者ID:bion,项目名称:ats,代码行数:74,代码来源:popup.c


示例3: create_ncolors_dbox

GtkWidget*
create_ncolors_dbox (void)
{
  GtkWidget *ncolors_dbox;
  GtkWidget *dialog_vbox5;
  GtkWidget *frame16;
  GtkWidget *vbox26;
  GSList *ncolors_grp_group = NULL;
  GtkWidget *radiobutton24;
  GtkWidget *radiobutton25;
  GtkWidget *radiobutton26;
  GtkWidget *radiobutton27;
  GtkWidget *dialog_action_area5;
  GtkWidget *hbuttonbox8;
  GtkWidget *button29;
  GtkWidget *hbox9;
  GtkWidget *pixmap1;
  guint label29_key;
  GtkWidget *label29;
  GtkWidget *button30;
  GtkWidget *hbox8;
  GtkWidget *pixmap2;
  guint label30_key;
  GtkWidget *label30;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  ncolors_dbox = gtk_dialog_new ();
  gtk_widget_set_name (ncolors_dbox, "ncolors_dbox");
  gtk_object_set_data (GTK_OBJECT (ncolors_dbox), "ncolors_dbox", ncolors_dbox);
  gtk_window_set_title (GTK_WINDOW (ncolors_dbox), _("Number of grayscales colors"));
  gtk_window_set_policy (GTK_WINDOW (ncolors_dbox), FALSE, FALSE, FALSE);

  dialog_vbox5 = GTK_DIALOG (ncolors_dbox)->vbox;
  gtk_widget_set_name (dialog_vbox5, "dialog_vbox5");
  gtk_object_set_data (GTK_OBJECT (ncolors_dbox), "dialog_vbox5", dialog_vbox5);
  gtk_widget_show (dialog_vbox5);

  frame16 = gtk_frame_new (_("Number of extra grayscales colors"));
  gtk_widget_set_name (frame16, "frame16");
  gtk_widget_ref (frame16);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "frame16", frame16,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame16);
  gtk_box_pack_start (GTK_BOX (dialog_vbox5), frame16, TRUE, TRUE, 5);
  gtk_container_set_border_width (GTK_CONTAINER (frame16), 5);

  vbox26 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox26, "vbox26");
  gtk_widget_ref (vbox26);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "vbox26", vbox26,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox26);
  gtk_container_add (GTK_CONTAINER (frame16), vbox26);

  radiobutton24 = gtk_radio_button_new_with_label (ncolors_grp_group, _("0 - no grayscales, only 2 colors (B&W)"));
  ncolors_grp_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton24));
  gtk_widget_set_name (radiobutton24, "radiobutton24");
  gtk_widget_ref (radiobutton24);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "radiobutton24", radiobutton24,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton24);
  gtk_box_pack_start (GTK_BOX (vbox26), radiobutton24, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (radiobutton24), 5);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton24), TRUE);

  radiobutton25 = gtk_radio_button_new_with_label (ncolors_grp_group, _("2 - two extra colors, 4 colors (graylib4)"));
  ncolors_grp_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton25));
  gtk_widget_set_name (radiobutton25, "radiobutton25");
  gtk_widget_ref (radiobutton25);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "radiobutton25", radiobutton25,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton25);
  gtk_box_pack_start (GTK_BOX (vbox26), radiobutton25, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (radiobutton25), 5);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton25), TRUE);

  radiobutton26 = gtk_radio_button_new_with_label (ncolors_grp_group, _("5 - five extra colors, 7 colors (graylib7)"));
  ncolors_grp_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton26));
  gtk_widget_set_name (radiobutton26, "radiobutton26");
  gtk_widget_ref (radiobutton26);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "radiobutton26", radiobutton26,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton26);
  gtk_box_pack_start (GTK_BOX (vbox26), radiobutton26, TRUE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (radiobutton26), 5);

  radiobutton27 = gtk_radio_button_new_with_label (ncolors_grp_group, _("11 - blurry, graylib4 & graylib7"));
  ncolors_grp_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton27));
  gtk_widget_set_name (radiobutton27, "radiobutton27");
  gtk_widget_ref (radiobutton27);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "radiobutton27", radiobutton27,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton27);
  gtk_box_pack_start (GTK_BOX (vbox26), radiobutton27, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (radiobutton27), 5);

  dialog_action_area5 = GTK_DIALOG (ncolors_dbox)->action_area;
  gtk_widget_set_name (dialog_action_area5, "dialog_action_area5");
//.........这里部分代码省略.........
开发者ID:debrouxl,项目名称:tiemu,代码行数:101,代码来源:colors_dbox.c


示例4: vmat_v_row

void vmat_v_row(GtkTreeView *treeview,GtkTreePath *arg1,GtkTreeViewColumn *arg2,
class vmat_data *data)
{
printf("vmat_v_row\n");
gtk_signal_emit_by_name(GTK_OBJECT(data->knopka[FK2]),"clicked");
}
开发者ID:zaharchuktv,项目名称:linuxbuh,代码行数:6,代码来源:l_vmat.c


示例5: gui_init

void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_levels_gui_data_t));
  dt_iop_levels_gui_data_t *c = (dt_iop_levels_gui_data_t *)self->gui_data;

  c->mouse_x = c->mouse_y = -1.0;
  c->dragging = 0;
  c->activeToggleButton = NULL;
  c->current_pick = NONE;
  c->last_picked_color = -1;
  for (int i=0; i<3; i++)
    for (int j=0; j<2; j++) c->pick_xy_positions[i][j] = -1;
  self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, 5));
  c->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
  GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, TRUE);
  gtk_box_pack_start(GTK_BOX(self->widget), asp, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(c->area));
  gtk_drawing_area_size(c->area, 258, 150);
  g_object_set (GTK_OBJECT(c->area), "tooltip-text", _("drag handles to set black, grey, and white points.  operates on L channel."), (char *)NULL);

  gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
  g_signal_connect (G_OBJECT (c->area), "expose-event",
                    G_CALLBACK (dt_iop_levels_expose), self);
  g_signal_connect (G_OBJECT (c->area), "button-press-event",
                    G_CALLBACK (dt_iop_levels_button_press), self);
  g_signal_connect (G_OBJECT (c->area), "button-release-event",
                    G_CALLBACK (dt_iop_levels_button_release), self);
  g_signal_connect (G_OBJECT (c->area), "motion-notify-event",
                    G_CALLBACK (dt_iop_levels_motion_notify), self);
  g_signal_connect (G_OBJECT (c->area), "leave-notify-event",
                    G_CALLBACK (dt_iop_levels_leave_notify), self);
  g_signal_connect (G_OBJECT (c->area), "scroll-event",
                    G_CALLBACK (dt_iop_levels_scroll), self);

  GtkWidget *autobutton = dtgtk_button_new_with_label(_("auto"), NULL, CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
  g_object_set(G_OBJECT(autobutton), "tooltip-text", _("apply auto levels"), (char *)NULL);
  gtk_widget_set_size_request(autobutton, 70, 24);

  GtkWidget *blackpick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  g_object_set(G_OBJECT(blackpick), "tooltip-text", _("pick blackpoint from image"), (char *)NULL);
  gtk_widget_set_size_request(blackpick, 24, 24);

  GtkWidget *greypick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  g_object_set(G_OBJECT(greypick), "tooltip-text", _("pick medium greypoint from image"), (char *)NULL);
  gtk_widget_set_size_request(greypick, 24, 24);

  GtkWidget *whitepick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  g_object_set(G_OBJECT(whitepick), "tooltip-text", _("pick whitepoint from image"), (char *)NULL);
  gtk_widget_set_size_request(whitepick, 24, 24);

  GdkColor col;
  col.red = col.green = col.blue = 0;
  gtk_widget_modify_fg(GTK_WIDGET(blackpick), GTK_STATE_NORMAL, &col);
  gtk_widget_modify_fg(GTK_WIDGET(blackpick), GTK_STATE_SELECTED, &col);
  col.red = col.green = col.blue = 32767;
  gtk_widget_modify_fg(GTK_WIDGET(greypick), GTK_STATE_NORMAL, &col);
  gtk_widget_modify_fg(GTK_WIDGET(greypick), GTK_STATE_SELECTED, &col);
  col.red = col.green = col.blue = 65535;
  gtk_widget_modify_fg(GTK_WIDGET(whitepick), GTK_STATE_NORMAL, &col);
  gtk_widget_modify_fg(GTK_WIDGET(whitepick), GTK_STATE_SELECTED, &col);
  col.red = col.green = col.blue = 4096;
  gtk_widget_modify_bg(GTK_WIDGET(blackpick), GTK_STATE_ACTIVE, &col);
  gtk_widget_modify_bg(GTK_WIDGET(greypick), GTK_STATE_ACTIVE, &col);
  gtk_widget_modify_bg(GTK_WIDGET(whitepick), GTK_STATE_ACTIVE, &col);

  GtkWidget *box = gtk_hbox_new(TRUE,0);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(autobutton), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(blackpick), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(greypick), FALSE, FALSE, 0);
  gtk_box_pack_end(GTK_BOX(box), GTK_WIDGET(whitepick), FALSE, FALSE, 0);

  gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0);

  g_signal_connect (G_OBJECT(autobutton), "clicked",
		    G_CALLBACK(dt_iop_levels_autoadjust_callback), (gpointer)self);
  g_signal_connect (G_OBJECT(blackpick), "toggled",
                    G_CALLBACK (dt_iop_levels_pick_black_callback), self);
  g_signal_connect (G_OBJECT(greypick), "toggled",
                    G_CALLBACK (dt_iop_levels_pick_grey_callback), self);
  g_signal_connect (G_OBJECT(whitepick), "toggled",
                    G_CALLBACK (dt_iop_levels_pick_white_callback), self);
}
开发者ID:jonleighton,项目名称:darktable,代码行数:82,代码来源:levels.c


示例6: glspi_choose

static gint glspi_choose(lua_State* L)
{
	const gchar *arg1=NULL;
	gint i, n;
	GtkResponseType rv;
	GtkWidget*dialog, *ok_btn, *cancel_btn, *tree, *scroll;
	GtkListStore *store;
	GtkTreeIter iter;
	GtkTreeSelection *select;

	if ( (lua_gettop(L)!=2) || (!lua_istable(L,2)) ) {
		return FAIL_TABLE_ARG(2);
	}

	if (!lua_isnil(L, 1)) {
		if (!lua_isstring(L, 1))	{ return FAIL_STRING_ARG(1); }
			arg1=lua_tostring(L, 1);
	}

	n=lua_objlen(L,2);
	for (i=1;i<=n; i++) {
		lua_rawgeti(L,2,i);
		if (!lua_isstring(L, -1)) {
			return glspi_fail_elem_type(L, __FUNCTION__, 2, i, "string");
		}
		lua_pop(L, 1);
	}
	store=gtk_list_store_new(1, G_TYPE_STRING);
	for (i=1;i<=n; i++) {
		lua_rawgeti(L,2,i);
		gtk_list_store_append(store, &iter);
		gtk_list_store_set(store, &iter, 0, lua_tostring(L, -1), -1);
		lua_pop(L, 1);
	}
	dialog = new_dlg(GTK_MESSAGE_OTHER, GTK_BUTTONS_NONE, arg1, NULL);
	ok_btn=gtk_dialog_add_button(GTK_DIALOG(dialog),
			GTK_STOCK_OK, GTK_RESPONSE_OK);
	cancel_btn=gtk_dialog_add_button(GTK_DIALOG(dialog),
			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
	gtk_widget_grab_default(ok_btn);
	set_dialog_title(L,dialog);

	tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);
	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree),
				-1, NULL, gtk_cell_renderer_text_new(), "text", 0, NULL);

	select = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
	gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);

	scroll=gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
		GTK_POLICY_AUTOMATIC,  GTK_POLICY_AUTOMATIC);
	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),scroll);
	gtk_container_add(GTK_CONTAINER(scroll),tree);

	gtk_widget_set_size_request(tree, 320, 240);
	gtk_widget_show_all(dialog);
	gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE);

	gtk_signal_connect(GTK_OBJECT(tree), "button-press-event",
		GTK_SIGNAL_FUNC(on_tree_clicked), dialog);
	gtk_signal_connect(GTK_OBJECT(tree), "key-release-event",
		GTK_SIGNAL_FUNC(on_tree_key_release), dialog);

	rv=glspi_dialog_run(GTK_DIALOG(dialog));

	if (GTK_RESPONSE_OK == rv ) {
		gchar *txt=NULL;
		GtkTreeModel *model;
		if (gtk_tree_selection_get_selected(select, &model, &iter)) {
			gtk_tree_model_get(model, &iter, 0, &txt, -1);
		}
		if (txt) {
			lua_pushstring(L, txt);
			g_free(txt);
		} else {
			lua_pushnil(L);
		}
	} else {
		lua_pushnil(L);
	}
	gtk_widget_destroy(dialog);
	return 1;
}
开发者ID:floverdevel,项目名称:geany-plugins,代码行数:86,代码来源:glspi_dlg.c


示例7: wxFAIL_MSG

bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
      const wxPoint &pos, const wxSize &size,
      long style, const wxValidator& validator, const wxString &name )
{
    m_needParent = TRUE;
    m_acceptsFocus = TRUE;

    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxButton creation failed") );
        return FALSE;
    }

/*
    wxString label2( label );
    for (size_t i = 0; i < label2.Len(); i++)
    {
        if (label2.GetChar(i) == wxT('&'))
        label2.SetChar(i,wxT('_'));
    }

    GtkWidget *accel_label = gtk_accel_label_new( label2.mb_str() );
    gtk_widget_show( accel_label );

    m_widget = gtk_button_new();
    gtk_container_add( GTK_CONTAINER(m_widget), accel_label );

    gtk_accel_label_set_accel_widget( GTK_ACCEL_LABEL(accel_label), m_widget );

    guint accel_key = gtk_label_parse_uline (GTK_LABEL(accel_label), label2.mb_str() );
    gtk_accel_label_refetch( GTK_ACCEL_LABEL(accel_label) );

    wxControl::SetLabel( label );
*/

#ifdef __WXGTK20__
    m_widget = gtk_button_new_with_mnemonic("");
#else
    m_widget = gtk_button_new_with_label("");
#endif

    float x_alignment = 0.5;
    if (HasFlag(wxBU_LEFT))
        x_alignment = 0.0;
    else if (HasFlag(wxBU_RIGHT))
        x_alignment = 1.0;

    float y_alignment = 0.5;
    if (HasFlag(wxBU_TOP))
        y_alignment = 0.0;
    else if (HasFlag(wxBU_BOTTOM))
        y_alignment = 1.0;

#if __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
    }
    else
#endif
    {
        if (GTK_IS_MISC(BUTTON_CHILD(m_widget)))
            gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
                                x_alignment, y_alignment);
    }

    SetLabel(label);

    if (style & wxNO_BORDER)
       gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );

    gtk_signal_connect_after( GTK_OBJECT(m_widget), "clicked",
      GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );

    gtk_signal_connect_after( GTK_OBJECT(m_widget), "style_set",
      GTK_SIGNAL_FUNC(gtk_button_style_set_callback), (gpointer*) this );
      
    m_parent->DoAddChild( this );

    PostCreation(size);

    return true;
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:84,代码来源:button.cpp


示例8: create_dbgopt_dbox

GtkWidget*
create_dbgopt_dbox (void)
{
  GtkWidget *dbgopt_dbox;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *frame2;
  GtkWidget *hbox3;
  GtkWidget *label3;
  GtkObject *spinbutton1_adj;
  GtkWidget *spinbutton1;
  GtkWidget *label4;
  GtkWidget *frame3;
  GtkWidget *hbox4;
  GtkWidget *label5;
  GtkObject *spinbutton2_adj;
  GtkWidget *spinbutton2;
  GtkWidget *label6;
  GtkWidget *frame4;
  GtkWidget *hbox5;
  GtkWidget *label7;
  GtkObject *spinbutton3_adj;
  GtkWidget *spinbutton3;
  GtkWidget *label8;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbuttonbox1;
  GtkWidget *ok_button;
  GtkWidget *hbox2;
  GtkWidget *pixmap2;
  guint label2_key;
  GtkWidget *label2;
  GtkWidget *cancel_button;
  GtkWidget *hbox1;
  GtkWidget *pixmap1;
  guint label1_key;
  GtkWidget *label1;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  dbgopt_dbox = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (dbgopt_dbox), "dbgopt_dbox", dbgopt_dbox);
  gtk_window_set_title (GTK_WINDOW (dbgopt_dbox), _("Advanced settings"));
  gtk_window_set_position (GTK_WINDOW (dbgopt_dbox), GTK_WIN_POS_CENTER);
  gtk_window_set_policy (GTK_WINDOW (dbgopt_dbox), TRUE, FALSE, TRUE);

  dialog_vbox1 = GTK_DIALOG (dbgopt_dbox)->vbox;
  gtk_object_set_data (GTK_OBJECT (dbgopt_dbox), "dialog_vbox1", dialog_vbox1);
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (TRUE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  frame2 = gtk_frame_new (_("Dissasembly window"));
  gtk_widget_ref (frame2);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "frame2", frame2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame2);
  gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame2), 5);

  hbox3 = gtk_hbox_new (TRUE, 0);
  gtk_widget_ref (hbox3);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "hbox3", hbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox3);
  gtk_container_add (GTK_CONTAINER (frame2), hbox3);
  gtk_container_set_border_width (GTK_CONTAINER (hbox3), 5);

  label3 = gtk_label_new (_("Size:"));
  gtk_widget_ref (label3);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label3", label3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label3);
  gtk_box_pack_start (GTK_BOX (hbox3), label3, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label3), 5, 0);

  spinbutton1_adj = gtk_adjustment_new (20, 1, 100, 1, 10, 10);
  spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0);
  gtk_widget_ref (spinbutton1);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "spinbutton1", spinbutton1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (spinbutton1);
  gtk_box_pack_start (GTK_BOX (hbox3), spinbutton1, FALSE, TRUE, 0);

  label4 = gtk_label_new (_("lines"));
  gtk_widget_ref (label4);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label4", label4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label4);
  gtk_box_pack_start (GTK_BOX (hbox3), label4, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label4), 5, 0);

  frame3 = gtk_frame_new (_("Memory window"));
//.........这里部分代码省略.........
开发者ID:debrouxl,项目名称:tiemu,代码行数:101,代码来源:dbgopt_dbox.c


示例9: configure

/*
 * Create dialog window for configuration.
 */
static void configure (void)
{
  GtkWidget *vbox, *bbox, *ok, *cancel, *apply, *hbox, *label,
    *button, *unit_label, *hbox2, *vbox2, *sep;


  GSList *group = NULL;

  DEBUG("configure");
  if (configure_win)
    return;

  read_config ();

  configure_win = gtk_window_new (GTK_WINDOW_DIALOG);

  gtk_signal_connect (GTK_OBJECT (configure_win), "destroy",
		      GTK_SIGNAL_FUNC (gtk_widget_destroyed), &configure_win);

  gtk_window_set_title (GTK_WINDOW (configure_win),
			"On Screen Display Configuration - " XOSD_VERSION);

  vbox = gtk_vbox_new (FALSE, 10);
  gtk_container_add (GTK_CONTAINER (configure_win), vbox);
  gtk_container_set_border_width (GTK_CONTAINER (configure_win), 5);

  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Font:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  font_entry = gtk_entry_new ();
  if (font)
    gtk_entry_set_text (GTK_ENTRY (font_entry), font);
  gtk_box_pack_start (GTK_BOX (hbox), font_entry, TRUE, TRUE, 0);
  button = gtk_button_new_with_label ("Set");
  gtk_signal_connect (GTK_OBJECT (button), "clicked",
		      GTK_SIGNAL_FUNC (font_dialog_window), NULL);
  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);


  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Colour:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  colour_entry = gtk_entry_new ();
  if (colour)
    gtk_entry_set_text (GTK_ENTRY (colour_entry), colour);
  gtk_box_pack_start (GTK_BOX (hbox), colour_entry, TRUE, TRUE, 0);
  button = gtk_button_new_with_label ("Set");
  gtk_signal_connect (GTK_OBJECT (button), "clicked",
		      GTK_SIGNAL_FUNC (colour_dialog_window), NULL);
  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);


  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Timeout:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  timeout_obj = gtk_adjustment_new (timeout, -1, 60, 1, 1, 1);
  timeout_spin = gtk_spin_button_new (GTK_ADJUSTMENT (timeout_obj), 1.0, 0);
  if (timeout)
    gtk_spin_button_set_value (GTK_SPIN_BUTTON (timeout_spin),
			       (gfloat) timeout);
  gtk_box_pack_start (GTK_BOX (hbox), timeout_spin, FALSE, FALSE, 0);
  unit_label = gtk_label_new ("seconds");
  gtk_box_pack_start (GTK_BOX (hbox), unit_label, FALSE, FALSE, 0);


  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Vertical Offset:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  offset_obj = gtk_adjustment_new (timeout, 0, 60, 1, 1, 1);
  offset_spin = gtk_spin_button_new (GTK_ADJUSTMENT (offset_obj), 1.0, 0);
  if (offset)
    gtk_spin_button_set_value (GTK_SPIN_BUTTON (offset_spin),
			       (gfloat) offset);
  gtk_box_pack_start (GTK_BOX (hbox), offset_spin, FALSE, FALSE, 0);
  unit_label = gtk_label_new ("pixels");
  gtk_box_pack_start (GTK_BOX (hbox), unit_label, FALSE, FALSE, 0);

  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Shadow Offset:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);

  shadow_obj = gtk_adjustment_new (timeout, 0, 60, 1, 1, 1);
  shadow_spin = gtk_spin_button_new (GTK_ADJUSTMENT (shadow_obj), 1.0, 0);
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (shadow_spin),
			     (gfloat) shadow_offset);
  gtk_box_pack_start (GTK_BOX (hbox), shadow_spin, FALSE, FALSE, 0);
  unit_label = gtk_label_new ("pixels");
  gtk_box_pack_start (GTK_BOX (hbox), unit_label, FALSE, FALSE, 0);


  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
//.........这里部分代码省略.........
开发者ID:skripac,项目名称:libxosd,代码行数:101,代码来源:xmms_osd.c


示例10: main_window_fill_panes

static void main_window_fill_panes(void)
{
	GtkWidget *box;
	GtkWidget *box2;
	GtkWidget *chkOnlyCurFileFuncs;
	GtkCellRenderer *renderer;
	GtkTreeViewColumn *column;

	//Commented out as panes aren't used yet AJ 2003-01-21 TODO: replace old style code with new main_window.* code
	/*notebook_manager = gtk_notebook_new ();
	gtk_widget_show (notebook_manager);
	gtk_paned_pack1 (GTK_PANED (hpaned1), notebook_manager, FALSE, TRUE);
	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook_manager), GTK_POS_BOTTOM);
	gtk_widget_set_usize(notebook_manager,200,400);*/

	box = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(box);
	gtk_paned_pack1 (GTK_PANED (main_window.main_horizontal_pane), box, FALSE, TRUE);
	
	//add checkbox to show only current file's classes
	//the signals to be checked for the check box are onclick of the checkbox 
	//and the on change of the file.
	//Close button for the side bar
	GtkWidget *hbox;
	hbox = gtk_hbox_new(FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(hbox), 0);
	main_window.close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
	gtk_misc_set_padding(GTK_MISC(main_window.close_image), 0, 0);
	main_window.close_sidebar_button = gtk_button_new();
	gtk_widget_set_tooltip_text(main_window.close_sidebar_button, _("Close class Browser"));
	gtk_button_set_image(GTK_BUTTON(main_window.close_sidebar_button), main_window.close_image);
	gtk_button_set_relief(GTK_BUTTON(main_window.close_sidebar_button), GTK_RELIEF_NONE);
	gtk_button_set_focus_on_click(GTK_BUTTON(main_window.close_sidebar_button), FALSE);
	gtk_signal_connect(GTK_OBJECT(main_window.close_sidebar_button), "clicked", G_CALLBACK (classbrowser_show_hide),NULL);
	gtk_widget_show(main_window.close_image);
	gtk_widget_show(main_window.close_sidebar_button);
	//
	main_window.chkOnlyCurFileFuncs = gtk_check_button_new_with_label(_("Parse only current file")); 
	gtk_widget_show (main_window.chkOnlyCurFileFuncs);
	gtk_box_pack_start(GTK_BOX(hbox), main_window.chkOnlyCurFileFuncs, FALSE, FALSE, 10);
//	gtk_box_pack_start(GTK_BOX(box), main_window.chkOnlyCurFileFuncs, FALSE, FALSE, 10);
	gtk_box_pack_start(GTK_BOX(hbox), main_window.close_sidebar_button, FALSE, FALSE, 0);
	gtk_widget_show(hbox);	
	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 10);
	g_signal_connect (G_OBJECT (main_window.chkOnlyCurFileFuncs), "clicked",
						G_CALLBACK (on_parse_current_click), NULL);

	main_window.scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
	gtk_widget_show (main_window.scrolledwindow3);
	gtk_box_pack_start(GTK_BOX(box), main_window.scrolledwindow3, TRUE, TRUE, 0);
	gtk_paned_pack1 (GTK_PANED (main_window.main_horizontal_pane), main_window.scrolledwindow3, FALSE, TRUE);

	box2 = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(box2);
	main_window.treeviewlabel = gtk_label_new(_("FILE: "));
	gtk_label_set_justify(GTK_LABEL(main_window.treeviewlabel), GTK_JUSTIFY_LEFT);
	gtk_widget_show(main_window.treeviewlabel);
	gtk_box_pack_start(GTK_BOX(box2), main_window.treeviewlabel, FALSE, FALSE, 0);
	gtk_box_pack_end(GTK_BOX(box), box2, FALSE, FALSE, 4);
	//gtk_container_add (GTK_CONTAINER (notebook_manager), main_window.scrolledwindow3);

	main_window.classtreestore = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING,
															 G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
	//enable sorting of the columns
	classbrowser_set_sortable(main_window.classtreestore);

	main_window.classtreeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (main_window.classtreestore));
	gtk_widget_show (main_window.classtreeview);
	gtk_container_add (GTK_CONTAINER (main_window.scrolledwindow3), main_window.classtreeview);

	main_window.classtreeselect = gtk_tree_view_get_selection (GTK_TREE_VIEW (main_window.classtreeview));
	gtk_tree_selection_set_mode (main_window.classtreeselect, GTK_SELECTION_SINGLE);
	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes (_("Name"),
					 renderer, "text", NAME_COLUMN, NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (main_window.classtreeview), column);

	/*label1 = gtk_label_new ("Functions");
	gtk_widget_show (label1);
	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_manager), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_manager), 0), label1);
	gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
	 
	notebook_manager_functions_page = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (notebook_manager_functions_page);
	gtk_container_add (GTK_CONTAINER (notebook_manager), notebook_manager_functions_page);

	label2 = gtk_label_new ("Files");
	gtk_widget_show (label2);
	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_manager), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_manager), 1), label2);
	gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

	notebook_manager_files_page = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (notebook_manager_files_page);
	gtk_container_add (GTK_CONTAINER (notebook_manager), notebook_manager_files_page);

	label3 = gtk_label_new ("Help");
	gtk_widget_show (label3);
	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_manager), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_manager), 2), label3);
	gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
	*/
//.........这里部分代码省略.........
开发者ID:maheshmohanmu,项目名称:gphpedit,代码行数:101,代码来源:main_window.c


示例11: create_show_hide

static void
create_show_hide (void)
{
   GtkWidget *window = NULL;
   GtkWidget *box1;
   GtkWidget *box2;
   GtkWidget *close_button;
   GtkWidget *enable_box;
   GtkWidget *box;
   GtkWidget *table;
   GtkWidget *label;
   GtkWidget *separator;
   GtkDataboxGraph *graph;
   gfloat *X;
   gfloat *Y;
   GdkColor color;
   gint i;

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_size_request (window, 600, 600);

   g_signal_connect (GTK_OBJECT (window), "destroy",
		     G_CALLBACK (gtk_main_quit), NULL);

   gtk_window_set_title (GTK_WINDOW (window),
			 "GtkDatabox: Enable/Disable Features");
   gtk_container_set_border_width (GTK_CONTAINER (window), 0);

   box1 = gtk_vbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (window), box1);

   label =
      gtk_label_new
      ("Click on the buttons to enable/disable features.\n\nFor basic understanding: See basics :-)\n\n");
   gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
   separator = gtk_hseparator_new ();
   gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0);

   enable_box = gtk_hbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (box1), enable_box, FALSE, FALSE, 0);
   separator = gtk_hseparator_new ();
   gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0);

   /* Create a GtkDatabox widget along with scrollbars and rulers */
   gtk_databox_create_box_with_scrollbars_and_rulers (&box, &table,
						      TRUE, TRUE, TRUE, TRUE);

   gtk_box_pack_start (GTK_BOX (box1), table, TRUE, TRUE, 0);

   X = g_new0 (gfloat, POINTS);
   Y = g_new0 (gfloat, POINTS);

   for (i = 0; i < POINTS; i++)
   {
      X[i] = i;
      Y[i] = 100. * sin (i * 2 * G_PI / POINTS);
   }
   color.red = 0;
   color.green = 0;
   color.blue = 65535;

   graph = gtk_databox_bars_new (POINTS, X, Y, &color, 1);
   gtk_databox_graph_add (GTK_DATABOX (box), graph);

   gtk_databox_auto_rescale (GTK_DATABOX (box), 0.05);

   separator = gtk_hseparator_new ();
   gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);

   box2 = gtk_vbox_new (FALSE, 10);
   gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
   gtk_box_pack_end (GTK_BOX (box1), box2, FALSE, TRUE, 0);
   close_button = gtk_button_new_with_label ("close");
   g_signal_connect_swapped (GTK_OBJECT (close_button), "clicked",
			     G_CALLBACK (gtk_main_quit), GTK_OBJECT (box));
   gtk_box_pack_start (GTK_BOX (box2), close_button, TRUE, TRUE, 0);
   GTK_WIDGET_SET_FLAGS (close_button, GTK_CAN_DEFAULT);
   for (i = 0; i < noEnableSets; ++i)
   {
      GtkWidget *vbox = gtk_vbox_new (FALSE, 10);
      GtkWidget *label = gtk_label_new (enableSets[i].title);
      GtkWidget *entry = gtk_entry_new ();
      GtkWidget *button = gtk_button_new_with_label ("Change");

      gtk_box_pack_start (GTK_BOX (enable_box), vbox, TRUE, TRUE, 0);
      gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
      gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
      gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);

      gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE);
      g_signal_connect_swapped (button, "clicked",
				G_CALLBACK (update_enable),
				(gpointer) & (enableSets[i]));
      enableSets[i].box = GTK_DATABOX (box);
      enableSets[i].entry = GTK_ENTRY (entry);

      update_enable (&enableSets[i]);
      update_enable (&enableSets[i]);

   }
//.........这里部分代码省略.........
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:101,代码来源:enable_disable.c


示例12: main_window_create_toolbars

static void main_window_create_toolbars(void)
{
	//updated toolbar code with the new gtk+ functions
	// Create the Main Toolbar
	main_window.toolbar_main = gtk_toolbar_new ();
	gtk_widget_show (main_window.toolbar_main);
	gnome_app_add_toolbar (GNOME_APP (main_window.window), GTK_TOOLBAR (main_window.toolbar_main), "toolbar1",
							 BONOBO_DOCK_ITEM_BEH_NORMAL, BONOBO_DOCK_TOP, 1, 0, 0);
	gtk_container_set_border_width (GTK_CONTAINER (main_window.toolbar_main), 1);
	gtk_toolbar_set_style (GTK_TOOLBAR (main_window.toolbar_main), GTK_TOOLBAR_ICONS);
	gtk_toolbar_set_show_arrow (GTK_TOOLBAR (main_window.toolbar_main), FALSE);


	// Add the File operations to the Main Toolbar
	//main_window.toolbar_main_button_new = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_NEW, _("New File"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_new = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_NEW));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_new), _("New File"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_new), -1);
	gtk_widget_show (main_window.toolbar_main_button_new);
	//main_window.toolbar_main_button_open = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_OPEN, _("Open File"), NULL, NULL, NULL, -1);
	//gtk_widget_show (main_window.toolbar_main_button_open);
	main_window.toolbar_main_button_open = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_OPEN));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_open), _("Open File"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_open), -1);
	gtk_widget_show (main_window.toolbar_main_button_open);
//	main_window.toolbar_main_button_save = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_SAVE, _("Save File"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_save = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_SAVE));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_save), _("Save File"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_save), -1);
	gtk_widget_show (main_window.toolbar_main_button_save);
//	main_window.toolbar_main_button_save_as = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_SAVE_AS, _("Save File As..."), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_save_as = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_SAVE_AS));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_save_as), _("Save File As..."));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_save_as), -1);
	gtk_widget_show (main_window.toolbar_main_button_save_as);

//	main_window.toolbar_main_button_close = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_CLOSE, _("Close File"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_close = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_CLOSE));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_close), _("Close File"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_close), -1);
	gtk_widget_show (main_window.toolbar_main_button_close);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_open), "clicked", GTK_SIGNAL_FUNC (on_open1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_new), "clicked", GTK_SIGNAL_FUNC (on_new1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_save), "clicked", GTK_SIGNAL_FUNC (on_save1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_save_as), "clicked", GTK_SIGNAL_FUNC (on_save_as1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_close), "clicked", GTK_SIGNAL_FUNC (on_close1_activate), NULL);
//	gtk_toolbar_append_space(GTK_TOOLBAR(main_window.toolbar_main));
	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));
	// Add the Undo operations to the Main Toolbar
//	main_window.toolbar_main_button_undo = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_UNDO, _("Undo last change"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_undo = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_UNDO));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_undo), _("Undo last change"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_undo), -1);
	gtk_widget_show (main_window.toolbar_main_button_undo);
//	main_window.toolbar_main_button_redo = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_REDO, _("Redo last change"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_redo = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_REDO));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_redo), _("Redo last change"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_redo), -1);
	gtk_widget_show (main_window.toolbar_main_button_redo);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_undo), "clicked", GTK_SIGNAL_FUNC (on_undo1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_redo), "clicked", GTK_SIGNAL_FUNC (on_redo1_activate), NULL);
	//gtk_toolbar_append_space(GTK_TOOLBAR(main_window.toolbar_main));
	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));

	// Add the Clipboard operations to the Main Toolbar
	//main_window.toolbar_main_button_cut = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_CUT, _("Cut current selection"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_cut = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_CUT));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_cut), _("Cut current selection"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_cut), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_cut), "clicked", GTK_SIGNAL_FUNC (on_cut1_activate), NULL);
	gtk_widget_show (main_window.toolbar_main_button_cut);
//	main_window.toolbar_main_button_copy = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_COPY, _("Copy current selection"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_copy = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_COPY));
  	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_copy), _("Copy current selection"));
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_copy), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_copy), "clicked", GTK_SIGNAL_FUNC (on_copy1_activate), NULL);
	gtk_widget_show (main_window.toolbar_main_button_copy);
	//main_window.toolbar_main_button_paste = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_PASTE, _("Paste current selection"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_paste = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_PASTE));
  	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_paste), _("Paste current selection"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_paste), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_paste), "clicked", GTK_SIGNAL_FUNC (on_paste1_activate), NULL);
	gtk_widget_show (main_window.toolbar_main_button_paste);
	//gtk_toolbar_append_space(GTK_TOOLBAR(main_window.toolbar_main));
	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));
	// Add the Search operations to the Main Toolbar
//	main_window.toolbar_main_button_find = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_FIND, _("Find text"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_find = GTK_WIDG 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_OBJECT_CLASS函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_NOTEBOOK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap