[libvtemm] Added Padding class.



commit f35390e9284aa856ce3065cc173197364de0724d
Author: Krzesimir Nowak <krnowak svn gnome org>
Date:   Wed May 13 23:19:30 2009 +0200

    Added Padding class.
    
    * src/libvtemm.h: Added padding.h inclusion.
    * src/libvtemm.h: Added padding.h to sources.
    * src/libvtemm/g/libvte_docs_override.xml: Overriden
    vte_terminal_get_padding docs, since prototype differs a bit
    from original.
    * src/libvtemm/g/terminal.ccg:
    * src/libvtemm/g/terminal.hg: Wrapped vte_terminal_get_padding
    by hand.
    * src/libvtemm/padding.cc:
    * src/libvtemm/padding.h: New files.
---
 src/libvtemm.h                          |    1 +
 src/libvtemm/Makefile.am                |    4 +-
 src/libvtemm/g/libvte_docs_override.xml |   22 +++++++++++
 src/libvtemm/g/terminal.ccg             |    8 ++++
 src/libvtemm/g/terminal.hg              |    7 +++-
 src/libvtemm/padding.cc                 |   52 +++++++++++++++++++++++++++
 src/libvtemm/padding.h                  |   59 +++++++++++++++++++++++++++++++
 7 files changed, 149 insertions(+), 4 deletions(-)

diff --git a/src/libvtemm.h b/src/libvtemm.h
index 121a5c5..7338472 100644
--- a/src/libvtemm.h
+++ b/src/libvtemm.h
@@ -25,6 +25,7 @@
 #include <libvtemm/charattributes.h>
 #include <libvtemm/cursorposition.h>
 #include <libvtemm/init.h>
+#include <libvtemm/padding.h>
 #include <libvtemm/pty.h>
 //#include <libvtemm/reaper.h>
 #include <libvtemm/terminal.h>
diff --git a/src/libvtemm/Makefile.am b/src/libvtemm/Makefile.am
index 9a0489e..45ac1a8 100644
--- a/src/libvtemm/Makefile.am
+++ b/src/libvtemm/Makefile.am
@@ -3,8 +3,8 @@
 
 SUBDIRS = g private
 
-files_extra_h = cursorposition.h init.h pty.h textandcharattrs.h wrap_init.h
-files_extra_cc = cursorposition.cc init.cc pty.cc textandcharattrs.cc
+files_extra_h = cursorposition.h init.h padding.h pty.h textandcharattrs.h wrap_init.h
+files_extra_cc = cursorposition.cc init.cc padding.cc pty.cc textandcharattrs.cc
 
 include $(top_srcdir)/build_shared/Makefile_shared.am_fragment
 #defined:
diff --git a/src/libvtemm/g/libvte_docs_override.xml b/src/libvtemm/g/libvte_docs_override.xml
index 93f9cf7..b51ed93 100644
--- a/src/libvtemm/g/libvte_docs_override.xml
+++ b/src/libvtemm/g/libvte_docs_override.xml
@@ -339,4 +339,26 @@ coordinate is absolute.
 <return> #Gnome::Vte::CursorPosition instance holding both coordinates</return>
 </function>
 
+<function name="vte_terminal_get_padding">
+<description>
+Determines the amount of additional space the widget is using to pad the
+edges of its visible area. This is necessary for cases where characters in
+the selected font don't themselves include a padding area and the text
+itself would otherwise be contiguous with the window border. Applications
+which use the widget's row count, column count, char height, and
+char width fields to set geometry hints using
+#Gtk::Window::set_geometry_hints() will need to add this value to the base
+size. The values returned in #Gnome::Vte::Padding are the total padding
+used in each direction, and do not need to be doubled.
+
+
+</description>
+<parameters>
+<parameter name="terminal">
+<parameter_description> a #VteTerminal
+</parameter_description>
+</parameters>
+<return>#Gnome::Vte::Padding instance holding both paddings</return>
+</function>
+
 </root>
diff --git a/src/libvtemm/g/terminal.ccg b/src/libvtemm/g/terminal.ccg
index 01b7660..708ec8b 100644
--- a/src/libvtemm/g/terminal.ccg
+++ b/src/libvtemm/g/terminal.ccg
@@ -106,6 +106,14 @@ Terminal::match_check(long column, long row, int& tag)
   return text;
 }
 
