Commit caeb8960 authored by Carlos Garnacho's avatar Carlos Garnacho

Introduce GtkPopover

Now that the GtkBubbleWindow object has been cleaned up and made
more generic, rename it as GtkPopover and make it public.
parent 8a661b87
......@@ -296,6 +296,7 @@ gtk_public_h_sources = \
gtkpapersize.h \
gtkplacessidebar.h \
gtkplug.h \
gtkpopover.h \
gtkprintcontext.h \
gtkprintoperation.h \
gtkprintoperationpreview.h \
......@@ -411,7 +412,6 @@ gtk_private_h_sources = \
gtkbookmarksmanager.h \
gtkborderimageprivate.h \
gtkboxprivate.h \
gtkbubblewindowprivate.h \
gtkbuilderprivate.h \
gtkbuttonprivate.h \
gtkcairoblurprivate.h \
......@@ -629,7 +629,6 @@ gtk_base_c_sources = \
gtkborder.c \
gtkborderimage.c \
gtkbox.c \
gtkbubblewindow.c \
gtkbuildable.c \
gtkbuilder.c \
gtkbuilderparser.c \
......@@ -801,6 +800,7 @@ gtk_base_c_sources = \
gtkprivatetypebuiltins.c \
gtkprogressbar.c \
gtkpixelcache.c \
gtkpopover.c \
gtkradiobutton.c \
gtkradiomenuitem.c \
gtkradiotoolbutton.c \
......
......@@ -144,6 +144,7 @@
#include <gtk/gtkpapersize.h>
#include <gtk/gtkpaned.h>
#include <gtk/gtkplacessidebar.h>
#include <gtk/gtkpopover.h>
#include <gtk/gtkprintcontext.h>
#include <gtk/gtkprintoperation.h>
#include <gtk/gtkprintoperationpreview.h>
......
......@@ -63,7 +63,7 @@
#include "gtkwidgetprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtktexthandleprivate.h"
#include "gtkbubblewindowprivate.h"
#include "gtkpopover.h"
#include "gtktoolbar.h"
#include "a11y/gtkentryaccessible.h"
......@@ -158,7 +158,7 @@ struct _GtkEntryPrivate
gchar *placeholder_text;
GtkBubbleWindow *bubble_window;
GtkWidget *bubble_window;
GtkTextHandle *text_handle;
GtkWidget *selection_bubble;
guint selection_bubble_timeout_id;
......@@ -9405,9 +9405,9 @@ bubble_targets_received (GtkClipboard *clipboard,
if (priv->selection_bubble)
gtk_widget_destroy (priv->selection_bubble);
priv->selection_bubble = _gtk_bubble_window_new (GTK_WIDGET (entry));
_gtk_bubble_window_set_position (GTK_BUBBLE_WINDOW (priv->selection_bubble),
GTK_POS_TOP);
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (entry));
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble),
GTK_POS_TOP);
toolbar = GTK_WIDGET (gtk_toolbar_new ());
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_TEXT);
......@@ -9456,8 +9456,7 @@ bubble_targets_received (GtkClipboard *clipboard,
rect.width = 0;
}
_gtk_bubble_window_set_pointing_to (GTK_BUBBLE_WINDOW (priv->selection_bubble),
&rect);
gtk_popover_set_pointing_to (GTK_POPOVER (priv->selection_bubble), &rect);
gtk_widget_show (priv->selection_bubble);
priv->selection_bubble_timeout_id = 0;
......
This diff is collapsed.
......@@ -15,24 +15,28 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_BUBBLE_WINDOW_H__
#define __GTK_BUBBLE_WINDOW_H__
#ifndef __GTK_POPOVER_H__
#define __GTK_POPOVER_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkwindow.h>
G_BEGIN_DECLS
#define GTK_TYPE_BUBBLE_WINDOW (_gtk_bubble_window_get_type ())
#define GTK_BUBBLE_WINDOW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_BUBBLE_WINDOW, GtkBubbleWindow))
#define GTK_BUBBLE_WINDOW_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_BUBBLE_WINDOW, GtkBubbleWindowClass))
#define GTK_IS_BUBBLE_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_BUBBLE_WINDOW))
#define GTK_IS_BUBBLE_WINDOW_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE ((o), GTK_TYPE_BUBBLE_WINDOW))
#define GTK_BUBBLE_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_BUBBLE_WINDOW, GtkBubbleWindowClass))
#define GTK_TYPE_POPOVER (gtk_popover_get_type ())
#define GTK_POPOVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_POPOVER, GtkPopover))
#define GTK_POPOVER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_POPOVER, GtkPopoverClass))
#define GTK_IS_POPOVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_POPOVER))
#define GTK_IS_POPOVER_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE ((o), GTK_TYPE_POPOVER))
#define GTK_POPOVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_POPOVER, GtkPopoverClass))
typedef struct _GtkBubbleWindow GtkBubbleWindow;
typedef struct _GtkBubbleWindowClass GtkBubbleWindowClass;
typedef struct _GtkPopover GtkPopover;
typedef struct _GtkPopoverClass GtkPopoverClass;
struct _GtkBubbleWindow
struct _GtkPopover
{
GtkBin parent_instance;
......@@ -40,28 +44,35 @@ struct _GtkBubbleWindow
gpointer priv;
};
struct _GtkBubbleWindowClass
struct _GtkPopoverClass
{
GtkBinClass parent_class;
};
GType _gtk_bubble_window_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_12
GType gtk_popover_get_type (void) G_GNUC_CONST;
GtkWidget * _gtk_bubble_window_new (GtkWidget *relative_to);
GDK_AVAILABLE_IN_3_12
GtkWidget * gtk_popover_new (GtkWidget *relative_to);
void _gtk_bubble_window_set_relative_to (GtkBubbleWindow *window,
GtkWidget *relative_to);
GtkWidget * _gtk_bubble_window_get_relative_to (GtkBubbleWindow *window);
GDK_AVAILABLE_IN_3_12
void gtk_popover_set_relative_to (GtkPopover *popover,
GtkWidget *relative_to);
GDK_AVAILABLE_IN_3_12
GtkWidget * gtk_popover_get_relative_to (GtkPopover *popover);
void _gtk_bubble_window_set_pointing_to (GtkBubbleWindow *window,
cairo_rectangle_int_t *rect);
gboolean _gtk_bubble_window_get_pointing_to (GtkBubbleWindow *window,
cairo_rectangle_int_t *rect);
void _gtk_bubble_window_set_position (GtkBubbleWindow *window,
GtkPositionType position);
GtkPositionType
_gtk_bubble_window_get_position (GtkBubbleWindow *window);
GDK_AVAILABLE_IN_3_12
void gtk_popover_set_pointing_to (GtkPopover *popover,
cairo_rectangle_int_t *rect);
GDK_AVAILABLE_IN_3_12
gboolean gtk_popover_get_pointing_to (GtkPopover *popover,
cairo_rectangle_int_t *rect);
GDK_AVAILABLE_IN_3_12
void gtk_popover_set_position (GtkPopover *popover,
GtkPositionType position);
GDK_AVAILABLE_IN_3_12
GtkPositionType gtk_popover_get_position (GtkPopover *popover);
G_END_DECLS
#endif /* __GTK_BUBBLE_WINDOW_H__ */
#endif /* __GTK_POPOVER_H__ */
......@@ -51,7 +51,7 @@
#include "gtktexthandleprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkbubblewindowprivate.h"
#include "gtkpopover.h"
#include "gtktoolbar.h"
#include "gtkpixelcacheprivate.h"
......@@ -8901,9 +8901,9 @@ bubble_targets_received (GtkClipboard *clipboard,
if (priv->selection_bubble)
gtk_widget_destroy (priv->selection_bubble);
priv->selection_bubble = _gtk_bubble_window_new (GTK_WIDGET (text_view));
_gtk_bubble_window_set_position (GTK_BUBBLE_WINDOW (priv->selection_bubble),
GTK_POS_TOP);
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (text_view));
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble),
GTK_POS_TOP);
toolbar = GTK_WIDGET (gtk_toolbar_new ());
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_TEXT);
......@@ -8932,8 +8932,7 @@ bubble_targets_received (GtkClipboard *clipboard,
rect.x -= priv->xoffset;
rect.y -= priv->yoffset;
_gtk_bubble_window_set_pointing_to (GTK_BUBBLE_WINDOW (priv->selection_bubble),
&rect);
gtk_popover_set_pointing_to (GTK_POPOVER (priv->selection_bubble), &rect);
gtk_widget_show (priv->selection_bubble);
priv->selection_bubble_timeout_id = 0;
......
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