~ubuntu-branches/ubuntu/precise/kalzium/precise

« back to all changes in this revision

Viewing changes to src/psetable/numerationitem.h

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-03 12:28:58 UTC
  • Revision ID: james.westby@ubuntu.com-20110703122858-q1yyxncs89e4w0hs
Tags: upstream-4.6.90+repack
Import upstream version 4.6.90+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
 NumerationItem - Numeration Item, part of the Periodic Table Graphics View
 
3
 for Kalzium
 
4
 
 
5
 Copyright (C) 2007-2009 by Marcus D. Hanwell
 
6
 Copyright (C) 2010      by Etienne Rebetez
 
7
 
 
8
 This file is part of the Avogadro molecular editor project.
 
9
 For more information, see <http://avogadro.openmolecules.net/>
 
10
 
 
11
 Kalzium is free software; you can redistribute it and/or modify
 
12
 it under the terms of the GNU Lesser General Public License as published by
 
13
 the Free Software Foundation; either version 2.1 of the License, or
 
14
 (at your option) any later version.
 
15
 
 
16
 Avogadro is distributed in the hope that it will be useful,
 
17
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 GNU General Public License for more details.
 
20
 
 
21
 You should have received a copy of the GNU General Public License
 
22
 along with this program; if not, write to the Free Software
 
23
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
24
 02110-1301, USA.
 
25
 **********************************************************************/
 
26
 
 
27
#ifndef NUMERATIONTITEM_P_H
 
28
#define NUMERATIONTITEM_P_H
 
29
 
 
30
#include <QGraphicsItem>
 
31
#include "kalziumdataobject.h"
 
32
 
 
33
#include <chemicaldataobject.h>
 
34
 
 
35
  /**
 
36
   * @class NumerationItem
 
37
   * @author Marcus D. Hanwell
 
38
   * @author Etienne Rebetez
 
39
   * @brief An Numeration item, intended to display a id of the numeration row.
 
40
   *
 
41
   */
 
42
  class NumerationItem : public QGraphicsObject
 
43
  {
 
44
    Q_OBJECT
 
45
 
 
46
  public:
 
47
    /**
 
48
     * Constructor. Should be called with the element number for this item. The
 
49
     * constructor uses setData to set the element number using the key 0. This
 
50
     * is then used by PeriodicTable to figure out which element was clicked on.
 
51
     */
 
52
    NumerationItem(int xPosition = 0);
 
53
 
 
54
    /**
 
55
     * Destructor.
 
56
     */
 
57
    ~NumerationItem();
 
58
 
 
59
    /**
 
60
     * @return the bounding rectangle of the element item.
 
61
     */
 
62
    QRectF boundingRect() const;
 
63
 
 
64
    /**
 
65
     * @return the painter path which is also a rectangle in this case.
 
66
     */
 
67
    QPainterPath shape() const;
 
68
 
 
69
    /**
 
70
     * This is where most of the action takes place. The element box is drawn
 
71
     * along with its symbol.
 
72
     */
 
73
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
 
74
               QWidget *widget);
 
75
 
 
76
  public Q_SLOTS:
 
77
    void setNumerationType( int type );
 
78
 
 
79
  private:
 
80
    /**
 
81
     * Width and height of the elements.
 
82
     */
 
83
    int m_width, m_height;
 
84
    /**
 
85
     * The row Position of the Numeration item
 
86
     */
 
87
    int m_xPosition;
 
88
 
 
89
    /**
 
90
     * The numeration symbol.
 
91
     */
 
92
    QString m_numeration;
 
93
 
 
94
    /**
 
95
     * The color of the element.
 
96
     */
 
97
    QColor m_color;
 
98
 
 
99
  };
 
100
 
 
101
 
 
102
#endif // NUMERATIONTITEM_P_H