~ubuntu-branches/debian/squeeze/pgadmin3/squeeze

« back to all changes in this revision

Viewing changes to src/include/explainCanvas.h

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Porcheron
  • Date: 2008-02-07 00:56:22 UTC
  • mto: (2.1.6 hardy) (6.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080207005622-c2ail8p4d0sk3dnw
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//////////////////////////////////////////////////////////////////////////
2
 
//
3
 
// pgAdmin III - PostgreSQL Tools
4
 
// RCS-ID:      $Id: explainCanvas.h 4874 2006-01-06 17:33:27Z dpage $
5
 
// Copyright (C) 2002 - 2006, The pgAdmin Development Team
6
 
// This software is released under the Artistic Licence
7
 
//
8
 
// explainCanvas.cpp - Explain Canvas
9
 
//
10
 
//////////////////////////////////////////////////////////////////////////
11
 
 
12
 
 
13
 
#include <wx/ogl/ogl.h>
14
 
 
15
 
 
16
 
#if wxUSE_DEPRECATED
17
 
#error wxUSE_DEPRECATED should be 0!
18
 
#endif
19
 
 
20
 
 
21
 
class ExplainShape;
22
 
class ExplainPopup;
23
 
class ExplainText;
24
 
 
25
 
class ExplainCanvas : public wxShapeCanvas
26
 
{
27
 
public:
28
 
    ExplainCanvas(wxWindow *parent);
29
 
    ~ExplainCanvas();
30
 
 
31
 
    void ShowPopup(ExplainShape *s);
32
 
    void SetExplainString(const wxString &str);
33
 
    void Clear();
34
 
 
35
 
private:
36
 
 
37
 
    ExplainShape *rootShape, *lastShape;
38
 
    ExplainPopup *popup;
39
 
};
40
 
 
41
 
 
42
 
class ExplainShape : public wxBitmapShape
43
 
{
44
 
public:
45
 
    ExplainShape(char *bmp[], const wxString &description, long tokenNo=-1, long detailNo=-1);
46
 
    static ExplainShape *Create(long level, ExplainShape *last, const wxString &str); 
47
 
 
48
 
    void SetCondition(const wxString &str) { condition = str; }
49
 
    long GetLevel() { return level; }
50
 
    wxRealPoint GetStartPoint();
51
 
    wxRealPoint GetEndPoint(int kidNo);
52
 
    int GetKidno() { return kidNo; }
53
 
 
54
 
    ExplainShape *GetUpper() { return upperShape; }
55
 
    double GetAverageCost() { return (costHigh - costLow) / 2 + costLow; }
56
 
 
57
 
protected:
58
 
    void OnDraw(wxDC& dc);
59
 
    void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
60
 
 
61
 
    ExplainShape *upperShape;
62
 
 
63
 
    void SetLabel(const wxString &str, int tokenNo=-1, int detailNo=-1);
64
 
 
65
 
    long level;
66
 
    wxString description, detail, condition, label;
67
 
    wxString cost, actual;
68
 
    double costLow, costHigh;
69
 
    long rows, width;
70
 
    int kidCount, kidNo;
71
 
    int totalShapes; // horizontal space usage by shape and its kids
72
 
    int usedShapes;
73
 
 
74
 
    friend class ExplainCanvas;
75
 
    friend class ExplainText;
76
 
};
77
 
 
78
 
 
79
 
class ExplainLine : public wxLineShape
80
 
{
81
 
public:
82
 
    ExplainLine(ExplainShape *from, ExplainShape *to, double weight=0);
83
 
 
84
 
private:
85
 
    int width;
86
 
    void OnDraw(wxDC& dc);
87
 
};
88
 
 
89
 
 
90
 
class ExplainPopup : public wxDialog
91
 
{
92
 
public:
93
 
    ExplainPopup(wxWindow *w);
94
 
    void SetShape(ExplainShape *s);
95
 
    void Popup();
96
 
 
97
 
private:
98
 
    void OnMouseMove(wxMouseEvent &ev);
99
 
 
100
 
    ExplainText *explainText;
101
 
    wxPoint popupPoint;
102
 
    DECLARE_EVENT_TABLE()
103
 
};
104