本文整理汇总了C++中GTK_LIST函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_LIST函数的具体用法?C++ GTK_LIST怎么用?C++ GTK_LIST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_LIST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetID3Genre
void SetID3Genre(GripInfo *ginfo,int id3_genre)
{
GtkWidget *item;
item=
GTK_WIDGET(g_list_nth(ginfo->gui_info.id3_genre_item_list,
ID3GenrePos(id3_genre))->data);
gtk_list_select_child(GTK_LIST(GTK_COMBO(ginfo->gui_info.id3_genre_combo)->
list),item);
}
示例2: add_message
static void add_message(GtkWidget *list, const char *str, ...)
{
static int line = 0;
va_list ap;
char buf[BUFSIZ];
GList *items = NULL;
GtkWidget *item;
va_start(ap, str);
vsnprintf(buf, sizeof(buf), str, ap);
va_end(ap);
item = gtk_list_item_new_with_label(buf);
gtk_widget_show(item);
items = g_list_append(items, item);
gtk_list_append_items(GTK_LIST(list), items);
line++;
gtk_list_scroll_vertical(GTK_LIST(list), GTK_SCROLL_JUMP, 1.0);
}
示例3: layer_dialog_set_diagram
void
layer_dialog_set_diagram(Diagram *dia)
{
DiagramData *data;
GtkWidget *layer_widget;
Layer *layer;
Layer *active_layer = NULL;
int sel_pos;
int i,j;
if (dia!=NULL)
active_layer = dia->data->active_layer;
if (layer_dialog == NULL || layer_dialog->dialog == NULL)
layer_dialog_create(); /* May have been destroyed */
g_assert(layer_dialog != NULL); /* must be valid now */
gtk_container_foreach (GTK_CONTAINER(layer_dialog->layer_list),
_layer_widget_clear_layer, NULL);
gtk_list_clear_items(GTK_LIST(layer_dialog->layer_list), 0, -1);
layer_dialog->diagram = dia;
if (dia != NULL) {
i = g_list_index(dia_open_diagrams(), dia);
if (i >= 0 && layer_dialog->diagram_omenu != NULL)
gtk_option_menu_set_history(GTK_OPTION_MENU(layer_dialog->diagram_omenu),
i);
}
if (dia != NULL) {
data = dia->data;
sel_pos = 0;
for (i=data->layers->len-1,j=0; i>=0; i--,j++) {
layer = (Layer *) g_ptr_array_index(data->layers, i);
layer_widget = dia_layer_widget_new(dia, layer);
gtk_widget_show(layer_widget);
gtk_container_add(GTK_CONTAINER(layer_dialog->layer_list), layer_widget);
if (layer==active_layer)
sel_pos = j;
}
gtk_list_select_item(GTK_LIST(layer_dialog->layer_list), sel_pos);
}
}
示例4: _combo_simple_entry_change
static int
_combo_simple_entry_change(GtkEntry * entry, gpointer data)
{
GtkCombo *cb = GTK_COMBO(data);
int i;
i = _combo_simple_find_in_list(cb, gtk_entry_get_text(entry));
if (i == -1)
gtk_list_unselect_all(GTK_LIST(cb->list));
else
{
gtk_signal_handler_block_by_func(GTK_OBJECT(cb->list), GSF(_combo_simple_list_select), data);
gtk_list_select_item(GTK_LIST(cb->list), i);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(cb->list), GSF(_combo_simple_list_select), data);
}
return 0;
}
示例5: gb_combo_set_properties
/*
* Sets the properties of the widget. This is used for both applying the
* properties changed in the property editor, and also for loading.
*/
static void
gb_combo_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
gboolean value_in_list, ok_if_empty, case_sensitive, arrows, arrows_always;
gchar *items;
GList *item_list = NULL;
value_in_list = gb_widget_input_bool (data, ValueInList);
if (data->apply)
{
gtk_object_set_data (GTK_OBJECT (widget), ValueInList,
value_in_list ? "TRUE" : NULL);
}
ok_if_empty = gb_widget_input_bool (data, OKIfEmpty);
if (data->apply)
{
gtk_object_set_data (GTK_OBJECT (widget), OKIfEmpty,
ok_if_empty ? "TRUE" : NULL);
}
case_sensitive = gb_widget_input_bool (data, Case);
if (data->apply)
gtk_combo_set_case_sensitive (GTK_COMBO (widget), case_sensitive);
arrows = gb_widget_input_bool (data, Arrows);
if (data->apply)
gtk_combo_set_use_arrows (GTK_COMBO (widget), arrows);
arrows_always = gb_widget_input_bool (data, Always);
if (data->apply)
gtk_combo_set_use_arrows_always (GTK_COMBO (widget), arrows_always);
items = gb_widget_input_text (data, Items);
if (data->apply)
{
gchar *pos = items;
gchar *items_end = &items[strlen (items)];
while (pos < items_end)
{
gchar *item_end = strchr (pos, '\n');
if (item_end == NULL)
item_end = items_end;
*item_end = '\0';
item_list = g_list_append (item_list, pos);
pos = item_end + 1;
}
if (item_list)
gtk_combo_set_popdown_strings (GTK_COMBO (widget), item_list);
else
gtk_list_clear_items (GTK_LIST (GTK_COMBO (widget)->list), 0, -1);
g_list_free (item_list);
}
if (data->action == GB_APPLYING)
g_free (items);
}
示例6: wxCHECK_MSG
int wxComboBox::DoInsert(const wxString &item, unsigned int pos)
{
wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1,
wxT("can't insert into sorted list"));
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index") );
unsigned int count = GetCount();
if (pos == count)
return Append(item);
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
gtk_combo_box_insert_text( combobox, pos, wxGTK_CONV( item ) );
}
else
#endif
{
DisableEvents();
GtkWidget *list = GTK_COMBO(m_widget)->list;
GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( item ) );
GList *gitem_list = g_list_alloc ();
gitem_list->data = list_item;
gtk_list_insert_items( GTK_LIST (list), gitem_list, pos );
if (GTK_WIDGET_REALIZED(m_widget))
{
gtk_widget_realize( list_item );
gtk_widget_realize( GTK_BIN(list_item)->child );
ApplyWidgetStyle();
}
gtk_widget_show( list_item );
EnableEvents();
}
count = GetCount();
if ( m_clientDataList.GetCount() < count )
m_clientDataList.Insert( pos, (wxObject*) NULL );
if ( m_clientObjectList.GetCount() < count )
m_clientObjectList.Insert( pos, (wxObject*) NULL );
InvalidateBestSize();
return pos;
}
示例7: clip_GTK_LISTTOGGLEFOCUSROW
/* Toggles the focus row. If the focus row is selected, it's unselected.
* If the focus row is unselected, it's selected. If the selection mode of
* list is GTK_SELECTION_BROWSE, this has no effect, as the selection is
* always at the focus row. */
int
clip_GTK_LISTTOGGLEFOCUSROW(ClipMachine * ClipMachineMemory)
{
C_widget *clst = _fetch_cw_arg(ClipMachineMemory);
CHECKCWID(clst, GTK_IS_LIST);
gtk_list_toggle_focus_row(GTK_LIST(clst->widget));
return 0;
err:
return 1;
}
示例8: clip_GTK_LISTUNSELECTALL
/* Unselects all children of list. A signal will
* be emitted for each newly unselected child. */
int
clip_GTK_LISTUNSELECTALL(ClipMachine * ClipMachineMemory)
{
C_widget *clst = _fetch_cw_arg(ClipMachineMemory);
CHECKCWID(clst, GTK_IS_LIST);
gtk_list_unselect_all(GTK_LIST(clst->widget));
return 0;
err:
return 1;
}
示例9: okButton_clicked
static void okButton_clicked( GtkWidget *widget, void *data )
{
gtk_widget_hide( microcodeWindow );
if (GTK_LIST(microcodeList)->selection != 0)
{
char *text = 0;
GtkListItem *item = GTK_LIST_ITEM(GTK_LIST(microcodeList)->selection->data);
GtkLabel *label = GTK_LABEL(GTK_BIN(item)->child);
gtk_label_get( label, &text );
if (text != 0)
for (int i = 0; i < numMicrocodeTypes; i++)
if (!strcmp( text, MicrocodeTypes[i] ))
{
selectedMicrocode = i;
return;
}
}
selectedMicrocode = NONE;
}
示例10: layer_dialog_rename_callback
static void
layer_dialog_rename_callback(GtkWidget *widget, gpointer gdata)
{
GtkWidget *selected;
Diagram *dia;
Layer *layer;
dia = layer_dialog->diagram;
selected = GTK_LIST(layer_dialog->layer_list)->selection->data;
layer = dia->data->active_layer;
layer_dialog_edit_layer (DIA_LAYER_WIDGET (selected), dia, layer);
}
示例11: clip_GTK_LISTTOGGLEADDMODE
/* Toggles between adding to the selection and beginning a new selection.
* Only in GTK_SELECTION_EXTENDED. Useful with gtk_list_extend_selection. */
int
clip_GTK_LISTTOGGLEADDMODE(ClipMachine * ClipMachineMemory)
{
C_widget *clst = _fetch_cw_arg(ClipMachineMemory);
CHECKCWID(clst, GTK_IS_LIST);
gtk_list_toggle_add_mode(GTK_LIST(clst->widget));
return 0;
err:
return 1;
}
示例12: wxCHECK_MSG
unsigned int wxComboBox::GetCount() const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
unsigned int count = 0;
while (child) { count++; child = child->next; }
return count;
}
示例13: clip_GTK_LISTENDDRAGSELECTION
/* Stops the drag selection mode and ungrabs the pointer.
* This has no effect if a drag selection is not active. */
int
clip_GTK_LISTENDDRAGSELECTION(ClipMachine * ClipMachineMemory)
{
C_widget *clst = _fetch_cw_arg(ClipMachineMemory);
CHECKCWID(clst, GTK_IS_LIST);
gtk_list_end_drag_selection(GTK_LIST(clst->widget));
return 0;
err:
return 1;
}
示例14: UponBuiltinLibOptionsRemoveButtonClicked
void UponBuiltinLibOptionsRemoveButtonClicked (GtkWidget * dialogue)
{
GtkList *sourceList = GTK_LIST (gtk_object_get_data (GTK_OBJECT (dialogue), "SourceList"));
GList *selection = sourceList->selection;
if (!selection)
return;
GList *copy = g_list_copy (selection);
gtk_list_remove_items (sourceList, copy);
g_list_free (copy);
}
示例15: layer_dialog_new_callback
static void
layer_dialog_new_callback(GtkWidget *widget, gpointer gdata)
{
Layer *layer;
Diagram *dia;
GtkWidget *selected;
GList *list = NULL;
GtkWidget *layer_widget;
int pos;
static int next_layer_num = 1;
dia = layer_dialog->diagram;
if (dia != NULL) {
gchar* new_layer_name = g_strdup_printf(_("New layer %d"),
next_layer_num++);
layer = new_layer(new_layer_name, dia->data);
assert(GTK_LIST(layer_dialog->layer_list)->selection != NULL);
selected = GTK_LIST(layer_dialog->layer_list)->selection->data;
pos = gtk_list_child_position(GTK_LIST(layer_dialog->layer_list), selected);
data_add_layer_at(dia->data, layer, dia->data->layers->len - pos);
diagram_add_update_all(dia);
diagram_flush(dia);
layer_widget = dia_layer_widget_new(dia, layer);
gtk_widget_show(layer_widget);
list = g_list_prepend(list, layer_widget);
gtk_list_insert_items(GTK_LIST(layer_dialog->layer_list), list, pos);
gtk_list_select_item(GTK_LIST(layer_dialog->layer_list), pos);
undo_layer(dia, layer, TYPE_ADD_LAYER, dia->data->layers->len - pos);
undo_set_transactionpoint(dia->undo);
}
}