+2008-08-07 Alberto Garcia <agarcia@igalia.com>
+
+ HildonButtonFlags split into HildonButtonArrangement (to set the
+ button layout) and HildonSizeType (which can be used for any
+ widget).
+
+ * src/hildon-button.h
+ * src/hildon-button.c
+ (hildon_button_class_init)
+ (hildon_button_set_arrangement)
+ (hildon_button_set_property): New "size-flags"
+ property. "arrangement-flags" renamed to "arrangement".
+ (hildon_button_new, hildon_button_new_with_text)
+ (hildon_button_new_full): Constructors updated to reflect type changes.
+
+ * src/hildon-helper.h
+ * src/hildon-helper.c (hildon_helper_set_theme_size): New function
+ to set the size of a widget.
+
+ * src/Makefile.am
+ * src/hildon.h
+ * src/hildon-button-helpers.c
+ * src/hildon-button-helpers.h: New hildon-button-helpers module.
+
+ * src/hildon-date-button.c
+ * src/hildon-date-button.h
+ * src/hildon-picker-button.c
+ * src/hildon-picker-button.h
+ * src/hildon-time-button.c
+ * src/hildon-time-button.h: Updated widgets to reflect
+ HildonButton API changes.
+
+ * examples/hildon-button-example.c
+ * examples/hildon-date-button-example.c
+ * examples/hildon-picker-button-example.c
+ * examples/hildon-picker-button-multicolumn-example.c
+ * examples/hildon-time-button-example.c
+ * examples/hildon-touch-selector-entry-example.c
+ * examples/hildon-touch-selector-example.c: Updated examples to
+ reflect HildonButton API changes.
+
2008-08-06 Claudio Saavedra <csaavedra@igalia.com>
* doc/hildon-docs.sgml:
GtkBox *vbox2;
GtkBox *vbox3;
int i;
- HildonButtonFlags layout;
+ HildonButtonArrangement arrangement;
/* Create window */
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (win), 20);
- layout = gtk_toggle_button_get_active (horizontal) ?
- HILDON_BUTTON_WITH_HORIZONTAL_VALUE :
- HILDON_BUTTON_WITH_VERTICAL_VALUE;
+ arrangement = gtk_toggle_button_get_active (horizontal) ?
+ HILDON_BUTTON_ARRANGEMENT_HORIZONTAL :
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL;
/* Create and pack boxes */
hbox = GTK_BOX (gtk_hbox_new (FALSE, 10));
/* Finger buttons */
gtk_box_pack_start (vbox1, gtk_label_new ("Finger height"), FALSE, FALSE, 0);
for (i = 0; i < 4; i++) {
- char *title = g_strdup_printf ("Title %d", i);
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_FINGER_HEIGHT, title,
+ gchar *title = g_strdup_printf ("Title %d", i);
+ button = hildon_button_new_with_text (HILDON_SIZE_FINGER_HEIGHT |
+ HILDON_SIZE_AUTO_WIDTH, arrangement, title,
i % 2 ? "Value" : NULL);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
gtk_box_pack_start (vbox1, button, FALSE, FALSE, 0);
/* Thumb buttons */
gtk_box_pack_start (vbox2, gtk_label_new ("Thumb height"), FALSE, FALSE, 0);
for (i = 0; i < 3; i++) {
- char *title = g_strdup_printf ("Title %d", i);
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_THUMB_HEIGHT, title,
+ gchar *title = g_strdup_printf ("Title %d", i);
+ button = hildon_button_new_with_text (HILDON_SIZE_THUMB_HEIGHT |
+ HILDON_SIZE_AUTO_WIDTH, arrangement, title,
i % 2 ? "Value" : NULL);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
gtk_box_pack_start (vbox2, button, FALSE, FALSE, 0);
/* Auto buttons */
gtk_box_pack_start (vbox3, gtk_label_new ("Auto height"), FALSE, FALSE, 0);
for (i = 0; i < 6; i++) {
- char *title = g_strdup_printf ("Title %d", i);
- button = hildon_button_new_with_text (layout, title,
+ gchar *title = g_strdup_printf ("Title %d", i);
+ button = hildon_button_new_with_text (HILDON_SIZE_AUTO, arrangement, title,
i % 2 ? "Value" : NULL);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
gtk_box_pack_start (vbox3, button, FALSE, FALSE, 0);
GtkBox *hbox2;
GtkBox *hbox3;
GtkBox *hbox4;
- HildonButtonFlags layout;
+ HildonButtonArrangement arrangement;
/* Create window */
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (win), 20);
- layout = gtk_toggle_button_get_active (horizontal) ?
- HILDON_BUTTON_WITH_HORIZONTAL_VALUE :
- HILDON_BUTTON_WITH_VERTICAL_VALUE;
+ arrangement = gtk_toggle_button_get_active (horizontal) ?
+ HILDON_BUTTON_ARRANGEMENT_HORIZONTAL :
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL;
/* Create and pack boxes */
vbox = GTK_BOX (gtk_vbox_new (FALSE, 10));
gtk_box_pack_start (vbox, GTK_WIDGET (hbox4), FALSE, FALSE, 0);
/* Full screen width button */
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_FULLSCREEN_WIDTH |
- HILDON_BUTTON_FINGER_HEIGHT, "Full width", "Value");
+ button = hildon_button_new_with_text (HILDON_SIZE_FULLSCREEN_WIDTH |
+ HILDON_SIZE_FINGER_HEIGHT, arrangement, "Full width", "Value");
gtk_box_pack_start (hbox1, button, TRUE, TRUE, 0);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
/* Half screen width buttons */
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_HALFSCREEN_WIDTH |
- HILDON_BUTTON_FINGER_HEIGHT, "Half width 1", "Value");
+ button = hildon_button_new_with_text (HILDON_SIZE_HALFSCREEN_WIDTH |
+ HILDON_SIZE_FINGER_HEIGHT, arrangement, "Half width 1", "Value");
gtk_box_pack_start (hbox2, button, TRUE, TRUE, 0);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_HALFSCREEN_WIDTH |
- HILDON_BUTTON_FINGER_HEIGHT,
+ button = hildon_button_new_with_text (HILDON_SIZE_HALFSCREEN_WIDTH |
+ HILDON_SIZE_FINGER_HEIGHT, arrangement,
"Half width 2 with long title",
"Value");
gtk_box_pack_start (hbox2, button, TRUE, TRUE, 0);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
/* Half screen width buttons */
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_HALFSCREEN_WIDTH |
- HILDON_BUTTON_FINGER_HEIGHT, "Half width 3", NULL);
+ button = hildon_button_new_with_text (HILDON_SIZE_HALFSCREEN_WIDTH |
+ HILDON_SIZE_FINGER_HEIGHT, arrangement, "Half width 3", NULL);
gtk_box_pack_start (hbox3, button, TRUE, TRUE, 0);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_HALFSCREEN_WIDTH |
- HILDON_BUTTON_FINGER_HEIGHT,
+ button = hildon_button_new_with_text (HILDON_SIZE_HALFSCREEN_WIDTH |
+ HILDON_SIZE_FINGER_HEIGHT, arrangement,
"Half width 4 with very long title (REALLY long)",
"Value (title is truncated)");
gtk_box_pack_start (hbox3, button, TRUE, TRUE, 0);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
/* Auto width button */
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_AUTO_WIDTH |
- HILDON_BUTTON_FINGER_HEIGHT,
+ button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH |
+ HILDON_SIZE_FINGER_HEIGHT, arrangement,
"Auto width 1", "Value");
gtk_box_pack_start (hbox4, button, TRUE, TRUE, 0);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
- button = hildon_button_new_with_text (layout |
- HILDON_BUTTON_AUTO_WIDTH |
- HILDON_BUTTON_FINGER_HEIGHT,
+ button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH |
+ HILDON_SIZE_FINGER_HEIGHT, arrangement,
"Auto width 2 with longer text", NULL);
gtk_box_pack_start (hbox4, button, TRUE, TRUE, 0);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
hildon_program_add_window (program, HILDON_WINDOW (window));
- button = hildon_date_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ button = hildon_date_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
g_signal_connect (G_OBJECT (button), "value-changed",
G_CALLBACK (on_picker_value_changed), NULL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
hildon_program_add_window (program, HILDON_WINDOW (window));
- button = hildon_picker_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
selector = hildon_touch_selector_new_text ();
hildon_button_set_title (HILDON_BUTTON (button), "Continent");
hildon_program_add_window (program, HILDON_WINDOW (window));
selector = create_touch_selector ();
- button = hildon_picker_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
hildon_button_set_title (HILDON_BUTTON (button), "Protocol");
hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
HILDON_TOUCH_SELECTOR (selector));
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
hildon_program_add_window (program, HILDON_WINDOW (window));
- button = hildon_time_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ button = hildon_time_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
g_signal_connect (G_OBJECT (button), "value-changed",
G_CALLBACK (on_picker_value_changed), NULL);
"class \"HildonTouchSelector\" style \"default\"\n");
- button = hildon_picker_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
hildon_button_set_title (HILDON_BUTTON (button), "Pick a band!");
selector = hildon_touch_selector_entry_new_text ();
for (i = 0; artists [i] != NULL; i++) {
label = gtk_label_new ("Here we are going to put the selection");
- button = hildon_picker_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
hildon_button_set_title (HILDON_BUTTON (button), "Click me..");
selector = create_selector ();
hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
hildon-bread-crumb-widget.c \
hildon-app-menu.c \
hildon-button.c \
+ hildon-button-helpers.c \
hildon-dialog.c
libhildon_@API_VERSION_MAJOR@_built_public_headers = \
hildon-app-menu.h \
hildon-dialog.h \
hildon-button.h \
+ hildon-button-helpers.h \
hildon-version.h
libhildon_@API_VERSION_MAJOR@_include_HEADERS = \
--- /dev/null
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program 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 Public License for more details.
+ *
+ */
+
+#include "hildon-button-helpers.h"
+
+GtkWidget *
+hildon_gtk_button_new (HildonSizeType size)
+{
+ GtkWidget *button = gtk_button_new ();
+ hildon_helper_set_theme_size (button, size);
+ return button;
+}
--- /dev/null
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program 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 Public License for more details.
+ *
+ */
+
+#ifndef __HILDON_BUTTON_HELPERS_H__
+#define __HILDON_BUTTON_HELPERS_H__
+
+#include <gtk/gtk.h>
+#include "hildon-helper.h"
+
+G_BEGIN_DECLS
+
+GtkWidget *
+hildon_gtk_button_new (HildonSizeType size);
+
+G_END_DECLS
+
+#endif /* __HILDON_BUTTON_HELPERS_H__ */
enum {
PROP_TITLE = 1,
PROP_VALUE,
- PROP_ARRANGEMENT_FLAGS
+ PROP_SIZE_FLAGS,
+ PROP_ARRANGEMENT
};
static void
-hildon_button_set_arrangement (HildonButton *button,
- HildonButtonFlags flags);
+hildon_button_set_arrangement (HildonButton *button,
+ HildonButtonArrangement arrangement);
static void
hildon_button_construct_child (HildonButton *button);
case PROP_VALUE:
hildon_button_set_value (button, g_value_get_string (value));
break;
- case PROP_ARRANGEMENT_FLAGS:
- hildon_button_set_arrangement (button, g_value_get_flags (value));
+ case PROP_SIZE_FLAGS:
+ hildon_helper_set_theme_size (GTK_WIDGET (button), g_value_get_flags (value));
+ break;
+ case PROP_ARRANGEMENT:
+ hildon_button_set_arrangement (button, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_object_class_install_property (
gobject_class,
- PROP_ARRANGEMENT_FLAGS,
+ PROP_SIZE_FLAGS,
g_param_spec_flags (
- "arrangement-flags",
- "Arrangement flags",
+ "size-flags",
+ "Size flags",
+ "Size request for the button",
+ HILDON_TYPE_SIZE_TYPE,
+ HILDON_SIZE_AUTO,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ gobject_class,
+ PROP_ARRANGEMENT,
+ g_param_spec_enum (
+ "arrangement",
+ "Arrangement",
"How the button contents must be arranged",
- HILDON_TYPE_BUTTON_FLAGS,
- HILDON_BUTTON_WITH_HORIZONTAL_VALUE,
+ HILDON_TYPE_BUTTON_ARRANGEMENT,
+ HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
gtk_widget_class_install_style_property (
/**
* hildon_button_new:
- * @flags: flags to set the size and layout of the button
+ * @size: Flags to set the size of the button.
+ * @arrangement: How the labels must be arranged.
*
* Creates a new #HildonButton. To add a child widget use gtk_container_add().
*
* Returns: a new #HildonButton
**/
GtkWidget *
-hildon_button_new (HildonButtonFlags flags)
+hildon_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement)
{
- return hildon_button_new_full (flags, NULL, NULL, NULL, NULL);
+ return hildon_button_new_full (size, arrangement, NULL, NULL, NULL, NULL);
}
/**
* hildon_button_new_with_text:
- * @flags: flags to set the size and layout of the button
- * @title: Title of the button (main label)
+ * @size: Flags to set the size of the button.
+ * @arrangement: How the labels must be arranged.
+ * @title: Title of the button (main label), or %NULL
* @value: Value of the button (secondary label), or %NULL
*
* Creates a new #HildonButton with two labels, @title and @value.
*
- * If you just want to use the main label, set @value to %NULL. You
- * can set it to a non-%NULL value at any time later.
+ * If you just don't want to use one of the labels, set it to
+ * %NULL. You can set it to a non-%NULL value at any time later.
*
* Returns: a new #HildonButton
**/
GtkWidget *
-hildon_button_new_with_text (HildonButtonFlags flags,
- const char *title,
- const char *value)
+hildon_button_new_with_text (HildonSizeType size,
+ HildonButtonArrangement arrangement,
+ const gchar *title,
+ const gchar *value)
{
- return hildon_button_new_full (flags, title, value, NULL, NULL);
+ return hildon_button_new_full (size, arrangement, title, value, NULL, NULL);
}
/**
* hildon_button_new_full:
- * @flags: flags to set the size and layout of the button
+ * @size: Flags to set the size of the button.
+ * @arrangement: How the labels must be arranged.
* @title: Title of the button (main label)
* @value: Value of the button (secondary label), or %NULL
* @title_size_group: a #GtkSizeGroup for the @title label, or %NULL
* Creates a new #HildonButton with two labels, @title and @value, and
* their respective size groups.
*
- * If you just want to use the main label, set @value to %NULL. You
- * can set it to a non-%NULL value at any time later.
+ * If you just don't want to use one of the labels, set it to
+ * %NULL. You can set it to a non-%NULL value at any time later.
*
* @title and @value will be added to @title_size_group and
* @value_size_group, respectively, if present.
* Returns: a new #HildonButton
**/
GtkWidget *
-hildon_button_new_full (HildonButtonFlags flags,
- const char *title,
- const char *value,
- GtkSizeGroup *title_size_group,
- GtkSizeGroup *value_size_group)
+hildon_button_new_full (HildonSizeType size,
+ HildonButtonArrangement arrangement,
+ const gchar *title,
+ const gchar *value,
+ GtkSizeGroup *title_size_group,
+ GtkSizeGroup *value_size_group)
{
GtkWidget *button;
/* Create widget */
button = g_object_new (HILDON_TYPE_BUTTON,
- "arrangement-flags", flags,
+ "size-flags", size,
+ "arrangement", arrangement,
"title", title,
"value", value,
"name", "hildon-button",
}
static void
-hildon_button_set_arrangement (HildonButton *button,
- HildonButtonFlags flags)
+hildon_button_set_arrangement (HildonButton *button,
+ HildonButtonArrangement arrangement)
{
GtkWidget *box;
HildonButtonPrivate *priv;
guint horizontal_spacing;
guint vertical_spacing;
- gint width = -1;
- gint height = -1;
- const char *widget_name = NULL;
priv = HILDON_BUTTON_GET_PRIVATE (button);
- /* Requested height */
- if (flags & HILDON_BUTTON_FINGER_HEIGHT) {
- height = FINGER_BUTTON_HEIGHT;
- widget_name = "hildon-finger-button";
- } else if (flags & HILDON_BUTTON_THUMB_HEIGHT) {
- height = THUMB_BUTTON_HEIGHT;
- widget_name = "hildon-thumb-button";
- }
-
- if (widget_name) {
- gtk_widget_set_name (GTK_WIDGET (button), widget_name);
- }
-
- /* Requested width */
- if (flags & HILDON_BUTTON_HALFSCREEN_WIDTH) {
- width = HALFSCREEN_BUTTON_WIDTH;
- } else if (flags & HILDON_BUTTON_FULLSCREEN_WIDTH) {
- width = FULLSCREEN_BUTTON_WIDTH;
- }
-
- g_object_set (button,
- "width-request", width,
- "height-request", height,
- NULL);
-
/* Pack everything */
gtk_widget_style_get (GTK_WIDGET (button),
"horizontal-spacing", &horizontal_spacing,
"vertical-spacing", &vertical_spacing,
NULL);
- if (flags & HILDON_BUTTON_WITH_VERTICAL_VALUE) {
+ if (arrangement == HILDON_BUTTON_ARRANGEMENT_VERTICAL) {
box = gtk_vbox_new (FALSE, vertical_spacing);
} else {
box = gtk_hbox_new (FALSE, horizontal_spacing);
**/
void
hildon_button_set_title (HildonButton *button,
- const char *title)
+ const gchar *title)
{
HildonButtonPrivate *priv;
**/
void
hildon_button_set_value (HildonButton *button,
- const char *value)
+ const gchar *value)
{
HildonButtonPrivate *priv;
* Returns: The text of the title label. This string is owned by the
* widget and must not be modified or freed.
**/
-const char *
+const gchar *
hildon_button_get_title (HildonButton *button)
{
HildonButtonPrivate *priv;
* Returns: The text of the value label. This string is owned by the
* widget and must not be modified or freed.
**/
-const char *
+const gchar *
hildon_button_get_value (HildonButton *button)
{
HildonButtonPrivate *priv;
**/
void
hildon_button_set_text (HildonButton *button,
- const char *title,
- const char *value)
+ const gchar *title,
+ const gchar *value)
{
hildon_button_set_title (button, title);
hildon_button_set_value (button, value);
#ifndef __HILDON_BUTTON_H__
#define __HILDON_BUTTON_H__
-#include <gtk/gtk.h>
+#include <gtk/gtk.h>
+#include "hildon-helper.h"
G_BEGIN_DECLS
};
typedef enum {
- HILDON_BUTTON_WITH_HORIZONTAL_VALUE = 1, /* adds second Label horizontally */
- HILDON_BUTTON_WITH_VERTICAL_VALUE = 2, /* adds second Label vertically */
- HILDON_BUTTON_AUTO_WIDTH = 0 << 2, /* leave width unset */
- HILDON_BUTTON_HALFSCREEN_WIDTH = 1 << 2, /* set to 50% screen width */
- HILDON_BUTTON_FULLSCREEN_WIDTH = 2 << 2, /* set to 100% screen width */
- HILDON_BUTTON_AUTO_HEIGHT = 0 << 4, /* leave height unset */
- HILDON_BUTTON_FINGER_HEIGHT = 1 << 4, /* set to finger height */
- HILDON_BUTTON_THUMB_HEIGHT = 2 << 4, /* set to thumb height */
-} HildonButtonFlags;
+ HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL
+} HildonButtonArrangement;
GType
hildon_button_get_type (void) G_GNUC_CONST;
GtkWidget *
-hildon_button_new (HildonButtonFlags flags);
+hildon_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement);
GtkWidget *
-hildon_button_new_with_text (HildonButtonFlags flags,
- const char *title,
- const char *value);
+hildon_button_new_with_text (HildonSizeType size,
+ HildonButtonArrangement arrangement,
+ const gchar *title,
+ const gchar *value);
GtkWidget *
-hildon_button_new_full (HildonButtonFlags flags,
- const char *title,
- const char *value,
- GtkSizeGroup *title_size_group,
- GtkSizeGroup *value_size_group);
+hildon_button_new_full (HildonSizeType size,
+ HildonButtonArrangement arrangement,
+ const gchar *title,
+ const gchar *value,
+ GtkSizeGroup *title_size_group,
+ GtkSizeGroup *value_size_group);
void
hildon_button_set_title (HildonButton *button,
- const char *title);
+ const gchar *title);
void
hildon_button_set_value (HildonButton *button,
- const char *value);
+ const gchar *value);
-const char *
+const gchar *
hildon_button_get_title (HildonButton *button);
-const char *
+const gchar *
hildon_button_get_value (HildonButton *button);
void
hildon_button_set_text (HildonButton *button,
- const char *title,
- const char *value);
+ const gchar *title,
+ const gchar *value);
void
hildon_button_set_size_groups (HildonButton *button,
}
GtkWidget *
-hildon_date_button_new (HildonButtonFlags flags)
+hildon_date_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement)
{
return g_object_new (HILDON_TYPE_DATE_BUTTON,
"title", "Date",
- "arrangement-flags", flags,
+ "arrangement", arrangement,
+ "size-flags", size,
NULL);
}
} HildonDateButtonClass;
GType hildon_date_button_get_type (void);
-GtkWidget *hildon_date_button_new (HildonButtonFlags flags);
+GtkWidget *hildon_date_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement);
void hildon_date_button_get_date (HildonDateButton * button,
guint * year, guint * month, guint * day);
#include "hildon-helper.h"
#include "hildon-banner.h"
+#define HILDON_HEIGHT_FINGER 70
+
+#define HILDON_HEIGHT_THUMB 105
+
+#define HILDON_WIDTH_FULLSCREEN (gdk_screen_get_width (gdk_screen_get_default ()))
+
+#define HILDON_WIDTH_HALFSCREEN (HILDON_WIDTH_FULLSCREEN / 2)
+
#define HILDON_FINGER_PRESSURE_THRESHOLD 0.4
#define HILDON_FINGER_BUTTON 8
gtk_widget_set_name (win->vscrollbar, (thumb) ? "hildon-thumb-scrollbar" : NULL);
}
+/**
+ * hildon_helper_set_theme_size
+ * @widget: A @GtkWidget
+ * @size: Flags indicating the size of the widget
+ *
+ * This function sets the requested size of a widget.
+ **/
+void
+hildon_helper_set_theme_size (GtkWidget *widget,
+ HildonSizeType size)
+{
+ gint width = -1;
+ gint height = -1;
+ const gchar *widget_name = NULL;
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ /* Requested height */
+ if (size & HILDON_SIZE_FINGER_HEIGHT) {
+ height = HILDON_HEIGHT_FINGER;
+ widget_name = "hildon-finger-widget";
+ } else if (size & HILDON_SIZE_THUMB_HEIGHT) {
+ height = HILDON_HEIGHT_THUMB;
+ widget_name = "hildon-thumb-widget";
+ }
+ /* Requested width */
+ if (size & HILDON_SIZE_HALFSCREEN_WIDTH) {
+ width = HILDON_WIDTH_HALFSCREEN;
+ } else if (size & HILDON_SIZE_FULLSCREEN_WIDTH) {
+ width = HILDON_WIDTH_FULLSCREEN;
+ }
+
+ gtk_widget_set_size_request (widget, width, height);
+
+ if (widget_name)
+ gtk_widget_set_name (widget, widget_name);
+}
G_BEGIN_DECLS
+typedef enum {
+ HILDON_SIZE_AUTO_WIDTH = 0 << 0, /* set to automatic width */
+ HILDON_SIZE_HALFSCREEN_WIDTH = 1 << 0, /* set to 50% screen width */
+ HILDON_SIZE_FULLSCREEN_WIDTH = 2 << 0, /* set to 100% screen width */
+ HILDON_SIZE_AUTO_HEIGHT = 0 << 2, /* set to automatic height */
+ HILDON_SIZE_FINGER_HEIGHT = 1 << 2, /* set to finger height */
+ HILDON_SIZE_THUMB_HEIGHT = 2 << 2, /* set to thumb height */
+ HILDON_SIZE_AUTO = (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_AUTO_HEIGHT)
+} HildonSizeType;
+
gulong
hildon_helper_set_logical_font (GtkWidget *widget,
const gchar *logicalfontname);
hildon_helper_set_thumb_scrollbar (GtkScrolledWindow *win,
gboolean thumb);
+void
+hildon_helper_set_theme_size (GtkWidget *button,
+ HildonSizeType size);
+
G_END_DECLS
#endif /* __HILDON_HELPER_H__ */
}
GtkWidget *
-hildon_picker_button_new (HildonButtonFlags flags)
+hildon_picker_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement)
{
GtkWidget *button;
button = g_object_new (HILDON_TYPE_PICKER_BUTTON,
- "arrangement-flags", flags, NULL);
+ "arrangement", arrangement, "size-flags", size, NULL);
return button;
}
} HildonPickerButtonClass;
GType hildon_picker_button_get_type (void);
-GtkWidget *hildon_picker_button_new (HildonButtonFlags flags);
+GtkWidget *hildon_picker_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement);
void hildon_picker_button_set_selector (HildonPickerButton * button,
HildonTouchSelector * selector);
}
GtkWidget *
-hildon_time_button_new (HildonButtonFlags flags)
+hildon_time_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement)
{
return g_object_new (HILDON_TYPE_TIME_BUTTON,
- "title", "Time", "arrangement-flags", flags, NULL);
+ "title", "Time", "arrangement", arrangement, "size-flags", size, NULL);
}
void
} HildonTimeButtonClass;
GType hildon_time_button_get_type (void);
-GtkWidget *hildon_time_button_new (HildonButtonFlags flags);
+GtkWidget *hildon_time_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement);
void hildon_time_button_get_time (HildonTimeButton * button,
guint * hours, guint * minutes);
#include "hildon-pannable-area.h"
#include "hildon-app-menu.h"
#include "hildon-button.h"
+#include "hildon-button-helpers.h"
#include "hildon-dialog.h"
#endif