+2008-08-08 Alberto Garcia <agarcia@igalia.com>
+
+ * doc/hildon-docs.sgml
+ * src/Makefile.am
+ * src/hildon.h
+ * src/hildon-gtk.h
+ * src/hildon-gtk.c: Convenience functions for standard Gtk
+ widgets, used to easily perform frequent operations.
+
+ * src/hildon-button-helpers.h
+ * src/hildon-button-helpers.c: Removed in favour of hildon-gtk.[ch]
+
+ * src/hildon-helper.h
+ * src/hildon-helper.c (hildon_helper_set_theme_size): Renamed to
+ hildon_gtk_widget_set_theme_size and moved to hildon-gtk.h
+
+ * src/hildon-button.h
+ * src/hildon-button.c: Use the new hildon-gtk.[ch] functions.
+
2008-08-07 Alberto Garcia <agarcia@igalia.com>
* src/hildon-button.c (hildon_button_init)
<chapter>
<title>Other</title>
<xi:include href="xml/hildon-pannable-area.xml"/>
+ <xi:include href="xml/hildon-gtk.xml"/>
<xi:include href="xml/hildon-sound.xml"/>
<xi:include href="xml/hildon-helper.xml"/>
<xi:include href="xml/hildon-defines.xml"/>
hildon-bread-crumb-widget.c \
hildon-app-menu.c \
hildon-button.c \
- hildon-button-helpers.c \
+ hildon-gtk.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-gtk.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__ */
hildon_button_set_value (button, g_value_get_string (value));
break;
case PROP_SIZE:
- hildon_helper_set_theme_size (GTK_WIDGET (button), g_value_get_flags (value));
+ hildon_gtk_widget_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));
#ifndef __HILDON_BUTTON_H__
#define __HILDON_BUTTON_H__
-#include <gtk/gtk.h>
-#include "hildon-helper.h"
+#include "hildon-gtk.h"
G_BEGIN_DECLS
--- /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.
+ *
+ */
+
+/**
+ * SECTION:hildon-gtk
+ * @short_description: Additional functions for Gtk widgets
+ *
+ * Hildon provides some functions to extend the functionality of
+ * existing Gtk widgets. This also includes convenience functions to
+ * easily perform frequent tasks.
+ */
+
+#include "hildon-gtk.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)
+
+/**
+ * hildon_gtk_widget_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_gtk_widget_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);
+}
+
+/**
+ * hildon_gtk_button_new:
+ * @size: Flags indicating the size of the new button
+ *
+ * This is a convenience function to create a #GtkButton setting its
+ * size to one of the pre-defined Hildon sizes.
+ *
+ * Return value: A newly created #GtkButton widget.
+ **/
+GtkWidget *
+hildon_gtk_button_new (HildonSizeType size)
+{
+ GtkWidget *button = gtk_button_new ();
+ hildon_gtk_widget_set_theme_size (button, size);
+ return button;
+}
+
+/**
+ * hildon_gtk_toggle_button_new:
+ * @size: Flags indicating the size of the new button
+ *
+ * This is a convenience function to create a #GtkToggleButton setting
+ * its size to one of the pre-defined Hildon sizes.
+ *
+ * Return value: A newly created #GtkToggleButton widget.
+ **/
+GtkWidget *
+hildon_gtk_toggle_button_new (HildonSizeType size)
+{
+ GtkWidget *button = gtk_toggle_button_new ();
+ hildon_gtk_widget_set_theme_size (button, size);
+ return button;
+}
+
+/**
+ * hildon_gtk_check_button_new:
+ * @size: Flags indicating the size of the new button
+ *
+ * This is a convenience function to create a #GtkCheckButton setting
+ * its size to one of the pre-defined Hildon sizes.
+ *
+ * Return value: A newly created #GtkCheckButton widget.
+ **/
+GtkWidget *
+hildon_gtk_check_button_new (HildonSizeType size)
+{
+ GtkWidget *button = gtk_check_button_new ();
+ hildon_gtk_widget_set_theme_size (button, size);
+ return button;
+}
+
+/**
+ * hildon_gtk_radio_button_new:
+ * @size: Flags indicating the size of the new button
+ * @group: An existing radio button group, or %NULL if you are
+ * creating a new group
+ *
+ * This is a convenience function to create a #GtkRadioButton setting
+ * its size to one of the pre-defined Hildon sizes.
+ *
+ * Return value: A newly created #GtkRadioButton widget.
+ **/
+GtkWidget *
+hildon_gtk_radio_button_new (HildonSizeType size,
+ GSList *group)
+{
+ GtkWidget *button = gtk_radio_button_new (group);
+ hildon_gtk_widget_set_theme_size (button, size);
+ return button;
+}
+
+/**
+ * hildon_gtk_radio_button_new_from_widget:
+ * @size: Flags indicating the size of the new button
+ * @radio_group_member: widget to get radio group from or %NULL
+ *
+ * This is a convenience function to create a #GtkRadioButton setting
+ * its size to one of the pre-defined Hildon sizes.
+ *
+ * Return value: A newly created #GtkRadioButton widget.
+ **/
+GtkWidget *
+hildon_gtk_radio_button_new_from_widget (HildonSizeType size,
+ GtkRadioButton *radio_group_member)
+{
+ GtkWidget *button = gtk_radio_button_new_from_widget (radio_group_member);
+ hildon_gtk_widget_set_theme_size (button, size);
+ return button;
+}
+
+/**
+ * hildon_gtk_tree_view_new:
+ * @mode: the Hildon UI mode
+ *
+ * Creates a new #GtkTreeView widget with the Hildon UI mode set to
+ * @mode
+ *
+ * Return value: A newly created #GtkTreeView widget.
+ **/
+GtkWidget *
+hildon_gtk_tree_view_new (HildonUIMode mode)
+{
+ return g_object_new (GTK_TYPE_TREE_VIEW, "hildon-ui-mode", mode, NULL);
+}
+
+/**
+ * hildon_gtk_tree_view_new_with_model:
+ * @mode: the Hildon UI mode
+ * @model: the model.
+ *
+ * Creates a new #GtkTreeView widget with the Hildon UI mode set to
+ * @mode and the model initialized to @model.
+ *
+ * Return value: A newly created #GtkTreeView widget.
+ **/
+GtkWidget *
+hildon_gtk_tree_view_new_with_model (HildonUIMode mode,
+ GtkTreeModel *model)
+{
+ return g_object_new (GTK_TYPE_TREE_VIEW, "hildon-ui-mode", mode, "model", model, NULL);
+}
+
+/**
+ * hildon_gtk_icon_view_new:
+ * @mode: the Hildon UI mode
+ *
+ * Creates a new #GtkIconView widget with the Hildon UI mode set to
+ * @mode
+ *
+ * Return value: A newly created #GtkIconView widget
+ **/
+GtkWidget *
+hildon_gtk_icon_view_new (HildonUIMode mode)
+{
+ return g_object_new (GTK_TYPE_ICON_VIEW, "hildon-ui-mode", mode, NULL);
+}
+
+/**
+ * hildon_gtk_icon_view_new_with_model:
+ * @mode: the Hildon UI mode
+ * @model: The model.
+ *
+ * Creates a new #GtkIconView widget with the Hildon UI mode set to
+ * @mode and the model intitialized to @model.
+ *
+ * Return value: A newly created #GtkIconView widget.
+ **/
+GtkWidget *
+hildon_gtk_icon_view_new_with_model (HildonUIMode mode,
+ GtkTreeModel *model)
+{
+ return g_object_new (GTK_TYPE_ICON_VIEW, "hildon-ui-mode", mode, "model", model, NULL);
+}
--- /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_GTK_H__
+#define __HILDON_GTK_H__
+
+#include <gtk/gtk.h>
+
+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;
+
+void
+hildon_gtk_widget_set_theme_size (GtkWidget *widget,
+ HildonSizeType size);
+
+GtkWidget *
+hildon_gtk_button_new (HildonSizeType size);
+
+GtkWidget *
+hildon_gtk_toggle_button_new (HildonSizeType size);
+
+GtkWidget *
+hildon_gtk_check_button_new (HildonSizeType size);
+
+GtkWidget *
+hildon_gtk_radio_button_new (HildonSizeType size,
+ GSList *group);
+
+GtkWidget *
+hildon_gtk_radio_button_new_from_widget (HildonSizeType size,
+ GtkRadioButton *radio_group_member);
+
+GtkWidget *
+hildon_gtk_tree_view_new (HildonUIMode mode);
+
+GtkWidget *
+hildon_gtk_tree_view_new_with_model (HildonUIMode mode,
+ GtkTreeModel *model);
+
+GtkWidget *
+hildon_gtk_icon_view_new (HildonUIMode mode);
+
+GtkWidget *
+hildon_gtk_icon_view_new_with_model (HildonUIMode mode,
+ GtkTreeModel *model);
+
+G_END_DECLS
+
+#endif /* __HILDON_GTK_H__ */
#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__ */
#include "hildon-pannable-area.h"
#include "hildon-app-menu.h"
#include "hildon-button.h"
-#include "hildon-button-helpers.h"
+#include "hildon-gtk.h"
#include "hildon-dialog.h"
#endif