Blob Blame History Raw
/* tabarray.h
 *
 * Copyright (C) 1998-1999 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <pangomm/attrlist.h>
#include <pango/pango-tabs.h>
#include <pango/pango-break.h> /* For PangoLogAttrs */
#include <utility>

_DEFS(pangomm,pango)

namespace Pango
{

_CC_INCLUDE(pango/pango-enum-types.h)
_WRAP_ENUM(TabAlign, PangoTabAlign)

/** A Pango::TabArray contains an array of tab stops.
 * Each tab stop has an alignment and a position.
 */
class TabArray
{
  _CLASS_BOXEDTYPE(TabArray, PangoTabArray, NONE, pango_tab_array_copy, pango_tab_array_free)
  _IGNORE(pango_tab_array_free, pango_tab_array_copy, pango_tab_array_get_tab, pango_tab_array_get_tabs, pango_tab_array_new_with_positions)
public:
  explicit TabArray(int initial_size, bool positions_in_pixels = true);

  _WRAP_METHOD(int get_size() const, pango_tab_array_get_size)
  _WRAP_METHOD(void resize(int new_size), pango_tab_array_resize)
  _WRAP_METHOD(void set_tab(int tab_index, TabAlign alignment, int location), pango_tab_array_set_tab)

  /** Gets the alignment and position of a tab stop.
   * @return An std::pair<TabAlign, int>. The first element represents the tab stop alignment, the second one is the tab position.
   */
  std::pair<TabAlign,int> get_tab(int tab_index) const;

  /** Gets an array of std::pairs containing the tab stop alignments and tab positions.
   * @return An array of std::pair<TabAlign, int>. The first element in each pair represents the tab stop alignment, the second one is the tab position.
   */
  Glib::ArrayHandle< std::pair<TabAlign,int> > get_tabs() const;

  _WRAP_METHOD(bool get_positions_in_pixels() const, pango_tab_array_get_positions_in_pixels)
};

} //namespace Pango