Пример #1
0
Файл: grun.c Проект: badcodes/c
int main(int argc,char** argv)
{
    GtkWidget *window;
    GtkWidget *combox;
    GtkWidget *button;
    GtkWidget *hbox;
    GtkWidget *entry;
    gtk_init(&argc,&argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(destroy),NULL);
    g_signal_connect(G_OBJECT(window),"delete_event",G_CALLBACK(destroy),NULL);
    hbox = gtk_hbox_new(0,4);
    combox = gtk_combo_box_entry_new();
    entry = gtk_bin_get_child(GTK_BIN(combox));
    g_signal_connect(G_OBJECT(entry),"key_press_event",G_CALLBACK(on_key_press),entry);
    button = gtk_button_new_with_label("Start");
    g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(hello),combox);
    gtk_container_add(GTK_CONTAINER(hbox),combox);
    gtk_container_add(GTK_CONTAINER(hbox),button);
    gtk_container_add(GTK_CONTAINER(window),hbox);
    gtk_widget_show(combox);
    gtk_widget_show(button);
    gtk_widget_show(hbox);
    gtk_widget_show(window);
    gtk_main();
    return 0;
}
Пример #2
0
// static
wxVisualAttributes
wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{
#ifdef __WXGTK3__
    return GetDefaultAttributesFromGTKWidget(gtk_combo_box_new_with_entry(), true);
#else
    return GetDefaultAttributesFromGTKWidget(gtk_combo_box_entry_new(), true);
#endif
}
Пример #3
0
/*#
    @class GtkComboBoxEntry
    @brief A text entry field with a dropdown list

    A GtkComboBoxEntry is a widget that allows the user to choose from a list of
    valid choices or enter a different value. It is very similar to a GtkComboBox,
    but it displays the selected value in an entry to allow modifying it.

    In contrast to a GtkComboBox, the underlying model of a GtkComboBoxEntry must
    always have a text column (see gtk_combo_box_entry_set_text_column()), and the
    entry will show the content of the text column in the selected row. To get the
    text from the entry, use gtk_combo_box_get_active_text().

    The changed signal will be emitted while typing into a GtkComboBoxEntry, as well
    as when selecting an item from the GtkComboBoxEntry's list.
    Use gtk_combo_box_get_active() or gtk_combo_box_get_active_iter() to discover
    whether an item was actually selected from the list.

    Connect to the activate signal of the GtkEntry (use gtk_bin_get_child()) to
    detect when the user actually finishes entering text.

    The convenience API to construct simple text-only GtkComboBoxes can also be
    used with GtkComboBoxEntrys which have been constructed with gtk_combo_box_entry_new_text().

    If you have special needs that go beyond a simple entry (e.g. input validation),
    it is possible to replace the child entry by a different widget using
    gtk_container_remove() and gtk_container_add().
 */
