当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_EDITABLE函数代码示例

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


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

示例1: config_entry_commit

/* Commit changes to the MateConf database. */
static gboolean
config_entry_commit (GtkWidget *entry, GdkEvent *event, gpointer callback_data)
{
  gchar *text;
  const gchar *key;
  MateConfClient *client;
  
  client = g_object_get_data (G_OBJECT (entry), "client");  

  text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);

  key = g_object_get_data (G_OBJECT (entry), "key");

  /* Unset if the string is zero-length, otherwise set */
  if (*text != '\0')
    mateconf_client_set_string (client, key, text, NULL);
  else
    mateconf_client_unset (client, key, NULL);
  
  g_free (text);

  return FALSE;
}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:24,代码来源:basic-mateconf-app.c

示例2: edit_hist_back

static void edit_hist_back(edit *e)
{
	const char *text = gtk_entry_get_text(e->edit_w);
	if(e->ch) {
		if(!e->ch->h)
			return;
		e->ch = e->ch->h;
	} else {
		if(!e->h)
			return;
		if(!strcmp(text, e->h->e)) {
			if(!e->h->h)
				return;
			e->ch = e->h->h;
		} else {
			if(text[0])
				e->hold = mame_strdup(text);
			e->ch = e->h;
		}
	}
	gtk_entry_set_text(e->edit_w, e->ch->e);
	gtk_editable_select_region(GTK_EDITABLE(e->edit_w), 0, -1);
}
开发者ID:Ilgrim,项目名称:MAMEHub,代码行数:23,代码来源:debugwin.c

示例3: expander_activated_cb

static void
expander_activated_cb (GtkExpander *w,
                       CajaFileConflictDialog *dialog)
{
    CajaFileConflictDialogDetails *details;
    int start_pos, end_pos;

    details = dialog->details;

    if (!gtk_expander_get_expanded (w))
    {
        if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (details->entry)),
                       details->conflict_name) == 0)
        {
            gtk_widget_grab_focus (details->entry);

            eel_filename_get_rename_region (details->conflict_name,
                                            &start_pos, &end_pos);
            gtk_editable_select_region (GTK_EDITABLE (details->entry),
                                        start_pos, end_pos);
        }
    }
}
开发者ID:dmashal,项目名称:mate-file-manager,代码行数:23,代码来源:caja-file-conflict-dialog.c

示例4: g_object_set

void XttTblGtk::activate_command(GtkWidget* w, gpointer data)
{
  XttTbl* xtt = (XttTbl*)data;

  if (!xtt->is_authorized())
    return;

  if (xtt->command_open) {
    g_object_set(((XttTblGtk*)xtt)->cmd_input, "visible", FALSE, NULL);
    xtt->set_prompt("");
    xtt->command_open = 0;
    return;
  }

  gtk_editable_delete_text(GTK_EDITABLE(((XttTblGtk*)xtt)->cmd_input), 0, -1);

  g_object_set(((XttTblGtk*)xtt)->cmd_input, "visible", TRUE, NULL);
  xtt->message(' ', "");
  gtk_widget_grab_focus(((XttTblGtk*)xtt)->cmd_input);

  xtt->set_prompt("xtt >");
  xtt->command_open = 1;
}
开发者ID:siamect,项目名称:proview,代码行数:23,代码来源:xtt_tbl_gtk.cpp

示例5: update_2d_curve

/*!
  \brief updates the curve with new data from the corresponding text entry
  This extracts the curve axis and index from the widget in order to know 
  which vertex of the curve to change
  \param widget is hte entry that was changed via the user
  \param data is a pointer to the curve to update
  \returns FALSE
  */
G_MODULE_EXPORT gboolean update_2d_curve(GtkWidget *widget, gpointer data)
{
	GtkWidget *curve = (GtkWidget *)data;
	MtxCurveCoord point;
	Axis axis;
	gint index = 0;
	gchar * text = NULL;
	gfloat tmpf = 0.0;

	index = (GINT) OBJ_GET(widget,"curve_index");
	axis = (Axis) OBJ_GET(widget,"curve_axis");
	mtx_curve_get_coords_at_index(MTX_CURVE(curve),index,&point);
	text = gtk_editable_get_chars(GTK_EDITABLE(widget),0,-1);
	tmpf = (gfloat)strtod(g_strdelimit(text,",.",'.'),NULL);
	if (axis == _X_)
		point.x = tmpf;
	else if (axis == _Y_)
		point.y = tmpf;
	else
		printf(_("ERROR in update_2d_curve()!!!\n"));
	mtx_curve_set_coords_at_index(MTX_CURVE(curve),index,point);
	return FALSE;
}
开发者ID:toxicgumbo,项目名称:MegaTunix,代码行数:31,代码来源:2d_table_editor.c