+Padding
+Terminal::get_padding() const
+{
+  int xpad(0), ypad(0);
+  vte_terminal_get_padding(const_cast<VteTerminal*>(gobj()), &xpad, &ypad);
+  return Padding(xpad, ypad);
+}
+
 void
 Terminal::set_colors(const Gdk::Color& foreground, const Gdk::Color& background, const Gdk::ArrayHandle_Color& palette)
 {
diff --git a/src/libvtemm/g/terminal.hg b/src/libvtemm/g/terminal.hg
index 30cedd0..0804916 100644
--- a/src/libvtemm/g/terminal.hg
+++ b/src/libvtemm/g/terminal.hg
@@ -27,6 +27,7 @@ _PINCLUDE(gtkmm/private/widget_p.h)
 #include <glibmm.h>
 #include <gtkmm.h>
 #include <libvtemm/cursorposition.h>
+#include <libvtemm/padding.h>
 #include <libvtemm/textandcharattrs.h>
 #include <pangomm.h>
 #include <sigc++/sigc++.h>
@@ -51,7 +52,8 @@ class Terminal : public Gtk::Widget
   _CLASS_GTKOBJECT(Terminal, VteTerminal, VTE_TERMINAL, Gtk::Widget, GtkWidget)
   _IGNORE(vte_terminal_feed, vte_terminal_feed_child, vte_terminal_feed_child_binary,
           vte_terminal_set_colors, vte_terminal_get_text, vte_terminal_get_text_include_trailing_spaces,
-          vte_terminal_get_text_range, vte_terminal_get_cursor_position, vte_terminal_match_check)
+          vte_terminal_get_text_range, vte_terminal_get_cursor_position, vte_terminal_match_check,
+          vte_terminal_get_padding)
   _IGNORE(vte_terminal_set_cursor_blinks, vte_terminal_set_font_full, vte_terminal_get_using_xft,
           vte_terminal_set_font_from_string_full, vte_terminal_match_add, vte_terminal_get_char_ascent,
           vte_terminal_get_char_descent)
@@ -172,7 +174,8 @@ public:
 
   _WRAP_METHOD(const Glib::ustring get_status_line() const, vte_terminal_get_status_line)
 
-  _WRAP_METHOD(void get_padding(int& xpad, int& ypad) const, vte_terminal_get_padding)
+  _WRAP_METHOD_DOCS_ONLY(vte_terminal_get_padding)
+  Padding get_padding() const;
 
   _WRAP_METHOD(void set_pty(int pty_master), vte_terminal_set_pty)
   _WRAP_METHOD(int get_pty() const, vte_terminal_get_pty)
diff --git a/src/libvtemm/padding.cc b/src/libvtemm/padding.cc
new file mode 100644
index 0000000..0afaf38
--- /dev/null
+++ b/src/libvtemm/padding.cc
@@ -0,0 +1,52 @@
+/* padding.cc
+ *
+ * Copyright (C) 2008, 2009 libvtemm Development Team
+ *
+ * This file is part of libvtemm.
+ *
+ * libvtemm 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, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libvtemm 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.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with libvtemm.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libvtemm/padding.h>
+
+namespace Gnome
+{
+
+namespace Vte
+{
+
+Padding::Padding(int x_pad, int y_pad)
+:
+  m_x_pad(x_pad),
+  m_y_pad(y_pad)
+{
+}
+
+Padding::~Padding()
+{
+}
+
+int Padding::get_x_pad() const
+{
+  return m_x_pad;
+}
+
+int Padding::get_y_pad() const
+{
+  return m_y_pad;
+}
+
+} // namespace Vte
+
+} // namespace Gnome
diff --git a/src/libvtemm/padding.h b/src/libvtemm/padding.h
new file mode 100644
index 0000000..db4afa7
--- /dev/null
+++ b/src/libvtemm/padding.h
@@ -0,0 +1,59 @@
+/* padding.h
+ *
+ * Copyright (C) 2008, 2009 libvtemm Development Team
+ *
+ * This file is part of libvtemm.
+ *
+ * libvtemm 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, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libvtemm 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.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with libvtemm.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _LIBVTEMM_PADDING_H_
+#define _LIBVTEMM_PADDING_H_
+
+namespace Gnome
+{
+
+namespace Vte
+{
+/** Padding - simple struct holding padding.
+ */
+class Padding
+{
+public:
+/** The only way to fill #Gnome::Vte::Padding class.
+ * @param x_pad Left/right-edge padding.
+ * @param y_pad Top/botton-edge padding.
+ */
+  Padding(int x_pad, int y_pad);
+  virtual ~Padding();
+
+/** Gets left/right-edge padding.
+ * @return Left/right-edge padding.
+ */
+  int get_x_pad() const;
+
+/** Gets top/bottom-edge padding.
+ * @return Top/bottom-edge padding.
+ */
+  int get_y_pad() const;
+private:
+  long m_x_pad;
+  long m_y_pad;
+};
+
+} // namespace Vte
+
+} // namespace Gnome
+
+#endif // _LIBVTEMM_PADDING_H_



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]