~ubuntu-branches/ubuntu/utopic/pgadmin3/utopic-proposed

« back to all changes in this revision

Viewing changes to pgadmin/ogl/bmpshape.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2011-06-07 23:03:54 UTC
  • mfrom: (1.3.1 upstream) (13 sid)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20110607230354-3td4j9y71u4ahcvj
Tags: 1.14.0~beta1-1
* New upstream development release, adding Build-Depends on
  postgresql-server-dev-all >= 117~.
* Add Build-Depends on quilt, (un)patch to debian/rules and patch for fixing
  the include for kwlist.h in pgadmin/db/keywords.c.
* Add pg_config --includedir-server output to CPPFLAGS.
* Remove unrecognized configure options: --with-wx-config,
  --with-pgsql-include, --enable-gtk2, --enable-unicode.
* Clean up manually the files that are left behind after the broken
  distclean.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////
 
2
//
 
3
// pgAdmin III - PostgreSQL Tools
 
4
//
 
5
// Portions Copyright (C) 1998 - 2011, Julian Smart
 
6
// Portions Copyright (C) 2011, The pgAdmin Development Team
 
7
// This software is released under the PostgreSQL Licence
 
8
//
 
9
// bmpshape.cpp - Bitmap shape class
 
10
//
 
11
//////////////////////////////////////////////////////////////////////////
 
12
 
 
13
#include "pgAdmin3.h"
 
14
 
 
15
#include "ogl/ogl.h"
 
16
 
 
17
/*
 
18
 * Bitmap object
 
19
 *
 
20
 */
 
21
 
 
22
IMPLEMENT_DYNAMIC_CLASS(wxBitmapShape, wxRectangleShape)
 
23
 
 
24
wxBitmapShape::wxBitmapShape(): wxRectangleShape(100.0, 50.0)
 
25
{
 
26
        m_filename = wxEmptyString;
 
27
}
 
28
 
 
29
wxBitmapShape::~wxBitmapShape()
 
30
{
 
31
}
 
32
 
 
33
void wxBitmapShape::OnDraw(wxDC &dc)
 
34
{
 
35
        if (!m_bitmap.Ok())
 
36
                return;
 
37
 
 
38
        double x, y;
 
39
        x = WXROUND(m_xpos - m_bitmap.GetWidth() / 2.0);
 
40
        y = WXROUND(m_ypos - m_bitmap.GetHeight() / 2.0);
 
41
        dc.DrawBitmap(m_bitmap, (int) x, (int) y, true);
 
42
}
 
43
 
 
44
void wxBitmapShape::SetSize(double w, double h, bool WXUNUSED(recursive))
 
45
{
 
46
        if (m_bitmap.Ok())
 
47
        {
 
48
                w = m_bitmap.GetWidth();
 
49
                h = m_bitmap.GetHeight();
 
50
        }
 
51
 
 
52
        SetAttachmentSize(w, h);
 
53
 
 
54
        m_width = w;
 
55
        m_height = h;
 
56
        SetDefaultRegionSize();
 
57
}
 
58
 
 
59
#if wxUSE_PROLOGIO
 
60
void wxBitmapShape::WriteAttributes(wxExpr *clause)
 
61
{
 
62
        // Can't really save the bitmap; so instantiate the bitmap
 
63
        // at a higher level in the application, from a symbol library.
 
64
        wxRectangleShape::WriteAttributes(clause);
 
65
        clause->AddAttributeValueString(_T("filename"), m_filename);
 
66
}
 
67
 
 
68
void wxBitmapShape::ReadAttributes(wxExpr *clause)
 
69
{
 
70
        wxRectangleShape::ReadAttributes(clause);
 
71
        clause->GetAttributeValue(_T("filename"), m_filename);
 
72
}
 
73
#endif
 
74
 
 
75
// Does the copying for this object
 
76
void wxBitmapShape::Copy(wxShape &copy)
 
77
{
 
78
        wxRectangleShape::Copy(copy);
 
79
 
 
80
        wxASSERT( copy.IsKindOf(CLASSINFO(wxBitmapShape)) ) ;
 
81
 
 
82
        wxBitmapShape &bitmapCopy = (wxBitmapShape &) copy;
 
83
 
 
84
        bitmapCopy.m_bitmap = m_bitmap;
 
85
        bitmapCopy.SetFilename(m_filename);
 
86
}
 
87
 
 
88
void wxBitmapShape::SetBitmap(const wxBitmap &bm)
 
89
{
 
90
        m_bitmap = bm;
 
91
        if (m_bitmap.Ok())
 
92
                SetSize(m_bitmap.GetWidth(), m_bitmap.GetHeight());
 
93
}
 
94
 
 
95