本文整理汇总了C++中GTK_IS_ENTRY函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_IS_ENTRY函数的具体用法?C++ GTK_IS_ENTRY怎么用?C++ GTK_IS_ENTRY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_IS_ENTRY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_bookmark_from_text
static void
update_bookmark_from_text (void)
{
if (text_changed) {
NautilusBookmark *bookmark, *bookmark_in_list;
char *name;
GdkPixbuf *pixbuf;
guint selected_row;
GtkTreeIter iter;
GFile *location;
g_assert (GTK_IS_ENTRY (name_field));
g_assert (GTK_IS_ENTRY (uri_field));
location = g_file_new_for_uri (gtk_entry_get_text (GTK_ENTRY (uri_field)));
bookmark = nautilus_bookmark_new_with_icon (location, gtk_entry_get_text (GTK_ENTRY (name_field)),
name_text_changed, NULL);
g_object_unref (location);
selected_row = get_selected_row ();
/* turn off list updating 'cuz otherwise the list-reordering code runs
* after repopulate(), thus reordering the correctly-ordered list.
*/
g_signal_handler_block (bookmarks,
bookmark_list_changed_signal_id);
nautilus_bookmark_list_delete_item_at (bookmarks, selected_row);
nautilus_bookmark_list_insert_item (bookmarks, bookmark, selected_row);
g_signal_handler_unblock (bookmarks,
bookmark_list_changed_signal_id);
g_object_unref (bookmark);
/* We also have to update the bookmark pointer in the list
store. */
gtk_tree_selection_get_selected (bookmark_selection,
NULL, &iter);
g_signal_handler_block (bookmark_list_store,
row_changed_signal_id);
bookmark_in_list = nautilus_bookmark_list_item_at (bookmarks,
selected_row);
name = nautilus_bookmark_get_name (bookmark_in_list);
pixbuf = nautilus_bookmark_get_pixbuf (bookmark_in_list, GTK_ICON_SIZE_MENU);
gtk_list_store_set (bookmark_list_store, &iter,
BOOKMARK_LIST_COLUMN_BOOKMARK, bookmark_in_list,
BOOKMARK_LIST_COLUMN_NAME, name,
BOOKMARK_LIST_COLUMN_ICON, pixbuf,
-1);
g_signal_handler_unblock (bookmark_list_store,
row_changed_signal_id);
gdk_pixbuf_unref (pixbuf);
g_free (name);
}
}
示例2: UT_DEBUGMSG
void TCPUnixAccountHandler::loadProperties()
{
UT_DEBUGMSG(("TCPUnixAccountHandler::loadProperties()\n"));
bool serve = getProperty("server") == "";
if (server_button && GTK_IS_TOGGLE_BUTTON(server_button))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(server_button), serve);
if (client_button && GTK_IS_TOGGLE_BUTTON(client_button))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(client_button), !serve);
if (server_entry && GTK_IS_ENTRY(server_entry))
gtk_entry_set_text(GTK_ENTRY(server_entry), getProperty("server").c_str());
int port = DEFAULT_TCP_PORT;
try {
if (hasProperty("port"))
port = boost::lexical_cast<int>(getProperty("port"));
} catch (boost::bad_lexical_cast &) {
UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
}
if (port_button && GTK_IS_ENTRY(port_button))
gtk_spin_button_set_value(GTK_SPIN_BUTTON(port_button), port);
if (allow_all_button && GTK_IS_TOGGLE_BUTTON(allow_all_button))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(allow_all_button), hasProperty("allow-all") ? getProperty("allow-all") == "true" : false);
bool autoconnect = hasProperty("autoconnect") ? getProperty("autoconnect") == "true" : true;
if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autoconnect_button), autoconnect);
}
示例3: addProperty
void SIPSimpleUnixAccountHandler::storeProperties()
{
if (address_entry && GTK_IS_ENTRY(address_entry))
addProperty("address", gtk_entry_get_text(GTK_ENTRY(address_entry)));
if (password_entry && GTK_IS_ENTRY(password_entry))
addProperty("password", gtk_entry_get_text(GTK_ENTRY(password_entry)));
if (proxy_entry && GTK_IS_ENTRY(proxy_entry))
addProperty("outbound-proxy", gtk_entry_get_text(GTK_ENTRY(proxy_entry)));
if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button))
addProperty("autoconnect", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(autoconnect_button)) ? "true" : "false" );
}
示例4: e_widget_undo_attach
/**
* e_widget_undo_attach:
* @widget: a #GtkWidget, where to attach undo functionality
* @focus_tracker: an #EFocusTracker, can be %NULL
*
* The function does nothing, if the widget is not of a supported type
* for undo functionality, same as when the undo is already attached.
* It is ensured that the actions of the provided @focus_tracker are
* updated on change of the @widget.
*
* See @e_widget_undo_is_attached().
*
* Since: 3.12
**/
void
e_widget_undo_attach (GtkWidget *widget,
EFocusTracker *focus_tracker)
{
EUndoData *data;
if (e_widget_undo_is_attached (widget))
return;
if (GTK_IS_EDITABLE (widget)) {
data = g_new0 (EUndoData, 1);
data->undo_len = DEFAULT_MAX_UNDO_LEVEL;
data->undo_stack = g_new0 (EUndoInfo *, data->undo_len);
g_object_set_data_full (G_OBJECT (widget), UNDO_DATA_KEY, data, free_undo_data);
data->insert_handler_id = g_signal_connect (
widget, "insert-text",
G_CALLBACK (editable_undo_insert_text_cb), NULL);
data->delete_handler_id = g_signal_connect (
widget, "delete-text",
G_CALLBACK (editable_undo_delete_text_cb), NULL);
if (focus_tracker)
g_signal_connect_swapped (
widget, "changed",
G_CALLBACK (e_focus_tracker_update_actions), focus_tracker);
if (GTK_IS_ENTRY (widget))
g_signal_connect (
widget, "populate-popup",
G_CALLBACK (widget_undo_populate_popup_cb), NULL);
} else if (GTK_IS_TEXT_VIEW (widget)) {
示例5: wxCHECK_MSG
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
{
GtkEntry* const entry = (GtkEntry*)GetEditable();
wxCHECK_MSG(GTK_IS_ENTRY(entry), false, "auto completion doesn't work with this control");
GtkListStore * const store = gtk_list_store_new(1, G_TYPE_STRING);
GtkTreeIter iter;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( wxArrayString::const_iterator i = choices.begin();
i != choices.end();
++i )
{
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, (const gchar *)i->utf8_str(),
-1);
}
GtkEntryCompletion * const completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_set_completion(entry, completion);
g_object_unref(completion);
return true;
}
示例6: ce_page_mac_entry_valid
gboolean
ce_page_mac_entry_valid (GtkEntry *entry, int type, const char *property_name, GError **error)
{
const char *mac;
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
mac = gtk_entry_get_text (entry);
if (mac && *mac) {
if (!nm_utils_hwaddr_valid (mac, nm_utils_hwaddr_len (type))) {
const char *addr_type;
addr_type = type == ARPHRD_ETHER ? _("MAC address") : _("HW address");
if (property_name) {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC,
_("invalid %s for %s (%s)"),
addr_type, property_name, mac);
} else {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC,
_("invalid %s (%s)"),
addr_type, mac);
}
return FALSE;
}
}
return TRUE;
}
示例7: node
//--------------------------------------------------------------------------------
void DbMySQLTableEditorFKPage::cell_editing_started(GtkCellRenderer* cr, GtkCellEditable* ce, gchar* path, gpointer udata)
{
DbMySQLTableEditorFKPage* self = reinterpret_cast<DbMySQLTableEditorFKPage*>(udata);
bec::NodeId node(path);
if ( node.is_valid() )
self->_fk_node = node;
if ( GTK_IS_ENTRY(ce) ) // Fill in name of the foreign key column
{
::bec::FKConstraintListBE *fk_be = self->_be->get_fks();
Gtk::Entry* entry = Glib::wrap(GTK_ENTRY(ce));
std::string name;
if (node.back() == fk_be->count()-1)
fk_be->set_field(node, bec::FKConstraintListBE::Name, 1);
fk_be->get_field(node, bec::FKConstraintListBE::Name, name);
entry->set_text(name);
}
// clean up edit_done signal/slotl
if ( self->_ce && self->_edit_conn )
{
g_signal_handler_disconnect (self->_ce, self->_edit_conn);
self->_ce = 0;
self->_edit_conn = 0;
}
if (GTK_IS_CELL_EDITABLE(ce))
{
self->_ce = ce;
self->_edit_conn = g_signal_connect(ce, "editing-done", GCallback(&DbMySQLTableEditorFKPage::cell_editing_done), udata);
}
}
示例8: wxASSERT_MSG
wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const
{
wxASSERT_MSG( m_widget, wxS("GetSizeFromTextSize called before creation") );
// a GtkEntry for wxComboBox and a GtkCellView for wxChoice
GtkWidget* childPart = gtk_bin_get_child(GTK_BIN(m_widget));
// Set a as small as possible size for the control, so preferred sizes
// return "natural" sizes, not taking into account the previous ones (which
// seems to be GTK+3 behaviour)
gtk_widget_set_size_request(m_widget, 0, 0);
// We are interested in the difference of sizes between the whole contol
// and its child part. I.e. arrow, separators, etc.
GtkRequisition req;
gtk_widget_get_preferred_size(childPart, NULL, &req);
wxSize totalS = GTKGetPreferredSize(m_widget);
wxSize tsize(xlen + totalS.x - req.width, totalS.y);
// For a wxChoice, not for wxComboBox, add some margins
if ( !GTK_IS_ENTRY(childPart) )
tsize.IncBy(5, 0);
// Perhaps the user wants something different from CharHeight
if ( ylen > 0 )
tsize.IncBy(0, ylen - GetCharHeight());
return tsize;
}
示例9: setValueFloat
/** set the widget value as float */
void XAP_UnixWidget::setValueFloat(float val)
{
if (GTK_IS_ENTRY(m_widget)) {
std::string str = UT_std_string_sprintf("%f", val);
gtk_entry_set_text(GTK_ENTRY(m_widget), str.c_str());
}
}
示例10: cterm_set_term_title_dialog_onresponse
void cterm_set_term_title_dialog_onresponse(GtkWidget* dialog, int response, gpointer data) {
CTerm* term = (CTerm*) data;
GtkWidget* content_area;
GtkWidget* widget;
GtkWidget* entry = NULL;
const gchar* new_title;
GList* node;
GList* list;
if(response == GTK_RESPONSE_OK) {
// Get entry widget from dialog
content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
list = GTK_BOX(content_area)->children;
for(node = list; node; node = node->next) {
widget = ((GtkBoxChild*) node->data)->widget;
if(GTK_IS_ENTRY(widget)) {
entry = widget;
break;
}
}
if(entry) {
new_title = gtk_entry_get_text(GTK_ENTRY(entry));
gtk_window_set_title(GTK_WINDOW(term->window), new_title);
} else {
fprintf(stderr, "Error: Could not find entry in dialog widget!\n");
}
}
gtk_widget_destroy(dialog);
}
示例11: on_insert_clicked
/*
* Our callbacks to insert/find/retrieve text from one widget to another.
*/
static void
on_insert_clicked (GtkButton *button,
Widgets *w)
{
g_return_if_fail (GTK_IS_TEXT_VIEW(w->textview));
g_return_if_fail (GTK_IS_ENTRY(w->entry));
/*
* The subtle difference between a text mark and a text iter: one is a
* GObject, the other is not. Also, when GtkTextIter is called "opaque", as
* in "private", it actually isn't all that private. But please, pretend to
* use it as if it were ... It is A-OK to put text iterators on the stack!
* Furthermore, iterators are invalidated after *every* use, so create one,
* use often!
*/
GtkTextBuffer *buffer;
GtkTextMark *mark;
GtkTextIter iter = {0,};
const gchar *text;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(w->textview));
text = gtk_entry_get_text (GTK_ENTRY(w->entry));
/*
* Sets text marker to current cursor position. Also, cursors are simply
* *visible* text markers. -1 means "read until \0".
*/
mark = gtk_text_buffer_get_insert (buffer);
gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark);
gtk_text_buffer_insert (buffer, &iter, text, -1);
}
示例12: _fcitx_im_context_set_capacity
void
_fcitx_im_context_set_capacity(FcitxIMContext* fcitxcontext, gboolean force)
{
if (fcitx_client_is_valid(fcitxcontext->client)) {
FcitxCapacityFlags flags = fcitxcontext->capacity & ~(CAPACITY_PREEDIT | CAPACITY_FORMATTED_PREEDIT | CAPACITY_PASSWORD);
if (fcitxcontext->use_preedit)
flags |= CAPACITY_PREEDIT | CAPACITY_FORMATTED_PREEDIT;
if (fcitxcontext->client_window != NULL) {
GtkWidget *widget;
gdk_window_get_user_data (fcitxcontext->client_window,
(gpointer *)&widget);
if (GTK_IS_ENTRY (widget) &&
!gtk_entry_get_visibility (GTK_ENTRY (widget))) {
flags |= CAPACITY_PASSWORD;
}
}
gboolean update = FALSE;
if (G_UNLIKELY(fcitxcontext->capacity != flags)) {
fcitxcontext->capacity = flags;
update = TRUE;
}
if (G_UNLIKELY(update || force))
fcitx_client_set_capacity(fcitxcontext->client, fcitxcontext->capacity);
}
}
示例13: confirm_callback
/* When enter is pressed in the confirm entry, move */
static void
confirm_callback (GtkWidget *widget, GtkDialog *dialog)
{
GtkWidget *entry = GTK_WIDGET (g_object_get_data (G_OBJECT (dialog), "secure-entry"));
g_assert (GTK_IS_ENTRY (entry));
gtk_widget_grab_focus (entry);
}
示例14: preferences_widget_sync_string
static void
preferences_widget_sync_string (const gchar *key, GtkWidget *widget)
{
gchar *value;
if (empathy_conf_get_string (empathy_conf_get (), key, &value) && value) {
if (GTK_IS_ENTRY (widget)) {
gtk_entry_set_text (GTK_ENTRY (widget), value);
} else if (GTK_IS_RADIO_BUTTON (widget)) {
if (strcmp (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM) == 0) {
GType type;
GEnumClass *enum_class;
GEnumValue *enum_value;
GSList *list;
GtkWidget *toggle_widget;
/* Get index from new string */
type = empathy_contact_list_store_sort_get_type ();
enum_class = G_ENUM_CLASS (g_type_class_peek (type));
enum_value = g_enum_get_value_by_nick (enum_class, value);
if (enum_value) {
list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
toggle_widget = g_slist_nth_data (list, enum_value->value);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle_widget), TRUE);
}
} else {
g_warning ("Unhandled key:'%s' just had string change", key);
}
}
g_free (value);
}
}
示例15: contacts_remove_entries
/* Helper method to clear the text in a GtkEntry or GtkTextView and hide it */
static void
contacts_remove_entries (GtkWidget *entry)
{
if (GTK_IS_ENTRY (entry)) {
if (gtk_widget_get_ancestor (entry, GTK_TYPE_COMBO_BOX_ENTRY))
return;
gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_widget_hide (entry);
} else if (GTK_IS_TEXT_VIEW (entry)) {
GtkTextBuffer *buffer =
gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry));
gtk_text_buffer_set_text (buffer, "", -1);
entry = gtk_widget_get_ancestor (entry, GTK_TYPE_BIN);
gtk_widget_hide (entry);
} else if (GTK_IS_CONTAINER (entry)) {
GList *c, *children =
gtk_container_get_children (GTK_CONTAINER (entry));
for (c = children; c; c = c->next)
contacts_remove_entries (GTK_WIDGET (c->data));
gtk_widget_hide (entry);
g_list_free (children);
}
}