summaryrefslogtreecommitdiff
path: root/libs/gtkmm2/pango/pangomm/color.h
blob: 07ce119896bf2edb21fc163626904bde42f94fa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _PANGOMM_COLOR_H
#define _PANGOMM_COLOR_H

#include <glibmm.h>

/* Copyright (C) 2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <pango/pango-attributes.h>


namespace Pango
{

/** A Pango::Color is used to represent a color in an uncalibrated RGB colorspace.
 */
class Color
{
  public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef Color CppObjectType;
  typedef PangoColor BaseObjectType;

  static GType get_type() G_GNUC_CONST;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

  Color();

  explicit Color(const PangoColor* gobject); // always takes a copy

  ///Provides access to the underlying C instance.
  PangoColor*       gobj()       { return &gobject_; }

  ///Provides access to the underlying C instance.
  const PangoColor* gobj() const { return &gobject_; }

protected:
  PangoColor gobject_;

private:
  
  
public:

  /// Tests whether the Color is valid.
  operator bool();
  
  /** Gets the red component of the color.
   * @return The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  guint16 get_red() const;

  /** Gets the green component of the color.
   * @return The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  guint16 get_green() const;

  /** Gets the blue component of the color.
   * @return The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  guint16 get_blue() const;

  /** Sets the red component of the color.
   * @param value The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  void set_red(const guint16& value);

  /** Sets the green component of the color.
   * @param value The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  void set_green(const guint16& value);

  /** Sets the blue component of the color.
   * @param value The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  void set_blue(const guint16& value);

  
  /** Fill in the fields of a color from a string specification. The
   * string can either one of a large set of standard names. (Taken
   * from the X11 &lt;filename&gt;rgb.txt&lt;/filename&gt; file), or it can be a hex value in the
   * form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb' where
   * 'r', 'g' and 'b' are hex digits of the red, green, and blue
   * components of the color, respectively. (White in the four
   * forms is '#fff' '#ffffff' '#fffffffff' and '#ffffffffffff')
   * @param spec A string specifying the new color.
   * @return <tt>true</tt> if parsing of the specifier succeeded,
   * otherwise false.
   */
  bool parse(const Glib::ustring& spec);


};

} /* namespace Pango */


namespace Glib
{

/** @relates Pango::Color
 * @param object The C instance
 * @result A C++ instance that wraps this C instance.
 */
Pango::Color& wrap(PangoColor* object);

/** @relates Pango::Color
 * @param object The C instance
 * @result A C++ instance that wraps this C instance.
 */
const Pango::Color& wrap(const PangoColor* object);

#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <>
class Value<Pango::Color> : public Glib::Value_Boxed<Pango::Color>
{};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

} // namespace Glib

#endif /* _PANGOMM_COLOR_H */