示例6: selection_changed_callback

static void
selection_changed_callback (GtkWidget *widget,
                            gpointer callback_data)
{
    TargetCallbackData *target_data;
    GtkEditable *editable;
    int start, end;

    target_data = (TargetCallbackData *) callback_data;
    g_assert (target_data != NULL);

    editable = GTK_EDITABLE (widget);
    g_assert (editable != NULL);

    if (gtk_editable_get_selection_bounds (editable, &start, &end) && start != end)
    {
        set_clipboard_menu_items_sensitive (target_data->action_group);
    }
    else
    {
        set_clipboard_menu_items_insensitive (target_data->action_group);
    }
}
开发者ID:City-busz,项目名称:caja,代码行数:23,代码来源:caja-clipboard.c

示例7: category_edit_add_request

/**
 * \internal
 */
static void category_edit_add_request(CategoryEdit * category_edit, GtkWidget *combo)
{
    gchar *name;
    GtkWidget *entry;

    entry = gtk_bin_get_child (GTK_BIN (category_edit->categories_combo));
    gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
    gtk_widget_grab_focus (entry);
    name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
    if (check_duplicate (GEBR_GUI_SEQUENCE_EDIT(category_edit), name) ||
            __category_edit_check_text(name)) {
        g_free(name);
        return;
    }

    debr_has_category(name, TRUE);
    __category_edit_add(category_edit, GEBR_GEOXML_SEQUENCE(gebr_geoxml_flow_append_category(category_edit->menu, name)));

    validate_image_set_check_category_list(category_edit->validate_image, category_edit->menu);
    g_signal_emit_by_name(category_edit, "changed");

    g_free(name);
}
开发者ID:gebrproject,项目名称:gebr.backup,代码行数:26,代码来源:debr-categoryedit.c

示例8: wTextSave

EXPORT wBool_t wTextSave(
		wText_p bt,
		const char * fileName )
{
#ifndef USE_TEXTVIEW
	int siz, pos, cnt;
#endif
	FILE * f;
	char * cp;

	f = fopen( fileName, "w" );
	if (f==NULL) {
		wNoticeEx( NT_ERROR, fileName, "Ok", NULL );
		return FALSE;
	}
#ifdef USE_TEXTVIEW
	cp = gtkGetText( bt );
	fwrite( cp, 1, strlen(cp), f );
	free(cp);
#else
	siz = gtk_text_get_length( GTK_TEXT(bt->text) );
	pos = 0;
	cnt = BUFSIZ;
	while (pos<siz) {
		if (pos+cnt>siz)
			 cnt = siz-pos;
		cp = gtk_editable_get_chars( GTK_EDITABLE(bt->text), pos, pos+cnt );
		if (cp == NULL)
			break;
		fwrite( cp, 1, cnt, f );
		free(cp);
		pos += cnt;
	}
#endif
	fclose(f);
	return TRUE;
}
开发者ID:sharkcz,项目名称:xtrkcad,代码行数:37,代码来源:gtktext.c

示例9: wep_entry_filter_cb

static void
wep_entry_filter_cb (GtkEntry *   entry,
                     const gchar *text,
                     gint         length,
                     gint *       position,
                     gpointer     data)
{
	WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) data;
	GtkEditable *editable = GTK_EDITABLE (entry);
	int i, count = 0;
	gchar *result = g_new (gchar, length);

	if (sec->type == NM_WEP_KEY_TYPE_KEY) {
		for (i = 0; i < length; i++) {
			if (isxdigit(text[i]) || isascii(text[i]))
				result[count++] = text[i];
		}
	} else if (sec->type == NM_WEP_KEY_TYPE_PASSPHRASE) {
		for (i = 0; i < length; i++)
			result[count++] = text[i];
	}

	if (count == 0)
		goto out;

	g_signal_handlers_block_by_func (G_OBJECT (editable),
	                                 G_CALLBACK (wep_entry_filter_cb),
	                                 data);
	gtk_editable_insert_text (editable, result, count, position);
	g_signal_handlers_unblock_by_func (G_OBJECT (editable),
	                                   G_CALLBACK (wep_entry_filter_cb),
	                                   data);