FALCON_FUNC ComboBoxEntry::init( VMARG )
{
#ifndef NO_PARAMETER_CHECK
    if ( vm->paramCount() )
        throw_require_no_args();
#endif
    MYSELF;
    GtkWidget* wdt = gtk_combo_box_entry_new();
    self->setObject( (GObject*) wdt );
}
Пример #4
0
static GtkWidget *
create_comboboxentry(void)
{
  GtkWidget *comboboxentry, *entry;

  comboboxentry = gtk_combo_box_entry_new();
  gtk_combo_box_set_active(GTK_COMBO_BOX(comboboxentry), -1);
  gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(comboboxentry), 0);
  entry = gtk_bin_get_child(GTK_BIN(comboboxentry));
  gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE);
  gtk_widget_show(comboboxentry);
  return comboboxentry;
}
Пример #5
0
int
clip_GTK_COMBOBOXENTRYNEW(ClipMachine * cm)
{
	ClipVar * cv   = _clip_spar(cm, 1);
	GtkWidget *wid = NULL;
	C_widget *cwid;

	CHECKOPT(1,MAP_t);

	wid = gtk_combo_box_entry_new();
	if (!wid) goto err;
	cwid = _register_widget(cm, wid, cv);
	_clip_mclone(cm,RETPTR(cm),&cwid->obj);

	return 0;
err:
	return 1;
}
Пример #6
0
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE model_or_false, text_column;
    GtkWidget* widget;

    rb_scan_args(argc, argv, "02", &model_or_false, &text_column);

    if (rb_obj_is_kind_of(model_or_false, GTYPE2CLASS(GTK_TYPE_TREE_MODEL))){
        widget = gtk_combo_box_entry_new_with_model(
            GTK_TREE_MODEL(RVAL2GOBJ(model_or_false)),
            NUM2INT(text_column));
    } else if (NIL_P(model_or_false) || TYPE(model_or_false) == T_TRUE){
        widget = gtk_combo_box_entry_new_text();
    } else if (TYPE(model_or_false) == T_FALSE){
        widget = gtk_combo_box_entry_new();
    } else {
        rb_raise(rb_eArgError, "invalid 2nd argument %s (except true/false or Gtk::TreeModel)", 
                 rb_class2name(CLASS_OF(model_or_false)));
    }

    RBGTK_INITIALIZE(self, widget);
    return Qnil;
}
Пример #7
0
GtkWidget *
gtk_combo_box_text_new_with_entry   (void) {
    return gtk_combo_box_entry_new ();
}
Пример #8
0
static void
hildon_find_toolbar_init                        (HildonFindToolbar *self)
{
    GtkToolItem *label_container;
    GtkToolItem *entry_combo_box_container;
    GtkAlignment *alignment;

    HildonFindToolbarPrivate *priv = HILDON_FIND_TOOLBAR_GET_PRIVATE (self);
    g_assert (priv);

    /* Create the label */
    priv->label = gtk_label_new (_("ecdg_ti_find_toolbar_label"));

    gtk_misc_set_padding (GTK_MISC (priv->label), FIND_LABEL_XPADDING,
            FIND_LABEL_YPADDING);

    label_container = gtk_tool_item_new ();
    gtk_container_add (GTK_CONTAINER (label_container), 
            priv->label);

    gtk_widget_show_all (GTK_WIDGET (label_container));
    gtk_toolbar_insert (GTK_TOOLBAR (self), label_container, -1);

    /* ComboBoxEntry for search prefix string / history list */
    priv->entry_combo_box = GTK_COMBO_BOX_ENTRY (gtk_combo_box_entry_new ());

#ifdef MAEMO_GTK
    g_signal_connect (hildon_find_toolbar_get_entry(priv),
            "invalid_input", 
            G_CALLBACK(hildon_find_toolbar_emit_invalid_input), self);
#endif

    entry_combo_box_container = gtk_tool_item_new ();
    alignment = GTK_ALIGNMENT (gtk_alignment_new (0, 0.5, 1, 0));

    gtk_tool_item_set_expand (entry_combo_box_container, TRUE);
    gtk_container_add (GTK_CONTAINER (alignment),
            GTK_WIDGET (priv->entry_combo_box));
    gtk_container_add (GTK_CONTAINER (entry_combo_box_container),
            GTK_WIDGET (alignment));
    gtk_widget_show_all(GTK_WIDGET (entry_combo_box_container));
    gtk_toolbar_insert (GTK_TOOLBAR (self), entry_combo_box_container, -1);
    g_signal_connect (hildon_find_toolbar_get_entry (priv),
            "activate",
            G_CALLBACK(hildon_find_toolbar_entry_activate), self);

    /* Find button */
    priv->find_button = gtk_tool_button_new (
            gtk_image_new_from_icon_name ("qgn_toolb_browser_gobutton",
                HILDON_ICON_SIZE_TOOLBAR),
            "Find");

    g_signal_connect (priv->find_button, "clicked",
            G_CALLBACK(hildon_find_toolbar_emit_search), self);
    gtk_widget_show_all( GTK_WIDGET(priv->find_button));
    gtk_toolbar_insert ( GTK_TOOLBAR(self), priv->find_button, -1);
    gtk_widget_set_size_request (GTK_WIDGET (priv->find_button), 72, -1);
    if ( GTK_WIDGET_CAN_FOCUS( GTK_BIN(priv->find_button)->child) )
        GTK_WIDGET_UNSET_FLAGS(
                GTK_BIN(priv->find_button)->child, GTK_CAN_FOCUS);

    /* Separator */
    priv->separator = gtk_separator_tool_item_new();
    gtk_widget_show(GTK_WIDGET(priv->separator));
    gtk_toolbar_insert (GTK_TOOLBAR(self), priv->separator, -1);

    /* Close button */
    priv->close_button = gtk_tool_button_new (
            gtk_image_new_from_icon_name ("qgn_toolb_gene_close",
                HILDON_ICON_SIZE_TOOLBAR),
            "Close");
    gtk_widget_set_size_request (GTK_WIDGET (priv->close_button), 72, -1);
    g_signal_connect(priv->close_button, "clicked",
            G_CALLBACK(hildon_find_toolbar_emit_close), self);
    gtk_widget_show_all(GTK_WIDGET(priv->close_button));
    gtk_toolbar_insert (GTK_TOOLBAR(self), priv->close_button, -1);
    if ( GTK_WIDGET_CAN_FOCUS( GTK_BIN(priv->close_button)->child) )
        GTK_WIDGET_UNSET_FLAGS(
                GTK_BIN(priv->close_button)->child, GTK_CAN_FOCUS);
}