forked from AuroraMiddleware/gtk
textview: Derive from GtkWidget
Drop the GtkContainer vfuncs. As a replacement for gtk_container_remove, make gtk_text_view_remove public.
This commit is contained in:
parent
84632b0901
commit
aeef59fda9
@ -2785,6 +2785,7 @@ gtk_text_view_backward_display_line_start
|
||||
gtk_text_view_starts_display_line
|
||||
gtk_text_view_move_visually
|
||||
gtk_text_view_add_child_at_anchor
|
||||
gtk_text_view_remove
|
||||
GtkTextChildAnchor
|
||||
gtk_text_child_anchor_new
|
||||
gtk_text_child_anchor_get_widgets
|
||||
|
@ -61,7 +61,7 @@ static void mark_set_cb (GtkTextBuffer *buffer,
|
||||
static void atk_editable_text_interface_init (AtkEditableTextIface *iface);
|
||||
static void atk_text_interface_init (AtkTextIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkTextViewAccessible, gtk_text_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkTextViewAccessible, gtk_text_view_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkTextViewAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init))
|
||||
|
@ -22,7 +22,7 @@
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkcontaineraccessible.h>
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -39,14 +39,14 @@ typedef struct _GtkTextViewAccessiblePrivate GtkTextViewAccessiblePrivate;
|
||||
|
||||
struct _GtkTextViewAccessible
|
||||
{
|
||||
GtkContainerAccessible parent;
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkTextViewAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkTextViewAccessibleClass
|
||||
{
|
||||
GtkContainerAccessibleClass parent_class;
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -155,7 +155,7 @@ enum
|
||||
TEXT_HANDLE_N_HANDLES
|
||||
};
|
||||
|
||||
struct _GtkTextViewPrivate
|
||||
struct _GtkTextViewPrivate
|
||||
{
|
||||
GtkTextLayout *layout;
|
||||
GtkTextBuffer *buffer;
|
||||
@ -561,14 +561,6 @@ static void gtk_text_view_set_vadjustment_values (GtkTextView *text_view);
|
||||
static void gtk_text_view_update_im_spot_location (GtkTextView *text_view);
|
||||
static void gtk_text_view_insert_emoji (GtkTextView *text_view);
|
||||
|
||||
/* Container methods */
|
||||
static void gtk_text_view_add (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
static void gtk_text_view_remove (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
static void gtk_text_view_forall (GtkContainer *container,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
static void update_node_ordering (GtkWidget *widget);
|
||||
|
||||
/* GtkTextHandle handlers */
|
||||
@ -661,7 +653,7 @@ static gint text_window_get_height (GtkTextWindow *win);
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkTextView, gtk_text_view, GTK_TYPE_CONTAINER,
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkTextView, gtk_text_view, GTK_TYPE_WIDGET,
|
||||
G_ADD_PRIVATE (GtkTextView)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||
|
||||
@ -803,7 +795,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
/* Default handlers and virtual methods
|
||||
*/
|
||||
@ -822,10 +813,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
widget_class->size_allocate = gtk_text_view_size_allocate;
|
||||
widget_class->snapshot = gtk_text_view_snapshot;
|
||||
|
||||
container_class->add = gtk_text_view_add;
|
||||
container_class->remove = gtk_text_view_remove;
|
||||
container_class->forall = gtk_text_view_forall;
|
||||
|
||||
klass->move_cursor = gtk_text_view_move_cursor;
|
||||
klass->set_anchor = gtk_text_view_set_anchor;
|
||||
klass->insert_at_cursor = gtk_text_view_insert_at_cursor;
|
||||
@ -3776,11 +3763,12 @@ gtk_text_view_remove_validate_idles (GtkTextView *text_view)
|
||||
static void
|
||||
gtk_text_view_dispose (GObject *object)
|
||||
{
|
||||
GtkTextView *text_view;
|
||||
GtkTextViewPrivate *priv;
|
||||
GtkTextView *text_view = GTK_TEXT_VIEW (object);
|
||||
GtkTextViewPrivate *priv = text_view->priv;
|
||||
GtkWidget *child;
|
||||
|
||||
text_view = GTK_TEXT_VIEW (object);
|
||||
priv = text_view->priv;
|
||||
while ((child = gtk_widget_get_first_child (GTK_WIDGET (text_view))))
|
||||
gtk_text_view_remove (text_view, child);
|
||||
|
||||
gtk_text_view_remove_validate_idles (text_view);
|
||||
gtk_text_view_set_buffer (text_view, NULL);
|
||||
@ -5734,26 +5722,10 @@ gtk_text_view_snapshot (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Container
|
||||
*/
|
||||
|
||||
static void
|
||||
gtk_text_view_add (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
void
|
||||
gtk_text_view_remove (GtkTextView *text_view,
|
||||
GtkWidget *child)
|
||||
{
|
||||
/* There isn't really a good default for what to do when
|
||||
* using gtk_container_add() for @child. So we default to
|
||||
* placing it at 0,0 in the text window.
|
||||
*/
|
||||
gtk_text_view_add_overlay (GTK_TEXT_VIEW (container), child, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_remove (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkTextView *text_view = GTK_TEXT_VIEW (container);
|
||||
GtkTextViewPrivate *priv = text_view->priv;
|
||||
AnchoredChild *ac;
|
||||
|
||||
@ -5799,41 +5771,6 @@ gtk_text_view_remove (GtkContainer *container,
|
||||
anchored_child_free (ac);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_forall (GtkContainer *container,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
const GList *iter;
|
||||
GtkTextView *text_view;
|
||||
GtkTextViewPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_VIEW (container));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
text_view = GTK_TEXT_VIEW (container);
|
||||
priv = text_view->priv;
|
||||
|
||||
if (priv->left_child)
|
||||
callback (GTK_WIDGET (priv->left_child), callback_data);
|
||||
if (priv->right_child)
|
||||
callback (GTK_WIDGET (priv->right_child), callback_data);
|
||||
if (priv->top_child)
|
||||
callback (GTK_WIDGET (priv->top_child), callback_data);
|
||||
if (priv->bottom_child)
|
||||
callback (GTK_WIDGET (priv->bottom_child), callback_data);
|
||||
if (priv->center_child)
|
||||
callback (GTK_WIDGET (priv->center_child), callback_data);
|
||||
|
||||
iter = priv->anchored_children.head;
|
||||
while (iter != NULL)
|
||||
{
|
||||
const AnchoredChild *ac = iter->data;
|
||||
iter = iter->next;
|
||||
callback (ac->widget, callback_data);
|
||||
}
|
||||
}
|
||||
|
||||
#define CURSOR_ON_MULTIPLIER 2
|
||||
#define CURSOR_OFF_MULTIPLIER 1
|
||||
#define CURSOR_PEND_MULTIPLIER 3
|
||||
|
@ -29,7 +29,7 @@
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkcontainer.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gtk/gtkimcontext.h>
|
||||
#include <gtk/gtktextbuffer.h>
|
||||
|
||||
@ -107,7 +107,7 @@ typedef struct _GtkTextViewClass GtkTextViewClass;
|
||||
|
||||
struct _GtkTextView
|
||||
{
|
||||
GtkContainer parent_instance;
|
||||
GtkWidget parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
|
||||
@ -150,7 +150,7 @@ struct _GtkTextView
|
||||
*/
|
||||
struct _GtkTextViewClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
|
||||
@ -329,6 +329,10 @@ void gtk_text_view_move_overlay (GtkTextView *text_view,
|
||||
gint xpos,
|
||||
gint ypos);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_text_view_remove (GtkTextView *text_view,
|
||||
GtkWidget *child);
|
||||
|
||||
/* Default style settings (fallbacks if no tag affects the property) */
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
Loading…
Reference in New Issue
Block a user