Commit c0af1c1a authored by Matthias Clasen's avatar Matthias Clasen

Add a combo box cell renderer.

parent d8df3618
2004-07-16 Matthias Clasen <mclasen@redhat.com>
Add a combo box cell renderer (#139347, Lorenzo Gil Sanchez)
* gtk/gtkcellrenderercombo.[hc]: New Files.
* gtk/gtk.h:
* gtk/Makefile.am (gtk_public_h_sources, gtk_c_sources):
Add the new files.
* gtk/gtkcombobox.[hc]: Implement GtkCellEditable, add a
:has-frame property for suppressing the frame around
the child and redo the size allocation logic to take
focus width into account.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init):
Acknowledge the GtkComboBox:has-frame property and make
the entry fill its allocation vertically.
* gtk/gtkmarshalers.list: Add BOOLEAN:STRING.
* gtk/gtktreeview.c (gtk_tree_view_remove_widget): Queue
a draw here to keep non-widget windows from leaving
shadows behind.
2004-07-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_forall): Don't iterate
......
2004-07-16 Matthias Clasen <mclasen@redhat.com>
Add a combo box cell renderer (#139347, Lorenzo Gil Sanchez)
* gtk/gtkcellrenderercombo.[hc]: New Files.
* gtk/gtk.h:
* gtk/Makefile.am (gtk_public_h_sources, gtk_c_sources):
Add the new files.
* gtk/gtkcombobox.[hc]: Implement GtkCellEditable, add a
:has-frame property for suppressing the frame around
the child and redo the size allocation logic to take
focus width into account.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init):
Acknowledge the GtkComboBox:has-frame property and make
the entry fill its allocation vertically.
* gtk/gtkmarshalers.list: Add BOOLEAN:STRING.
* gtk/gtktreeview.c (gtk_tree_view_remove_widget): Queue
a draw here to keep non-widget windows from leaving
shadows behind.
2004-07-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_forall): Don't iterate
......
2004-07-16 Matthias Clasen <mclasen@redhat.com>
Add a combo box cell renderer (#139347, Lorenzo Gil Sanchez)
* gtk/gtkcellrenderercombo.[hc]: New Files.
* gtk/gtk.h:
* gtk/Makefile.am (gtk_public_h_sources, gtk_c_sources):
Add the new files.
* gtk/gtkcombobox.[hc]: Implement GtkCellEditable, add a
:has-frame property for suppressing the frame around
the child and redo the size allocation logic to take
focus width into account.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init):
Acknowledge the GtkComboBox:has-frame property and make
the entry fill its allocation vertically.
* gtk/gtkmarshalers.list: Add BOOLEAN:STRING.
* gtk/gtktreeview.c (gtk_tree_view_remove_widget): Queue
a draw here to keep non-widget windows from leaving
shadows behind.
2004-07-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_forall): Don't iterate
......
2004-07-16 Matthias Clasen <mclasen@redhat.com>
Add a combo box cell renderer (#139347, Lorenzo Gil Sanchez)
* gtk/gtkcellrenderercombo.[hc]: New Files.
* gtk/gtk.h:
* gtk/Makefile.am (gtk_public_h_sources, gtk_c_sources):
Add the new files.
* gtk/gtkcombobox.[hc]: Implement GtkCellEditable, add a
:has-frame property for suppressing the frame around
the child and redo the size allocation logic to take
focus width into account.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init):
Acknowledge the GtkComboBox:has-frame property and make
the entry fill its allocation vertically.
* gtk/gtkmarshalers.list: Add BOOLEAN:STRING.
* gtk/gtktreeview.c (gtk_tree_view_remove_widget): Queue
a draw here to keep non-widget windows from leaving
shadows behind.
2004-07-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_forall): Don't iterate
......
......@@ -118,6 +118,7 @@ gtk_public_h_sources = \
gtkcelleditable.h \
gtkcelllayout.h \
gtkcellrenderer.h \
gtkcellrenderercombo.h \
gtkcellrendererpixbuf.h \
gtkcellrendererprogress.h \
gtkcellrenderertext.h \
......@@ -324,6 +325,7 @@ gtk_c_sources = \
gtkcelleditable.c \
gtkcelllayout.c \
gtkcellrenderer.c \
gtkcellrenderercombo.c \
gtkcellrendererpixbuf.c \
gtkcellrendererprogress.c \
gtkcellrendererseptext.c\
......
......@@ -48,6 +48,7 @@
#include <gtk/gtkcalendar.h>
#include <gtk/gtkcelllayout.h>
#include <gtk/gtkcellrenderer.h>
#include <gtk/gtkcellrenderercombo.h>
#include <gtk/gtkcellrendererpixbuf.h>
#include <gtk/gtkcellrendererprogress.h>
#include <gtk/gtkcellrenderertext.h>
......
This diff is collapsed.
/* GtkCellRendererCombo
* Copyright (C) 2004 Lorenzo Gil Sanchez
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GTK_CELL_RENDERER_COMBO_H
#define GTK_CELL_RENDERER_COMBO_H
#include <gtk/gtktreemodel.h>
#include <gtk/gtkcellrenderertext.h>
G_BEGIN_DECLS
#define GTK_TYPE_CELL_RENDERER_COMBO (gtk_cell_renderer_combo_get_type ())
#define GTK_CELL_RENDERER_COMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_RENDERER_COMBO, GtkCellRendererCombo))
#define GTK_CELL_RENDERER_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_RENDERER_COMBO, GtkCellRendererComboClass))
#define GTK_IS_CELL_RENDERER_COMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_RENDERER_COMBO))
#define GTK_IS_CELL_RENDERER_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_RENDERER_COMBO))
#define GTK_CELL_RENDERER_COMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER_COMBO, GtkCellRendererTextClass))
typedef struct _GtkCellRendererCombo GtkCellRendererCombo;
typedef struct _GtkCellRendererComboClass GtkCellRendererComboClass;
struct _GtkCellRendererCombo
{
GtkCellRendererText parent;
GtkTreeModel *model;
gint text_column;
gboolean has_entry;
/*< private >*/
guint focus_out_id;
};
struct _GtkCellRendererComboClass
{
GtkCellRendererTextClass parent;
};
GType gtk_cell_renderer_combo_get_type (void);
GtkCellRenderer *gtk_cell_renderer_combo_new (void);
G_END_DECLS
#endif
This diff is collapsed.
......@@ -115,6 +115,9 @@ gchar *gtk_combo_box_get_active_text (GtkComboBox *combo_box);
void gtk_combo_box_popup (GtkComboBox *combo_box);
void gtk_combo_box_popdown (GtkComboBox *combo_box);
/* private */
gboolean _gtk_combo_box_editing_canceled (GtkComboBox *combo_box);
G_END_DECLS
#endif /* __GTK_COMBO_BOX_H__ */
......@@ -54,6 +54,9 @@ static void gtk_combo_box_entry_contents_changed (GtkEntry *entry,
gpointer user_data);
static gboolean gtk_combo_box_entry_mnemonic_activate (GtkWidget *entry,
gboolean group_cycling);
static void has_frame_changed (GtkComboBoxEntry *entry_box,
GParamSpec *pspec,
gpointer data);
enum
{
......@@ -125,6 +128,9 @@ gtk_combo_box_entry_init (GtkComboBoxEntry *entry_box)
entry_box->priv->text_column = -1;
entry_box->priv->entry = gtk_entry_new ();
/* this flag is a hack to tell the entry to fill its allocation.
*/
GTK_ENTRY (entry_box->priv->entry)->is_cell_renderer = TRUE;
gtk_container_add (GTK_CONTAINER (entry_box), entry_box->priv->entry);
gtk_widget_show (entry_box->priv->entry);
......@@ -139,6 +145,8 @@ gtk_combo_box_entry_init (GtkComboBoxEntry *entry_box)
entry_box);
g_signal_connect (entry_box, "changed",
G_CALLBACK (gtk_combo_box_entry_active_changed), NULL);
has_frame_changed (entry_box, NULL, NULL);
g_signal_connect (entry_box, "notify::has-frame", G_CALLBACK (has_frame_changed), NULL);
}
static void
......@@ -217,6 +225,18 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
combo_box);
}
static void
has_frame_changed (GtkComboBoxEntry *entry_box,
GParamSpec *pspec,
gpointer data)
{
gboolean has_frame;
g_object_get (entry_box, "has_frame", &has_frame, NULL);
gtk_entry_set_has_frame (GTK_ENTRY (entry_box->priv->entry), has_frame);
}
static void
gtk_combo_box_entry_contents_changed (GtkEntry *entry,
gpointer user_data)
......
......@@ -38,6 +38,7 @@ BOOLEAN:VOID
BOOLEAN:BOOLEAN
BOOLEAN:NONE
BOOLEAN:BOOLEAN,BOOLEAN,BOOLEAN
BOOLEAN:STRING
ENUM:ENUM
INT:POINTER
NONE:BOOLEAN
......
......@@ -6784,7 +6784,7 @@ gtk_tree_view_put (GtkTreeView *tree_view,
gint height)
{
GtkTreeViewChild *child;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_WIDGET (child_widget));
......@@ -6800,7 +6800,7 @@ gtk_tree_view_put (GtkTreeView *tree_view,
if (GTK_WIDGET_REALIZED (tree_view))
gtk_widget_set_parent_window (child->widget, tree_view->priv->bin_window);
gtk_widget_set_parent (child_widget, GTK_WIDGET (tree_view));
}
......@@ -12355,7 +12355,9 @@ gtk_tree_view_remove_widget (GtkCellEditable *cell_editable,
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
gtk_container_remove (GTK_CONTAINER (tree_view),
GTK_WIDGET (cell_editable));
GTK_WIDGET (cell_editable));
/* FIXME should only redraw a single node */
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
}
static gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment