~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/include/wx/legend.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////////
 
2
// Name:        legend.h
 
3
// Purpose:     wxChart
 
4
// Author:      Paolo Gava
 
5
// Modified by:
 
6
// Created:
 
7
// Copyright:   (C) 2006, Paolo Gava
 
8
// RCS-ID:      $Id: legend.h 4669 2007-11-24 14:54:50Z killerbot $
 
9
// Licence:     wxWindows licence
 
10
/////////////////////////////////////////////////////////////////////////////
 
11
 
 
12
#if !defined( __LEGEND_H__ )
 
13
#define __LEGEND_H__
 
14
 
 
15
//----------------------------------------------------------------------------
 
16
// Headers
 
17
//----------------------------------------------------------------------------
 
18
 
 
19
// For compilers that support precompilation, includes "wx.h".
 
20
#include <wx/wxprec.h>
 
21
 
 
22
#ifdef __BORLANDC__
 
23
#pragma hdrstop
 
24
#endif
 
25
 
 
26
#ifndef WX_PRECOMP
 
27
    #include <wx/dynarray.h>
 
28
#endif
 
29
 
 
30
#include "wx/charttypes.h"
 
31
 
 
32
//----------------------------------------------------------------------------
 
33
// Conts
 
34
//----------------------------------------------------------------------------
 
35
#define    ARROW_UP     0
 
36
#define    ARROW_DOWN   1
 
37
#define    ROWS_PAGE    3
 
38
#define    ROW_SIZE     20 // pixels
 
39
 
 
40
//----------------------------------------------------------------------------
 
41
// Types
 
42
//----------------------------------------------------------------------------
 
43
 
 
44
// Legend descriptor
 
45
//------------------
 
46
struct DescLegend
 
47
{
 
48
    wxString m_lbl;
 
49
    ChartColor m_col;
 
50
    DescLegend(wxString lbl, ChartColor col) : m_lbl(lbl), m_col(col) {};
 
51
};
 
52
 
 
53
// Arrow Up/Down descriptor
 
54
//-------------------------
 
55
struct ArrowDescriptor
 
56
{
 
57
    int m_x;
 
58
    int m_y;
 
59
    int m_d;
 
60
    bool m_sel;
 
61
    ArrowDescriptor() : m_x(0), m_y(0), m_d(0), m_sel(false) {};
 
62
};
 
63
 
 
64
//----------------------------------------------------------------------------
 
65
// Declare Array/List of Legend Descriptor
 
66
//----------------------------------------------------------------------------
 
67
WX_DECLARE_OBJARRAY(DescLegend, ListLegendDesc);
 
68
 
 
69
//+++-S-cd-------------------------------------------------------------------
 
70
//      NAME:           wxLegend
 
71
//      DESC:
 
72
//      INTERFACE:
 
73
//
 
74
//----------------------------------------------------------------------E-+++
 
75
class WXDLLIMPEXP_CHART wxLegend
 
76
{
 
77
public:
 
78
 
 
79
    // ctor
 
80
    //-----
 
81
    wxLegend();
 
82
        ~wxLegend();
 
83
 
 
84
        // Draw legend area
 
85
        //-----------------
 
86
        void Draw(CHART_HPAINT hp, CHART_HRECT hr);
 
87
 
 
88
    // Redraw arraw whne mouse over
 
89
    //-----------------------------
 
90
    void DrawArrow(CHART_HPAINT hp, int pos, bool over);
 
91
 
 
92
    // Dec/Inc page
 
93
    //-------------
 
94
    void IncPage();
 
95
    void DecPage();
 
96
 
 
97
    // Mouse utilities
 
98
    bool IsInArrowUp(int x, int y);
 
99
    bool IsInArrowDown(int x, int y);
 
100
 
 
101
        // List descriptos utilities
 
102
        //--------------------------
 
103
    void Add(const wxString &lbl, const ChartColor &col);
 
104
        void Clear();
 
105
        int GetCount() const;
 
106
        ChartColor GetColor(int n) const;
 
107
    wxString GetLabel(int n) const;
 
108
 
 
109
private:
 
110
        ListLegendDesc m_lDescs;
 
111
    int m_Page;
 
112
    ArrowDescriptor m_ArrowUp;
 
113
    ArrowDescriptor m_ArrowDown;
 
114
 
 
115
    // Drawing Utilities
 
116
    //------------------
 
117
    void DrawArrow(CHART_HPAINT hp, int x, int y, int size,
 
118
                   int pos, bool over);
 
119
    void WriteLabel(CHART_HPAINT hp, int x, int y, int page);
 
120
 
 
121
    // Get number of pages
 
122
    //--------------------
 
123
    int NumPages() const;
 
124
 
 
125
};
 
126
 
 
127
#endif // __LEGEND_H__