out:
	g_signal_stop_emission_by_name (G_OBJECT (editable), "insert-text");
	g_free (result);
}
开发者ID:mirsal,项目名称:nm-applet,代码行数:37,代码来源:ws-wep-key.c

示例10: create_ring_account

static gboolean
create_ring_account(RingMainWindow *win)
{
    g_return_val_if_fail(IS_RING_MAIN_WINDOW(win), G_SOURCE_REMOVE);
    RingMainWindowPrivate *priv = RING_MAIN_WINDOW_GET_PRIVATE(win);

    /* create account and set UPnP enabled, as its not by default in the daemon */
    const gchar *alias = gtk_entry_get_text(GTK_ENTRY(priv->entry_alias));
    Account *account = AccountModel::instance().add(alias, Account::Protocol::RING);
    account->setDisplayName(alias); // set the display name to the same as the alias
    account->setUpnpEnabled(TRUE);

    /* wait for hash to be generated to show the next view */
    priv->hash_updated = QObject::connect(
        account,
        &Account::changed,
        [=] (Account *a) {
            QString hash = a->username();
            if (!hash.isEmpty()) {
                /* set the hash */
                gtk_entry_set_text(GTK_ENTRY(priv->entry_hash), hash.toUtf8().constData());

                /* show the next accont creation view */
                gtk_stack_set_transition_type(GTK_STACK(priv->stack_main_view), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT);
                gtk_stack_set_visible_child_name(GTK_STACK(priv->stack_main_view), CREATE_ACCOUNT_2_VIEW_NAME);

                /* select the hash text */
                gtk_widget_grab_focus(priv->entry_hash);
                gtk_editable_select_region(GTK_EDITABLE(priv->entry_hash), 0, -1);
            }
        }
    );

    account->performAction(Account::EditAction::SAVE);

    return G_SOURCE_REMOVE;
}
开发者ID:eXcomm,项目名称:ring-client-gnome,代码行数:37,代码来源:ringmainwindow.cpp

示例11: thunar_text_renderer_start_editing

static GtkCellEditable*
thunar_text_renderer_start_editing (GtkCellRenderer     *renderer,
                                    GdkEvent            *event,
                                    GtkWidget           *widget,
                                    const gchar         *path,
                                    GdkRectangle        *background_area,
                                    GdkRectangle        *cell_area,
                                    GtkCellRendererState flags)
{
  ThunarTextRenderer *text_renderer = THUNAR_TEXT_RENDERER (renderer);

  /* verify that we are editable */
  if (renderer->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
    return NULL;

  /* allocate a new text entry widget to be used for editing */
  text_renderer->entry = g_object_new (GTK_TYPE_ENTRY,
                                       "has-frame", FALSE,
                                       "text", text_renderer->text,
                                       "visible", TRUE,
                                       "xalign", renderer->xalign,
                                       NULL);

  /* select the whole text */
  gtk_editable_select_region (GTK_EDITABLE (text_renderer->entry), 0, -1);

  /* remember the tree path that we're editing */
  g_object_set_data_full (G_OBJECT (text_renderer->entry), I_("thunar-text-renderer-path"), g_strdup (path), g_free);

  /* connect required signals */
  g_signal_connect (G_OBJECT (text_renderer->entry), "editing-done", G_CALLBACK (thunar_text_renderer_editing_done), text_renderer);
  g_signal_connect_after (G_OBJECT (text_renderer->entry), "grab-focus", G_CALLBACK (thunar_text_renderer_grab_focus), text_renderer);
  g_signal_connect (G_OBJECT (text_renderer->entry), "focus-out-event", G_CALLBACK (thunar_text_renderer_focus_out_event), text_renderer);
  g_signal_connect (G_OBJECT (text_renderer->entry), "populate-popup", G_CALLBACK (thunar_text_renderer_populate_popup), text_renderer);

  return GTK_CELL_EDITABLE (text_renderer->entry);
}
开发者ID:EchelonTeam,项目名称:sca3_main,代码行数:37,代码来源:thunar-text-renderer.c

示例12: new_chatroom_dialog_update_widgets

static void
new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog)
{
	const gchar           *protocol;

	if (dialog->account == NULL)
		return;

	protocol = tp_account_get_protocol (dialog->account);

	gtk_entry_set_text (GTK_ENTRY (dialog->entry_server), "");

	/* hardcode here known protocols */
	if (strcmp (protocol, "jabber") == 0) {
		gtk_widget_set_sensitive (dialog->entry_server, TRUE);
	}
	else if (strcmp (protocol, "local-xmpp") == 0) {
		gtk_widget_set_sensitive (dialog->entry_server, FALSE);
	}
	else if (strcmp (protocol, "irc") == 0) {
		gtk_widget_set_sensitive (dialog->entry_server, FALSE);
	}
	else {
		gtk_widget_set_sensitive (dialog->entry_server, TRUE);
	}

	if (!tp_strdiff (protocol, "irc"))
		gtk_entry_set_text (GTK_ENTRY (dialog->entry_room), "#");
	else
		gtk_entry_set_text (GTK_ENTRY (dialog->entry_room), "");

	update_join_button_sensitivity (dialog);

	/* Final set up of the dialog */
	gtk_widget_grab_focus (dialog->entry_room);
	gtk_editable_set_position (GTK_EDITABLE (dialog->entry_room), -1);
}
开发者ID:DylanMcCall,项目名称:Empathy---Hide-contact-groups,代码行数:37,代码来源:empathy-new-chatroom-dialog.c

