forked from AuroraMiddleware/gtk
Merge branch 'gtk-demo-tweaks' into 'master'
Gtk demo tweaks See merge request GNOME/gtk!2059
This commit is contained in:
commit
6ff8f1b2fd
@ -1,7 +1,7 @@
|
|||||||
/* Constraints/Interactive
|
/* Constraints/Interactive
|
||||||
*
|
*
|
||||||
* Demonstrate how constraints can be updates during
|
* Demonstrate how constraints can be updates during user interaction.
|
||||||
* user interaction.
|
* The vertical edge between the buttons can be dragged with the mouse.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
/* Cursors
|
/* Cursors
|
||||||
*
|
*
|
||||||
* Demonstrates a useful set of available cursors. The cursors shown here are the ones
|
* Demonstrates a useful set of available cursors. The cursors shown here are the
|
||||||
* defined by CSS, which we assume to be available.
|
* ones defined by CSS, which we assume to be available. The example shows creating
|
||||||
*
|
* cursors by name or from an image, with or without a fallback.
|
||||||
* The example shows creating cursors by name or from an image, with or without a fallback.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* display the selected item differently from the presentation
|
* display the selected item differently from the presentation
|
||||||
* in the popup.
|
* in the popup.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
|
||||||
@ -242,7 +243,7 @@ do_dropdown (GtkWidget *do_widget)
|
|||||||
window = gtk_window_new ();
|
window = gtk_window_new ();
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Drop Down");
|
gtk_window_set_title (GTK_WINDOW (window), "Drop Downs");
|
||||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Fixed layout
|
/* Fixed Layout
|
||||||
*
|
*
|
||||||
* GtkFixed is a container that allows placing and transforming
|
* GtkFixed is a container that allows placing and transforming
|
||||||
* widgets manually.
|
* widgets manually.
|
||||||
@ -126,7 +126,7 @@ create_demo_window (GtkWidget *do_widget)
|
|||||||
|
|
||||||
window = gtk_window_new ();
|
window = gtk_window_new ();
|
||||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Fixed layout");
|
gtk_window_set_title (GTK_WINDOW (window), "Fixed Layout");
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
/* Flow Box
|
/* Flow Box
|
||||||
*
|
*
|
||||||
* GtkFlowBox allows flexible and responsive grids which reflow
|
* GtkFlowBox allows flexible and responsive grids which reflow
|
||||||
* as needed and support sorting and filtering.
|
* as needed and support sorting and filtering. The children of
|
||||||
*
|
* a GtkFlowBox are regular widgets
|
||||||
* The children of a GtkFlowBox are regular widgets
|
|
||||||
*
|
*
|
||||||
* The dataset used here has 665 colors.
|
* The dataset used here has 665 colors.
|
||||||
*/
|
*/
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
* This demo displays the time in different timezones.
|
* This demo displays the time in different timezones.
|
||||||
*
|
*
|
||||||
* The goal is to show how to set up expressions that track changes
|
* The goal is to show how to set up expressions that track changes
|
||||||
* in objects and make them update widgets.
|
* in objects and make them update widgets. For that, we create a
|
||||||
*
|
* GtkClock object that updates its time every second and then use
|
||||||
* For that, we create a GtkClock object that updates its time every
|
* various ways to display that time.
|
||||||
* second and then use various ways to display that time.
|
|
||||||
*
|
*
|
||||||
* Typically, this will be done using GtkBuilder .ui files with the
|
* Typically, this will be done using GtkBuilder .ui files with the
|
||||||
* help of the <binding> tag, but this demo shows the code that runs
|
* help of the <binding> tag, but this demo shows the code that runs
|
||||||
@ -41,7 +40,8 @@ enum {
|
|||||||
|
|
||||||
/* This function returns the current time in the clock's timezone.
|
/* This function returns the current time in the clock's timezone.
|
||||||
* Note that this returns a new object every time, so we need to
|
* Note that this returns a new object every time, so we need to
|
||||||
* remember to unref it after use. */
|
* remember to unref it after use.
|
||||||
|
*/
|
||||||
static GDateTime *
|
static GDateTime *
|
||||||
gtk_clock_get_time (GtkClock *clock)
|
gtk_clock_get_time (GtkClock *clock)
|
||||||
{
|
{
|
||||||
@ -51,10 +51,11 @@ gtk_clock_get_time (GtkClock *clock)
|
|||||||
return g_date_time_new_now_local ();
|
return g_date_time_new_now_local ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Here, we implement the functionality required by the GdkPaintable interface.
|
/* Here, we implement the functionality required by the GdkPaintable
|
||||||
* This way we have a trivial way to display an analog clock.
|
* interface. This way we have a trivial way to display an analog clock.
|
||||||
* It also allows demonstrating how to directly use objects in the listview
|
* It also allows demonstrating how to directly use objects in the
|
||||||
* later by making this object do something interesting. */
|
* listview later by making this object do something interesting.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
gtk_clock_snapshot (GdkPaintable *paintable,
|
gtk_clock_snapshot (GdkPaintable *paintable,
|
||||||
GdkSnapshot *snapshot,
|
GdkSnapshot *snapshot,
|
||||||
@ -68,26 +69,31 @@ gtk_clock_snapshot (GdkPaintable *paintable,
|
|||||||
#define BLACK ((GdkRGBA) { 0, 0, 0, 1 })
|
#define BLACK ((GdkRGBA) { 0, 0, 0, 1 })
|
||||||
|
|
||||||
/* save/restore() is necessary so we can undo the transforms we start
|
/* save/restore() is necessary so we can undo the transforms we start
|
||||||
* out with. */
|
* out with.
|
||||||
|
*/
|
||||||
gtk_snapshot_save (snapshot);
|
gtk_snapshot_save (snapshot);
|
||||||
|
|
||||||
/* First, we move the (0, 0) point to the center of the area so
|
/* First, we move the (0, 0) point to the center of the area so
|
||||||
* we can draw everything relative to it. */
|
* we can draw everything relative to it.
|
||||||
|
*/
|
||||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2, height / 2));
|
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2, height / 2));
|
||||||
|
|
||||||
/* Next we scale it, so that we can pretend that the clock is
|
/* Next we scale it, so that we can pretend that the clock is
|
||||||
* 100px in size. That way, we don't need to do any complicated
|
* 100px in size. That way, we don't need to do any complicated
|
||||||
* math later.
|
* math later. We use MIN() here so that we use the smaller
|
||||||
* We use MIN() here so that we use the smaller dimension for sizing.
|
* dimension for sizing. That way we don't overdraw but keep
|
||||||
* That way we don't overdraw but keep the aspect ratio. */
|
* the aspect ratio.
|
||||||
|
*/
|
||||||
gtk_snapshot_scale (snapshot, MIN (width, height) / 100.0, MIN (width, height) / 100.0);
|
gtk_snapshot_scale (snapshot, MIN (width, height) / 100.0, MIN (width, height) / 100.0);
|
||||||
/* Now we have a circle with diameter 100px (and radius 50px) that
|
|
||||||
* has its (0, 0) point at the center.
|
|
||||||
* Let's draw a simple clock into it. */
|
|
||||||
|
|
||||||
|
/* Now we have a circle with diameter 100px (and radius 50px) that
|
||||||
|
* has its (0, 0) point at the center. Let's draw a simple clock into it.
|
||||||
|
*/
|
||||||
time = gtk_clock_get_time (self);
|
time = gtk_clock_get_time (self);
|
||||||
|
|
||||||
/* First, draw a circle. This is a neat little trick to draw a circle
|
/* First, draw a circle. This is a neat little trick to draw a circle
|
||||||
* without requiring Cairo. */
|
* without requiring Cairo.
|
||||||
|
*/
|
||||||
gsk_rounded_rect_init_from_rect (&outline, &GRAPHENE_RECT_INIT(-50, -50, 100, 100), 50);
|
gsk_rounded_rect_init_from_rect (&outline, &GRAPHENE_RECT_INIT(-50, -50, 100, 100), 50);
|
||||||
gtk_snapshot_append_border (snapshot,
|
gtk_snapshot_append_border (snapshot,
|
||||||
&outline,
|
&outline,
|
||||||
@ -95,9 +101,11 @@ gtk_clock_snapshot (GdkPaintable *paintable,
|
|||||||
(GdkRGBA [4]) { BLACK, BLACK, BLACK, BLACK });
|
(GdkRGBA [4]) { BLACK, BLACK, BLACK, BLACK });
|
||||||
|
|
||||||
/* Next, draw the hour hand.
|
/* Next, draw the hour hand.
|
||||||
* We do this using tranforms again: Instead of computing where the angle points
|
* We do this using tranforms again: Instead of computing where the angle
|
||||||
* to, we just rotate everything and then draw the hand as if if was :00.
|
* points to, we just rotate everything and then draw the hand as if it
|
||||||
* We don't even need to care about am/pm here because rotations just work. */
|
* was :00. We don't even need to care about am/pm here because rotations
|
||||||
|
* just work.
|
||||||
|
*/
|
||||||
gtk_snapshot_save (snapshot);
|
gtk_snapshot_save (snapshot);
|
||||||
gtk_snapshot_rotate (snapshot, 30 * g_date_time_get_hour (time) + 0.5 * g_date_time_get_minute (time));
|
gtk_snapshot_rotate (snapshot, 30 * g_date_time_get_hour (time) + 0.5 * g_date_time_get_minute (time));
|
||||||
gsk_rounded_rect_init_from_rect (&outline, &GRAPHENE_RECT_INIT(-2, -23, 4, 25), 2);
|
gsk_rounded_rect_init_from_rect (&outline, &GRAPHENE_RECT_INIT(-2, -23, 4, 25), 2);
|
||||||
@ -107,7 +115,8 @@ gtk_clock_snapshot (GdkPaintable *paintable,
|
|||||||
gtk_snapshot_restore (snapshot);
|
gtk_snapshot_restore (snapshot);
|
||||||
|
|
||||||
/* And the same as above for the minute hand. Just make this one longer
|
/* And the same as above for the minute hand. Just make this one longer
|
||||||
* so people can tell the hands apart. */
|
* so people can tell the hands apart.
|
||||||
|
*/
|
||||||
gtk_snapshot_save (snapshot);
|
gtk_snapshot_save (snapshot);
|
||||||
gtk_snapshot_rotate (snapshot, 6 * g_date_time_get_minute (time));
|
gtk_snapshot_rotate (snapshot, 6 * g_date_time_get_minute (time));
|
||||||
gsk_rounded_rect_init_from_rect (&outline, &GRAPHENE_RECT_INIT(-2, -43, 4, 45), 2);
|
gsk_rounded_rect_init_from_rect (&outline, &GRAPHENE_RECT_INIT(-2, -43, 4, 45), 2);
|
||||||
@ -125,8 +134,9 @@ gtk_clock_snapshot (GdkPaintable *paintable,
|
|||||||
gtk_snapshot_pop (snapshot);
|
gtk_snapshot_pop (snapshot);
|
||||||
gtk_snapshot_restore (snapshot);
|
gtk_snapshot_restore (snapshot);
|
||||||
|
|
||||||
/* And finally, don't forget to restore the initial save() that we did for
|
/* And finally, don't forget to restore the initial save() that
|
||||||
* the initial transformations. */
|
* we did for the initial transformations.
|
||||||
|
*/
|
||||||
gtk_snapshot_restore (snapshot);
|
gtk_snapshot_restore (snapshot);
|
||||||
|
|
||||||
g_date_time_unref (time);
|
g_date_time_unref (time);
|
||||||
@ -145,10 +155,9 @@ gtk_clock_get_intrinsic_height (GdkPaintable *paintable)
|
|||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the paintable interface. This way we turn our clock objects
|
/* Initialize the paintable interface. This way we turn our clocks
|
||||||
* into objects that can be drawn.
|
* into objects that can be drawn. There are more functions to this
|
||||||
* There are more functions to this interface to define desired size,
|
* interface to define desired size, but this is enough.
|
||||||
* but this is enough.
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gtk_clock_paintable_init (GdkPaintableInterface *iface)
|
gtk_clock_paintable_init (GdkPaintableInterface *iface)
|
||||||
@ -158,8 +167,9 @@ gtk_clock_paintable_init (GdkPaintableInterface *iface)
|
|||||||
iface->get_intrinsic_height = gtk_clock_get_intrinsic_height;
|
iface->get_intrinsic_height = gtk_clock_get_intrinsic_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finally, we define the type. The important part is adding the paintable
|
/* Finally, we define the type. The important part is adding the
|
||||||
* interface, so GTK knows that this object can indeed be drawm.
|
* paintable interface, so GTK knows that this object can indeed
|
||||||
|
* be drawn.
|
||||||
*/
|
*/
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkClock, gtk_clock, G_TYPE_OBJECT,
|
G_DEFINE_TYPE_WITH_CODE (GtkClock, gtk_clock, G_TYPE_OBJECT,
|
||||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||||
@ -221,11 +231,14 @@ gtk_clock_set_property (GObject *object,
|
|||||||
|
|
||||||
/* This is the list of all the ticking clocks */
|
/* This is the list of all the ticking clocks */
|
||||||
static GSList *ticking_clocks = NULL;
|
static GSList *ticking_clocks = NULL;
|
||||||
/* This is the id of the timeout source that is updating all ticking clocks */
|
|
||||||
|
/* This is the ID of the timeout source that is updating all
|
||||||
|
* ticking clocks.
|
||||||
|
*/
|
||||||
static guint ticking_clock_id = 0;
|
static guint ticking_clock_id = 0;
|
||||||
|
|
||||||
/* Every second, this function is called to tell everybody that the
|
/* Every second, this function is called to tell everybody that
|
||||||
* clocks are ticking.
|
* the clocks are ticking.
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_clock_tick (gpointer unused)
|
gtk_clock_tick (gpointer unused)
|
||||||
@ -240,6 +253,7 @@ gtk_clock_tick (gpointer unused)
|
|||||||
* so notify about that.
|
* so notify about that.
|
||||||
*/
|
*/
|
||||||
g_object_notify_by_pspec (G_OBJECT (clock), properties[PROP_TIME]);
|
g_object_notify_by_pspec (G_OBJECT (clock), properties[PROP_TIME]);
|
||||||
|
|
||||||
/* We will also draw the hands of the clock differently.
|
/* We will also draw the hands of the clock differently.
|
||||||
* So notify about that, too.
|
* So notify about that, too.
|
||||||
*/
|
*/
|
||||||
@ -343,6 +357,9 @@ create_clocks_model (void)
|
|||||||
clock = gtk_clock_new ("San Francisco", g_time_zone_new ("America/Los_Angeles"));
|
clock = gtk_clock_new ("San Francisco", g_time_zone_new ("America/Los_Angeles"));
|
||||||
g_list_store_append (result, clock);
|
g_list_store_append (result, clock);
|
||||||
g_object_unref (clock);
|
g_object_unref (clock);
|
||||||
|
clock = gtk_clock_new ("Xalapa", g_time_zone_new ("America/Mexico_City"));
|
||||||
|
g_list_store_append (result, clock);
|
||||||
|
g_object_unref (clock);
|
||||||
clock = gtk_clock_new ("Boston", g_time_zone_new ("America/New_York"));
|
clock = gtk_clock_new ("Boston", g_time_zone_new ("America/New_York"));
|
||||||
g_list_store_append (result, clock);
|
g_list_store_append (result, clock);
|
||||||
g_object_unref (clock);
|
g_object_unref (clock);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* and sort the data in various ways. The controls for
|
* and sort the data in various ways. The controls for
|
||||||
* this are implemented using GtkDropDown.
|
* this are implemented using GtkDropDown.
|
||||||
*
|
*
|
||||||
* The dataset used here has 9283 items.
|
* The dataset used here has 9 283 items.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* A GtkNoSelectionModel is used to make sure no item in the list can be
|
* A GtkNoSelectionModel is used to make sure no item in the list can be
|
||||||
* selected. All other interactions with the items is still possible.
|
* selected. All other interactions with the items is still possible.
|
||||||
*
|
*
|
||||||
* The dataset used here has 70000 items.
|
* The dataset used here has 70 000 items.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
@ -599,7 +599,7 @@ display_image (const char *resource)
|
|||||||
{
|
{
|
||||||
GtkWidget *sw, *image;
|
GtkWidget *sw, *image;
|
||||||
|
|
||||||
image = gtk_image_new_from_resource (resource);
|
image = gtk_picture_new_for_resource (resource);
|
||||||
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
|
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
|
||||||
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
|
||||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
@ -1040,7 +1040,7 @@ activate (GApplication *app)
|
|||||||
listmodel = create_demo_model ();
|
listmodel = create_demo_model ();
|
||||||
treemodel = gtk_tree_list_model_new (FALSE,
|
treemodel = gtk_tree_list_model_new (FALSE,
|
||||||
G_LIST_MODEL (listmodel),
|
G_LIST_MODEL (listmodel),
|
||||||
FALSE,
|
TRUE,
|
||||||
get_child_model,
|
get_child_model,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -5,7 +5,7 @@ Text <span color="gray">c<span color="green">o</span>l<span color="tomato">o</sp
|
|||||||
|
|
||||||
Colorful <span underline="low" underline-color="blue"><span underline="double" underline-color="red">under</span>lines</span> and <span background="pink"><span underline="error">mo</span><span underline="error" underline-color="green">re</span></span>
|
Colorful <span underline="low" underline-color="blue"><span underline="double" underline-color="red">under</span>lines</span> and <span background="pink"><span underline="error">mo</span><span underline="error" underline-color="green">re</span></span>
|
||||||
|
|
||||||
Colorful <span strikethrough="true" strikethrough-color="magenta">strikethroughs</span>
|
Colorful <span strikethrough="true" strikethrough-color="magenta">strikethroughs</span> and <span overline="single" overline_color="green">overlines</span>
|
||||||
|
|
||||||
Superscripts and subscripts: 𝜀<span rise="-6000" size="x-small" font_desc="italic">0</span> = 𝜔<span rise="8000" size="smaller">𝜔<span rise="14000" size="smaller">𝜔<span rise="20000">.<span rise="23000">.<span rise="26000">.</span></span></span></span></span>
|
Superscripts and subscripts: 𝜀<span rise="-6000" size="x-small" font_desc="italic">0</span> = 𝜔<span rise="8000" size="smaller">𝜔<span rise="14000" size="smaller">𝜔<span rise="20000">.<span rise="23000">.<span rise="26000">.</span></span></span></span></span>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Sliding puzzle
|
/* Sliding Puzzle
|
||||||
*
|
*
|
||||||
* This demo demonstrates how to use gestures and paintables to create a
|
* This demo demonstrates how to use gestures and paintables to create a
|
||||||
* small sliding puzzle game.
|
* small sliding puzzle game.
|
||||||
|
@ -92,12 +92,11 @@ static Theme themes[] = {
|
|||||||
static int theme;
|
static int theme;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
change_theme (GtkWidget *widget,
|
change_theme (GtkWidget *widget,
|
||||||
GdkFrameClock *frame_clock,
|
GdkFrameClock *frame_clock,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkBuilder *builder = data;
|
GtkWidget *label = data;
|
||||||
GtkWidget *label;
|
|
||||||
Theme next = themes[theme++ % G_N_ELEMENTS (themes)];
|
Theme next = themes[theme++ % G_N_ELEMENTS (themes)];
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
@ -110,7 +109,6 @@ change_theme (GtkWidget *widget,
|
|||||||
gtk_window_set_title (GTK_WINDOW (widget), name);
|
gtk_window_set_title (GTK_WINDOW (widget), name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
||||||
label = GTK_WIDGET (gtk_builder_get_object (builder, "fps"));
|
|
||||||
if (frame_clock)
|
if (frame_clock)
|
||||||
{
|
{
|
||||||
char *fps;
|
char *fps;
|
||||||
@ -127,10 +125,10 @@ change_theme (GtkWidget *widget,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clicked (GtkGestureClick *gesture,
|
clicked (GtkGestureClick *gesture,
|
||||||
int n_press,
|
int n_press,
|
||||||
double x,
|
double x,
|
||||||
double y,
|
double y,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
@ -198,6 +196,7 @@ do_themes (GtkWidget *do_widget)
|
|||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *header;
|
GtkWidget *header;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
GtkWidget *label;
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/themes/themes.ui");
|
builder = gtk_builder_new_from_resource ("/themes/themes.ui");
|
||||||
@ -207,13 +206,17 @@ do_themes (GtkWidget *do_widget)
|
|||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|
||||||
header = GTK_WIDGET (gtk_builder_get_object (builder, "header"));
|
header = GTK_WIDGET (gtk_builder_get_object (builder, "header"));
|
||||||
|
label = GTK_WIDGET (gtk_builder_get_object (builder, "fps"));
|
||||||
|
|
||||||
gesture = gtk_gesture_click_new ();
|
gesture = gtk_gesture_click_new ();
|
||||||
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked), builder);
|
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked), label);
|
||||||
gtk_widget_add_controller (header, GTK_EVENT_CONTROLLER (gesture));
|
gtk_widget_add_controller (header, GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
|
||||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "toggle"));
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "toggle"));
|
||||||
g_signal_connect (button, "notify::active", G_CALLBACK (toggle_cycle), builder);
|
g_signal_connect (button, "notify::active", G_CALLBACK (toggle_cycle), label);
|
||||||
gtk_widget_realize (window);
|
gtk_widget_realize (window);
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
@ -1527,7 +1527,6 @@ get_layout (GtkCellRendererText *celltext,
|
|||||||
uline = PANGO_UNDERLINE_DOUBLE;
|
uline = PANGO_UNDERLINE_DOUBLE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
case PANGO_UNDERLINE_SINGLE_LINE:
|
case PANGO_UNDERLINE_SINGLE_LINE:
|
||||||
uline = PANGO_UNDERLINE_DOUBLE_LINE;
|
uline = PANGO_UNDERLINE_DOUBLE_LINE;
|
||||||
break;
|
break;
|
||||||
@ -1535,7 +1534,6 @@ get_layout (GtkCellRendererText *celltext,
|
|||||||
case PANGO_UNDERLINE_DOUBLE_LINE:
|
case PANGO_UNDERLINE_DOUBLE_LINE:
|
||||||
case PANGO_UNDERLINE_ERROR_LINE:
|
case PANGO_UNDERLINE_ERROR_LINE:
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case PANGO_UNDERLINE_DOUBLE:
|
case PANGO_UNDERLINE_DOUBLE:
|
||||||
case PANGO_UNDERLINE_LOW:
|
case PANGO_UNDERLINE_LOW:
|
||||||
|
@ -1241,7 +1241,6 @@ attribute_from_text (GtkBuilder *builder,
|
|||||||
if (gtk_builder_value_from_string_type (builder, G_TYPE_INT, value, &val, error))
|
if (gtk_builder_value_from_string_type (builder, G_TYPE_INT, value, &val, error))
|
||||||
attribute = pango_attr_background_alpha_new ((guint16)g_value_get_int (&val));
|
attribute = pango_attr_background_alpha_new ((guint16)g_value_get_int (&val));
|
||||||
break;
|
break;
|
||||||
#if PANGO_VERSION_CHECK(1,44,0)
|
|
||||||
case PANGO_ATTR_ALLOW_BREAKS:
|
case PANGO_ATTR_ALLOW_BREAKS:
|
||||||
if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
|
if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
|
||||||
attribute = pango_attr_allow_breaks_new (g_value_get_boolean (&val));
|
attribute = pango_attr_allow_breaks_new (g_value_get_boolean (&val));
|
||||||
@ -1254,8 +1253,6 @@ attribute_from_text (GtkBuilder *builder,
|
|||||||
if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
|
if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
|
||||||
attribute = pango_attr_insert_hyphens_new (g_value_get_boolean (&val));
|
attribute = pango_attr_insert_hyphens_new (g_value_get_boolean (&val));
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
case PANGO_ATTR_OVERLINE:
|
case PANGO_ATTR_OVERLINE:
|
||||||
if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_OVERLINE, value, &val, NULL))
|
if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_OVERLINE, value, &val, NULL))
|
||||||
attribute = pango_attr_overline_new (g_value_get_enum (&val));
|
attribute = pango_attr_overline_new (g_value_get_enum (&val));
|
||||||
@ -1269,7 +1266,6 @@ attribute_from_text (GtkBuilder *builder,
|
|||||||
color->blue * 65535);
|
color->blue * 65535);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case PANGO_ATTR_INVALID:
|
case PANGO_ATTR_INVALID:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -4772,7 +4772,6 @@ get_tag_for_attributes (PangoAttrIterator *iter)
|
|||||||
g_object_set (tag, "underline-rgba", &rgba, NULL);
|
g_object_set (tag, "underline-rgba", &rgba, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_OVERLINE);
|
attr = pango_attr_iterator_get (iter, PANGO_ATTR_OVERLINE);
|
||||||
if (attr)
|
if (attr)
|
||||||
g_object_set (tag, "overline", ((PangoAttrInt*)attr)->value, NULL);
|
g_object_set (tag, "overline", ((PangoAttrInt*)attr)->value, NULL);
|
||||||
@ -4790,7 +4789,6 @@ get_tag_for_attributes (PangoAttrIterator *iter)
|
|||||||
rgba.alpha = 1.;
|
rgba.alpha = 1.;
|
||||||
g_object_set (tag, "overline-rgba", &rgba, NULL);
|
g_object_set (tag, "overline-rgba", &rgba, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_STRIKETHROUGH);
|
attr = pango_attr_iterator_get (iter, PANGO_ATTR_STRIKETHROUGH);
|
||||||
if (attr)
|
if (attr)
|
||||||
|
@ -1597,7 +1597,6 @@ add_generic_attrs (GtkTextLayout *layout,
|
|||||||
pango_attr_list_insert (attrs, attr);
|
pango_attr_list_insert (attrs, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
if (appearance->overline != PANGO_OVERLINE_NONE)
|
if (appearance->overline != PANGO_OVERLINE_NONE)
|
||||||
{
|
{
|
||||||
attr = pango_attr_overline_new (appearance->overline);
|
attr = pango_attr_overline_new (appearance->overline);
|
||||||
@ -1619,7 +1618,6 @@ add_generic_attrs (GtkTextLayout *layout,
|
|||||||
|
|
||||||
pango_attr_list_insert (attrs, attr);
|
pango_attr_list_insert (attrs, attr);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (appearance->strikethrough)
|
if (appearance->strikethrough)
|
||||||
{
|
{
|
||||||
@ -2140,7 +2138,6 @@ add_preedit_attrs (GtkTextLayout *layout,
|
|||||||
gdk_rgba_free (appearance.underline_rgba);
|
gdk_rgba_free (appearance.underline_rgba);
|
||||||
appearance.underline_rgba = gdk_rgba_copy (&rgba);
|
appearance.underline_rgba = gdk_rgba_copy (&rgba);
|
||||||
break;
|
break;
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
case PANGO_ATTR_OVERLINE:
|
case PANGO_ATTR_OVERLINE:
|
||||||
appearance.overline = ((PangoAttrInt *)attr)->value;
|
appearance.overline = ((PangoAttrInt *)attr)->value;
|
||||||
break;
|
break;
|
||||||
@ -2150,7 +2147,6 @@ add_preedit_attrs (GtkTextLayout *layout,
|
|||||||
gdk_rgba_free (appearance.overline_rgba);
|
gdk_rgba_free (appearance.overline_rgba);
|
||||||
appearance.overline_rgba = gdk_rgba_copy (&rgba);
|
appearance.overline_rgba = gdk_rgba_copy (&rgba);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case PANGO_ATTR_STRIKETHROUGH:
|
case PANGO_ATTR_STRIKETHROUGH:
|
||||||
appearance.strikethrough = ((PangoAttrInt *)attr)->value;
|
appearance.strikethrough = ((PangoAttrInt *)attr)->value;
|
||||||
break;
|
break;
|
||||||
|
@ -117,10 +117,8 @@ enum {
|
|||||||
PROP_RIGHT_MARGIN,
|
PROP_RIGHT_MARGIN,
|
||||||
PROP_UNDERLINE,
|
PROP_UNDERLINE,
|
||||||
PROP_UNDERLINE_RGBA,
|
PROP_UNDERLINE_RGBA,
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
PROP_OVERLINE,
|
PROP_OVERLINE,
|
||||||
PROP_OVERLINE_RGBA,
|
PROP_OVERLINE_RGBA,
|
||||||
#endif
|
|
||||||
PROP_RISE,
|
PROP_RISE,
|
||||||
PROP_BACKGROUND_FULL_HEIGHT,
|
PROP_BACKGROUND_FULL_HEIGHT,
|
||||||
PROP_LANGUAGE,
|
PROP_LANGUAGE,
|
||||||
@ -161,10 +159,8 @@ enum {
|
|||||||
PROP_RIGHT_MARGIN_SET,
|
PROP_RIGHT_MARGIN_SET,
|
||||||
PROP_UNDERLINE_SET,
|
PROP_UNDERLINE_SET,
|
||||||
PROP_UNDERLINE_RGBA_SET,
|
PROP_UNDERLINE_RGBA_SET,
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
PROP_OVERLINE_SET,
|
PROP_OVERLINE_SET,
|
||||||
PROP_OVERLINE_RGBA_SET,
|
PROP_OVERLINE_RGBA_SET,
|
||||||
#endif
|
|
||||||
PROP_RISE_SET,
|
PROP_RISE_SET,
|
||||||
PROP_BACKGROUND_FULL_HEIGHT_SET,
|
PROP_BACKGROUND_FULL_HEIGHT_SET,
|
||||||
PROP_LANGUAGE_SET,
|
PROP_LANGUAGE_SET,
|
||||||
@ -514,7 +510,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
|||||||
GDK_TYPE_RGBA,
|
GDK_TYPE_RGBA,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_OVERLINE,
|
PROP_OVERLINE,
|
||||||
g_param_spec_enum ("overline",
|
g_param_spec_enum ("overline",
|
||||||
@ -531,7 +526,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
|||||||
P_("Color of overline for this text"),
|
P_("Color of overline for this text"),
|
||||||
GDK_TYPE_RGBA,
|
GDK_TYPE_RGBA,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkTextTag:strikethrough-rgba:
|
* GtkTextTag:strikethrough-rgba:
|
||||||
@ -793,7 +787,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
|||||||
P_("Underline RGBA set"),
|
P_("Underline RGBA set"),
|
||||||
P_("Whether this tag affects underlining color"));
|
P_("Whether this tag affects underlining color"));
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
ADD_SET_PROP ("overline-set", PROP_OVERLINE_SET,
|
ADD_SET_PROP ("overline-set", PROP_OVERLINE_SET,
|
||||||
P_("Overline set"),
|
P_("Overline set"),
|
||||||
P_("Whether this tag affects overlining"));
|
P_("Whether this tag affects overlining"));
|
||||||
@ -801,7 +794,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
|||||||
ADD_SET_PROP ("overline-rgba-set", PROP_OVERLINE_RGBA_SET,
|
ADD_SET_PROP ("overline-rgba-set", PROP_OVERLINE_RGBA_SET,
|
||||||
P_("Overline RGBA set"),
|
P_("Overline RGBA set"),
|
||||||
P_("Whether this tag affects overlining color"));
|
P_("Whether this tag affects overlining color"));
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkTextTag:strikethrough-rgba-set:
|
* GtkTextTag:strikethrough-rgba-set:
|
||||||
@ -929,7 +921,6 @@ set_underline_rgba (GtkTextTag *tag,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
static void
|
static void
|
||||||
set_overline_rgba (GtkTextTag *tag,
|
set_overline_rgba (GtkTextTag *tag,
|
||||||
const GdkRGBA *rgba)
|
const GdkRGBA *rgba)
|
||||||
@ -959,7 +950,6 @@ set_overline_rgba (GtkTextTag *tag,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_strikethrough_rgba (GtkTextTag *tag,
|
set_strikethrough_rgba (GtkTextTag *tag,
|
||||||
@ -1485,7 +1475,6 @@ gtk_text_tag_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
case PROP_OVERLINE:
|
case PROP_OVERLINE:
|
||||||
priv->overline_set = TRUE;
|
priv->overline_set = TRUE;
|
||||||
priv->values->appearance.overline = g_value_get_enum (value);
|
priv->values->appearance.overline = g_value_get_enum (value);
|
||||||
@ -1498,7 +1487,6 @@ gtk_text_tag_set_property (GObject *object,
|
|||||||
set_overline_rgba (text_tag, color);
|
set_overline_rgba (text_tag, color);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case PROP_RISE:
|
case PROP_RISE:
|
||||||
priv->rise_set = TRUE;
|
priv->rise_set = TRUE;
|
||||||
@ -1702,7 +1690,6 @@ gtk_text_tag_set_property (GObject *object,
|
|||||||
priv->underline_rgba_set = g_value_get_boolean (value);
|
priv->underline_rgba_set = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
case PROP_OVERLINE_SET:
|
case PROP_OVERLINE_SET:
|
||||||
priv->overline_set = g_value_get_boolean (value);
|
priv->overline_set = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
@ -1710,7 +1697,6 @@ gtk_text_tag_set_property (GObject *object,
|
|||||||
case PROP_OVERLINE_RGBA_SET:
|
case PROP_OVERLINE_RGBA_SET:
|
||||||
priv->overline_rgba_set = g_value_get_boolean (value);
|
priv->overline_rgba_set = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case PROP_RISE_SET:
|
case PROP_RISE_SET:
|
||||||
priv->rise_set = g_value_get_boolean (value);
|
priv->rise_set = g_value_get_boolean (value);
|
||||||
@ -1913,7 +1899,6 @@ gtk_text_tag_get_property (GObject *object,
|
|||||||
g_value_set_boxed (value, priv->values->appearance.underline_rgba);
|
g_value_set_boxed (value, priv->values->appearance.underline_rgba);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
case PROP_OVERLINE:
|
case PROP_OVERLINE:
|
||||||
g_value_set_enum (value, priv->values->appearance.overline);
|
g_value_set_enum (value, priv->values->appearance.overline);
|
||||||
break;
|
break;
|
||||||
@ -1922,7 +1907,6 @@ gtk_text_tag_get_property (GObject *object,
|
|||||||
if (priv->overline_rgba_set)
|
if (priv->overline_rgba_set)
|
||||||
g_value_set_boxed (value, priv->values->appearance.overline_rgba);
|
g_value_set_boxed (value, priv->values->appearance.overline_rgba);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case PROP_RISE:
|
case PROP_RISE:
|
||||||
g_value_set_int (value, priv->values->appearance.rise);
|
g_value_set_int (value, priv->values->appearance.rise);
|
||||||
@ -2056,7 +2040,6 @@ gtk_text_tag_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, priv->underline_rgba_set);
|
g_value_set_boolean (value, priv->underline_rgba_set);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if PANGO_VERSION_CHECK(1,45,0)
|
|
||||||
case PROP_OVERLINE_SET:
|
case PROP_OVERLINE_SET:
|
||||||
g_value_set_boolean (value, priv->overline_set);
|
g_value_set_boolean (value, priv->overline_set);
|
||||||
break;
|
break;
|
||||||
@ -2064,7 +2047,6 @@ gtk_text_tag_get_property (GObject *object,
|
|||||||
case PROP_OVERLINE_RGBA_SET:
|
case PROP_OVERLINE_RGBA_SET:
|
||||||
g_value_set_boolean (value, priv->overline_rgba_set);
|
g_value_set_boolean (value, priv->overline_rgba_set);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case PROP_RISE_SET:
|
case PROP_RISE_SET:
|
||||||
g_value_set_boolean (value, priv->rise_set);
|
g_value_set_boolean (value, priv->rise_set);
|
||||||
|
Loading…
Reference in New Issue
Block a user