experiment with revealers

parent 5612244e
......@@ -489,7 +489,7 @@ gtk_private_h_sources = \
gtkgestureswipeprivate.h \
gtkgesturezoomprivate.h \
gtkheaderbarprivate.h \
gtkhidingboxprivate.h \
gtkhidingbox.h \
gtkhslaprivate.h \
gtkiconcache.h \
gtkiconhelperprivate.h \
......
......@@ -121,6 +121,7 @@
#include <gtk/gtkglarea.h>
#include <gtk/gtkgrid.h>
#include <gtk/gtkheaderbar.h>
#include <gtk/gtkhidingbox.h>
#include <gtk/gtkicontheme.h>
#include <gtk/gtkiconview.h>
#include <gtk/gtkimage.h>
......
......@@ -479,7 +479,12 @@ count_expand_children (GtkBox *box,
{
*visible_children += 1;
if (child->expand || gtk_widget_compute_expand (child->widget, private->orientation))
{
if (GTK_IS_REVEALER (child->widget))
g_print ("########################## IT IS\n");
*expand_children += 1;
}
}
}
}
......
......@@ -29,6 +29,7 @@
#include "gtkcontainerprivate.h"
#include "gtkcsscustomgadgetprivate.h"
#include "gtkprivate.h"
#include "gtkrevealer.h"
#include "gtkintl.h"
......@@ -1000,7 +1001,12 @@ gtk_grid_request_compute_expand (GtkGridRequest *request,
line = &lines->lines[attach->pos - lines->min];
line->empty = FALSE;
if (gtk_widget_compute_expand (child->widget, orientation))
{
if (GTK_IS_REVEALER (child->widget))
g_print ("########################## IT IS\n");
line->expand = TRUE;
}
}
for (list = priv->children; list; list = list->next)
......@@ -1030,6 +1036,8 @@ gtk_grid_request_compute_expand (GtkGridRequest *request,
if (!has_expand && gtk_widget_compute_expand (child->widget, orientation))
{
if (GTK_IS_REVEALER (child->widget))
g_print ("########################## IT IS\n");
for (i = 0; i < attach->span; i++)
{
if (attach->pos + i >= max || attach->pos + 1 < min)
......
This diff is collapsed.
......@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __GTK_HIDING_BOX_PRIVATE_H__
#define __GTK_HIDING_BOX_PRIVATE_H__
#ifndef __GTK_HIDING_BOX_H__
#define __GTK_HIDING_BOX_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
......@@ -74,4 +74,4 @@ GDK_AVAILABLE_IN_3_20
GList *gtk_hiding_box_get_overflow_children (GtkHidingBox *box);
G_END_DECLS
#endif /* GTK_HIDING_BOX_PRIVATE_H_ */
#endif /* GTK_HIDING_BOX_H_ */
......@@ -37,7 +37,7 @@
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtktypebuiltins.h"
#include "gtkhidingboxprivate.h"
#include "gtkhidingbox.h"
/**
* SECTION:gtkpathbar
......
......@@ -25,7 +25,7 @@
#include "gtkwidget.h"
#include "gtkmenubutton.h"
#include "gtksizerequest.h"
#include "gtkhidingboxprivate.h"
#include "gtkhidingbox.h"
#include "gtkwidgetprivate.h"
#include "glib-object.h"
......
......@@ -456,6 +456,7 @@ gtk_revealer_real_size_allocate (GtkWidget *widget,
g_return_if_fail (allocation != NULL);
g_print ("revealer allocation %d %d %d %d\n", allocation->height, allocation->width, allocation->x, allocation->y);
gtk_widget_set_allocation (widget, allocation);
gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation);
......
......@@ -1597,6 +1597,20 @@ path-bar button.flat, .path-bar-overflow-popover button.flat {
}
}
.pathbar-initial-opacity {
opacity: 0;
}
.pathbar-opacity-on {
opacity: 1;
transition-duration: 250ms;
}
.pathbar-opacity-off {
opacity: 0;
transition-duration: 250ms;
}
/**************
* Tree Views *
**************/
......
......@@ -2102,6 +2102,17 @@ path-bar button.flat, .path-bar-overflow-popover button.flat {
border-color: transparent;
background-image: none; }
.pathbar-initial-opacity {
opacity: 0; }
.pathbar-opacity-on {
opacity: 1;
transition-duration: 250ms; }
.pathbar-opacity-off {
opacity: 0;
transition-duration: 250ms; }
/**************
* Tree Views *
**************/
......
......@@ -2109,6 +2109,17 @@ path-bar button.flat, .path-bar-overflow-popover button.flat {
border-color: transparent;
background-image: none; }
.pathbar-initial-opacity {
opacity: 0; }
.pathbar-opacity-on {
opacity: 1;
transition-duration: 250ms; }
.pathbar-opacity-off {
opacity: 0;
transition-duration: 250ms; }
/**************
* Tree Views *
**************/
......
......@@ -86,6 +86,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \
testgtk \
testheaderbar \
testheightforwidth \
testhidingbox \
testiconview \
testiconview-keynav \
testicontheme \
......@@ -293,6 +294,7 @@ testpixbuf_save_DEPENDENCIES = $(TEST_DEPS)
testpixbuf_color_DEPENDENCIES = $(TEST_DEPS)
testpixbuf_scale_DEPENDENCIES = $(TEST_DEPS)
testpathbar_DEPENDENCIES = $(TEST_DEPS)
testhidingbox_DEPENDENCIES = $(TEST_DEPS)
testgmenu_DEPENDENCIES = $(TEST_DEPS)
testlogout_DEPENDENCIES = $(TEST_DEPS)
teststack_DEPENDENCIES = $(TEST_DEPS)
......@@ -396,6 +398,9 @@ testmenubutton_SOURCES = \
testpathbar_SOURCES = \
testpathbar.c
testhidingbox_SOURCES = \
testhidingbox.c
testprint_SOURCES = \
testprint.c \
testprintfileoperation.h \
......
#include "config.h"
#include "glib.h"
#include <gtk/gtk.h>
#include <gtk/gtkhidingboxprivate.h>
#define N_BUTTONS 10
static GtkWidget *hiding_box;
static char *lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
static char*
get_lorem_ipsum ()
{
static char **lorem_ipsum_split;
static int n_lorem_ipsum_words;
if (!lorem_ipsum_split)
{
lorem_ipsum_split = g_strsplit (lorem_ipsum, " ", -1);
n_lorem_ipsum_words = g_strv_length (lorem_ipsum_split);
}
return lorem_ipsum_split [g_random_int_range (0, n_lorem_ipsum_words)];
}
static void
on_path_selected (GtkPathBar *path_bar,
......@@ -17,6 +34,7 @@ static void
on_button_clicked (GtkWidget *button,
gpointer user_data)
{
g_print ("button clicked\n");
gtk_container_remove (GTK_CONTAINER (user_data), button);
}
......@@ -25,14 +43,46 @@ on_reset_button_clicked (GtkButton *reset_button)
{
GtkWidget *button;
gtk_container_foreach (GTK_CONTAINER (hiding_box), gtk_widget_destroy);
gtk_container_foreach (GTK_CONTAINER (hiding_box), (GtkCallback) gtk_widget_destroy, NULL);
for (int i = 0; i < N_BUTTONS; i++)
{
button = gtk_button_new_with_label (get_lorem_ipsum ());
g_signal_connect (button, "clicked", (GCallback) on_button_clicked, hiding_box);
gtk_container_add (GTK_CONTAINER (hiding_box), button);
}
gtk_widget_show_all (hiding_box);
}
static void
on_add_button (gint line)
{
GtkWidget *button;
button = gtk_button_new_with_label (get_lorem_ipsum ());
gtk_widget_show (button);
g_signal_connect (button, "clicked", (GCallback) on_button_clicked, hiding_box);
gtk_container_add (GTK_CONTAINER (hiding_box), button);
}
button = gtk_button_new_with_label ("test1");
g_signal_connect (button, "clicked", on_button_clicked, hiding_box);
gtk_container_add (GTK_CONTAINER (hiding_box), );
gtk_container_add (GTK_CONTAINER (hiding_box), gtk_button_new_with_label ("test2"));
gtk_container_add (GTK_CONTAINER (hiding_box), gtk_button_new_with_label ("test3"));
gtk_container_add (GTK_CONTAINER (hiding_box), gtk_button_new_with_label ("test4"));
static void
on_remove_button (gint line)
{
GList *children;
GList *last;
children = gtk_container_get_children (hiding_box);
last = g_list_last (children);
if (last)
gtk_container_remove (hiding_box, GTK_WIDGET (last->data));
}
static void
on_invert_button (gint line)
{
gtk_hiding_box_set_inverted (GTK_HIDING_BOX (hiding_box),
!gtk_hiding_box_get_inverted (GTK_HIDING_BOX (hiding_box)));
}
int
......@@ -41,6 +91,9 @@ main (int argc, char *argv[])
GtkWidget *window;
GtkWidget *grid;
GtkWidget *reset_button;
GtkWidget *add_button;
GtkWidget *remove_button;
GtkWidget *invert_button;
GtkWidget *label;
GFile *file = NULL;
GIcon *icon;
......@@ -63,8 +116,25 @@ main (int argc, char *argv[])
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 2, 1);
/* ----------------------------------------------------------------------- */
hiding_box = gtk_hiding_box ();
hiding_box = gtk_hiding_box_new ();
gtk_grid_attach (GTK_GRID (grid), hiding_box, 0, 1, 1, 1);
gtk_widget_show_all (hiding_box);
/* Add/Remove buttons */
add_button = gtk_button_new_with_label ("Add");
gtk_widget_set_halign (add_button, GTK_ALIGN_END);
remove_button = gtk_button_new_with_label ("Remove");
gtk_widget_set_halign (remove_button, GTK_ALIGN_END);
gtk_grid_attach_next_to (GTK_GRID (grid), add_button, hiding_box, GTK_POS_RIGHT, 1, 1);
g_signal_connect_swapped (add_button, "clicked", (GCallback) on_add_button, GINT_TO_POINTER (0));
gtk_grid_attach_next_to (GTK_GRID (grid), remove_button, add_button, GTK_POS_RIGHT, 1, 1);
g_signal_connect_swapped (remove_button, "clicked", (GCallback) on_remove_button, GINT_TO_POINTER (0));
gtk_widget_show (add_button);
gtk_widget_show (remove_button);
/* Inverted button */
invert_button = gtk_button_new_with_label ("Invert");
gtk_widget_set_halign (invert_button, GTK_ALIGN_END);
gtk_grid_attach_next_to (GTK_GRID (grid), invert_button, remove_button, GTK_POS_RIGHT, 1, 1);
g_signal_connect_swapped (invert_button, "clicked", (GCallback) on_invert_button, GINT_TO_POINTER (0));
/* Reset button */
reset_button = gtk_button_new_with_label ("Reset State");
......
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