示例13: ags_machine_popup_rename_audio_response_callback

int
ags_machine_popup_rename_audio_response_callback(GtkWidget *widget, gint response, AgsMachine *machine)
{
  if(response == GTK_RESPONSE_ACCEPT){
    GList *children;

    gchar *str;

    children = gtk_container_get_children((GtkContainer *) GTK_DIALOG(widget)->vbox);
    
    str = gtk_editable_get_chars(GTK_EDITABLE(children->data),
				 0, -1);
    g_object_set(machine->audio,
		 "audio-name", str,
		 NULL);
    
    g_list_free(children);
  }
  
  machine->rename_audio = NULL;
  gtk_widget_destroy(widget);

  return(0);
}
开发者ID:gsequencer,项目名称:gsequencer,代码行数:24,代码来源:ags_machine_callbacks.c

示例14: integer_set

static void
integer_set(node_gui_t *ng)
{
    unsigned long oldvalue;
    const cml_atom *oldvalue_a;
    unsigned long newvalue;
    char *newvalue_str;
    
    oldvalue_a = cml_node_get_value(ng->node);
    oldvalue = oldvalue_a->value.integer;
    newvalue_str = gtk_editable_get_chars(GTK_EDITABLE(ng->entry), 0, -1);
    newvalue = (unsigned long)strtoul(newvalue_str, 0, 0);
    
    if (oldvalue != newvalue)
    {
	cml_atom a;
	a.type = oldvalue_a->type;
	a.value.integer = newvalue;
	set_value(ng->node, &a);
    }
    integer_update_value(ng);

    g_free(newvalue_str);
}
开发者ID:cooljeanius,项目名称:gcml2-0.7.1,代码行数:24,代码来源:integer.c

示例15: wTextPrint

EXPORT wBool_t wTextPrint(
		wText_p bt )
{
	wPrinterStream_p f;
#ifndef USE_TEXTVIEW
	int siz, pos, cnt;
#endif
	char * cp;

	f = wPrinterOpen();
	if (f==NULL) {
		return FALSE;
	}
#ifdef USE_TEXTVIEW
	cp = gtkGetText( bt );
	wPrinterWrite( f, cp, strlen(cp) );
	free(cp);

#else
	siz = gtk_text_get_length( GTK_TEXT(bt->text) );
	pos = 0;
	cnt = BUFSIZ;
	while (pos<siz) {
		if (pos+cnt>siz)
			 cnt = siz-pos;
		cp = gtk_editable_get_chars( GTK_EDITABLE(bt->text), pos, pos+cnt );
		if (cp == NULL)
			break;
		wPrinterWrite( f, cp, cnt );
		free(cp);
		pos += cnt;
	}
#endif
	wPrinterClose(f);
	return TRUE;
}
开发者ID:sharkcz,项目名称:xtrkcad,代码行数:36,代码来源:gtktext.c


注:本文中的GTK_EDITABLE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。