[gtkmm] Add LevelBar.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Add LevelBar.
- Date: Thu, 30 Aug 2012 22:13:40 +0000 (UTC)
commit 4d2158e4a0ca5decf58ae8d2aedb4bd3e8ceb0a6
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Aug 30 23:59:11 2012 +0200
Add LevelBar.
* gtk/src/levelbar.[hg|ccg]: New files to wrap GtkLevelBar.
* tools/m4/convert_gtk.m4: Add a necessary conversion.
* gtk/gtkmm.h:
* gtk/src/filelist.am: Mention it in these files.
ChangeLog | 9 +++++
gtk/gtkmm.h | 1 +
gtk/src/filelist.am | 1 +
gtk/src/levelbar.ccg | 23 +++++++++++++
gtk/src/levelbar.hg | 84 +++++++++++++++++++++++++++++++++++++++++++++++
tools/m4/convert_gtk.m4 | 1 +
6 files changed, 119 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d4acb0f..60fd6ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2012-08-30 Murray Cumming <murrayc murrayc com>
+ Add LevelBar.
+
+ * gtk/src/levelbar.[hg|ccg]: New files to wrap GtkLevelBar.
+ * tools/m4/convert_gtk.m4: Add a necessary conversion.
+ * gtk/gtkmm.h:
+ * gtk/src/filelist.am: Mention it in these files.
+
+2012-08-30 Murray Cumming <murrayc murrayc com>
+
CellRendererText: Add the placeholder_text property.
* gtk/src/cellrenderertext.hg: Wrap the new placeholder-text
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 3927f8a..9e183c8 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -174,6 +174,7 @@ extern const int gtkmm_micro_version;
#include <gtkmm/invisible.h>
#include <gtkmm/label.h>
#include <gtkmm/layout.h>
+#include <gtkmm/levelbar.h>
#include <gtkmm/liststore.h>
#include <gtkmm/listviewtext.h>
#include <gtkmm/linkbutton.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 690a0a9..69ab1e9 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -98,6 +98,7 @@ gtkmm_files_any_hg = \
invisible.hg \
label.hg \
layout.hg \
+ levelbar.hg \
linkbutton.hg \
liststore.hg \
main.hg \
diff --git a/gtk/src/levelbar.ccg b/gtk/src/levelbar.ccg
new file mode 100644
index 0000000..0d7d964
--- /dev/null
+++ b/gtk/src/levelbar.ccg
@@ -0,0 +1,23 @@
+/** Copyright (C) 2012 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <gtk/gtk.h>
+
+namespace Gtk
+{
+
+} //namespace Gtk
diff --git a/gtk/src/levelbar.hg b/gtk/src/levelbar.hg
new file mode 100644
index 0000000..efe5af4
--- /dev/null
+++ b/gtk/src/levelbar.hg
@@ -0,0 +1,84 @@
+/**
+ * Copyright (C) 2012 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <gtkmm/widget.h>
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/widget_p.h)
+
+
+namespace Gtk
+{
+
+_WRAP_ENUM(LevelBarMode, GtkLevelBarMode)
+
+/** A bar that can used as a level indicator
+ *
+ * Typical use cases are displaying the strength
+ * of a password, or showing the charge level of a battery.
+ *
+ * Use set_value() to set the current value, and
+ * add_offset_value() to set the value offsets at which
+ * the bar will be considered in a different state. There will be two offsets
+ * by default on the level bar: Gtk::LEVEL_BAR_OFFSET_LOW and
+ * Gtk::LEVEL_BAR_OFFSET_HIGH, with values 0.25 and 0.75 respectively.
+ *
+ * The default interval of values is between zero and one, but it's possible to
+ * modify the interval using set_min_value() and
+ * set_max_value(). The value will be always drawn in proportion to
+ * the admissible interval, i.e. a value of 15 with a specified interval between
+ * 10 and 20 is equivalent to a value of 0.5 with an interval between 0 and 1.
+ * When Gtk::LEVEL_BAR_MODE_DISCRETE is used, the bar level is rendered
+ * as a finite and number of separated blocks instead of a single one. The number
+ * of blocks that will be rendered is equal to the number of units specified by
+ * the admissible interval.
+ * For instance, to build a bar rendered with five blocks, it's sufficient to
+ * set the minimum value to 0 and the maximum value to 5 after changing the indicator
+ * mode to discrete.
+ *
+ * @ingroup Widgets
+ * @newin{3,6}
+ */
+class LevelBar : public Widget
+{
+ _CLASS_GTKOBJECT(LevelBar, GtkLevelBar, GTK_LEVEL_BAR, Gtk::Widget, GtkWidget)
+public:
+
+ _CTOR_DEFAULT()
+ _IGNORE(gtk_level_bar_new)
+
+
+ _WRAP_METHOD(void set_mode(LevelBarMode mode), gtk_level_bar_set_mode)
+ _WRAP_METHOD(LevelBarMode get_mode() const, gtk_level_bar_get_mode)
+
+ _WRAP_METHOD(void set_value(double value), gtk_level_bar_set_value)
+ _WRAP_METHOD(double get_value() const, gtk_level_bar_get_value)
+
+ _WRAP_METHOD(void set_min_value(double value), gtk_level_bar_set_min_value)
+ _WRAP_METHOD(double get_min_value() const, gtk_level_bar_get_min_value)
+
+ _WRAP_METHOD(void set_max_value(double value), gtk_level_bar_set_max_value)
+ _WRAP_METHOD(double get_max_value() const, gtk_level_bar_get_max_value)
+
+ _WRAP_METHOD(void add_offset_value(const Glib::ustring& name, double value), gtk_level_bar_add_offset_value)
+ _WRAP_METHOD(void remove_offset_value(const Glib::ustring& name), gtk_level_bar_remove_offset_value)
+ _WRAP_METHOD(bool get_offset_value(const Glib::ustring& name, double& value) const, gtk_level_bar_get_offset_value)
+};
+
+
+} // namespace Gtk
+
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index afb36de..c5ece6f 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -158,6 +158,7 @@ _CONV_ENUM(Gtk,StateFlags)
_CONV_ENUM(Gtk,ApplicationInhibitFlags)
_CONV_ENUM(Gtk,InputPurpose)
_CONV_ENUM(Gtk,InputHints)
+_CONV_ENUM(Gtk,LevelBarMode)
_CONVERSION(`GtkIconSize',`IconSize',`IconSize(static_cast<int>($3))')
_CONVERSION(`GtkIconSize',`Gtk::IconSize',`Gtk::IconSize(static_cast<int>($3))')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]