~ubuntu-branches/ubuntu/precise/gtkmm3.0/precise

« back to all changes in this revision

Viewing changes to gdk/src/types.ccg

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-17 00:12:44 UTC
  • Revision ID: james.westby@ubuntu.com-20110617001244-9hl5an15hiaaahi6
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
/* $Id: types.ccg,v 1.3 2004/02/10 17:29:54 mxpxpod Exp $ */
 
3
 
 
4
/* Copyright 1998-2002 The gtkmm Development Team
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2.1 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the Free
 
18
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 */
 
20
 
 
21
namespace Gdk
 
22
{
 
23
 
 
24
Point::Point()
 
25
{
 
26
  gobject_.x = 0;
 
27
  gobject_.y = 0;
 
28
}
 
29
 
 
30
Point::Point(int x, int y)
 
31
{
 
32
  gobject_.x = x;
 
33
  gobject_.y = y;
 
34
}
 
35
 
 
36
bool Point::equal(const Gdk::Point& rhs) const
 
37
{
 
38
  return (gobject_.x == rhs.gobject_.x) && (gobject_.y == rhs.gobject_.y);
 
39
}
 
40
 
 
41
// static
 
42
GdkAtom AtomStringTraits::to_c_type(const std::string& atom_name)
 
43
{
 
44
  return gdk_atom_intern(atom_name.c_str(), 0);
 
45
}
 
46
 
 
47
// static
 
48
std::string AtomStringTraits::to_cpp_type(GdkAtom atom)
 
49
{
 
50
  if(char *const atom_name = gdk_atom_name(atom))
 
51
    return std::string(Glib::ScopedPtr<char>(atom_name).get());
 
52
  else
 
53
    return std::string();
 
54
}
 
55
 
 
56
// static
 
57
GdkAtom AtomUstringTraits::to_c_type(const Glib::ustring& atom_name)
 
58
{
 
59
  return gdk_atom_intern(atom_name.c_str(), 0);
 
60
}
 
61
 
 
62
// static
 
63
Glib::ustring AtomUstringTraits::to_cpp_type(GdkAtom atom)
 
64
{
 
65
  if(char *const atom_name = gdk_atom_name(atom))
 
66
    return Glib::ustring(Glib::ScopedPtr<char>(atom_name).get());
 
67
  else
 
68
    return Glib::ustring();
 
69
}
 
70
 
 
71
} // namespace Gdk
 
72
 
 
73
 
 
74
namespace Glib
 
75
{
 
76
 
 
77
Gdk::Point& wrap(GdkPoint* object)
 
78
{
 
79
  return *reinterpret_cast<Gdk::Point*>(object);
 
80
}
 
81
 
 
82
const Gdk::Point& wrap(const GdkPoint* object)
 
83
{
 
84
  return *reinterpret_cast<const Gdk::Point*>(object);
 
85
}
 
86
 
 
87
} // namespace Glib
 
88