• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kblackbox

  • sources
  • kde-4.14
  • kdegames
  • kblackbox
kbbgraphicsitemonbox.h
Go to the documentation of this file.
1 //
2 // KBlackBox
3 //
4 // A simple game inspired by an emacs module
5 //
6 /***************************************************************************
7  * Copyright (c) 1999-2000, Robert Cimrman *
8  * cimrman3@students.zcu.cz *
9  * *
10  * Copyright (c) 2007, Nicolas Roffet *
11  * nicolas-kde@roffet.com *
12  * *
13  * *
14  * This program is free software; you can redistribute it and/or modify *
15  * it under the terms of the GNU General Public License as published by *
16  * the Free Software Foundation; either version 2 of the License, or *
17  * (at your option) any later version. *
18  * *
19  * This program is distributed in the hope that it will be useful, *
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22  * GNU General Public License for more details. *
23  * *
24  * You should have received a copy of the GNU General Public License *
25  * along with this program; if not, write to the *
26  * Free Software Foundation, Inc., *
27  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
28  ***************************************************************************/
29 
30 #ifndef KBBGRAPHICSITEMONBOX_H
31 #define KBBGRAPHICSITEMONBOX_H
32 
33 
34 
35 class QGraphicsScene;
36 
37 
38 #include "kbbgraphicsitem.h"
39 #include "kbbitemwithposition.h"
40 class KBBScalableGraphicWidget;
41 class KBBThemeManager;
42 
43 
44 
50 class KBBGraphicsItemOnBox : public KBBGraphicsItem, public KBBItemWithPosition
51 {
52  public:
56  static const int NO_POSITION = -1;
57 
58 
59  KBBGraphicsItemOnBox(KBBScalableGraphicWidget::itemType itemType, KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager, const int boxPosition, const int columns, const int rows);
60 
61  int position();
62 
63 
64  protected:
65  virtual void removeInteractionInfos();
66 
67  KBBScalableGraphicWidget* m_widget;
68  int m_columns;
69  int m_rows;
70 
71 
72  private:
73  int boxPosition(qreal x, qreal y);
74  bool isMovable();
75  void mousePressEvent (QGraphicsSceneMouseEvent* event);
76  void mouseReleaseEvent (QGraphicsSceneMouseEvent* event);
77  void setBoxPosition(int boxPosition);
78 
79  int m_boxPosition;
80  int m_boxOutsidePosition;
81  qreal m_dragXPos;
82  qreal m_dragYPos;
83  qreal m_dragX;
84  qreal m_dragY;
85  KBBScalableGraphicWidget::itemType m_itemType;
86 };
87 
88 #endif // KBBGRAPHICSITEMONBOX_H
QGraphicsItem::x
qreal x() const
QGraphicsItem::y
qreal y() const
KBBGraphicsItemOnBox
Item on the box on the scalable graphic widget.
Definition: kbbgraphicsitemonbox.h:50
QGraphicsScene
kbbgraphicsitem.h
KBBGraphicsItem
Graphic item of the scalable graphic widget.
Definition: kbbgraphicsitem.h:44
KBBScalableGraphicWidget
Scalable graphic central widget for KBlackBox.
Definition: kbbscalablegraphicwidget.h:62
QObject::event
virtual bool event(QEvent *e)
KBBGraphicsItemOnBox::m_widget
KBBScalableGraphicWidget * m_widget
Definition: kbbgraphicsitemonbox.h:67
KBBItemWithPosition
Item with position.
Definition: kbbitemwithposition.h:37
KBBGraphicsItemOnBox::removeInteractionInfos
virtual void removeInteractionInfos()
Definition: kbbgraphicsitemonbox.cpp:82
KBBGraphicsItemOnBox::NO_POSITION
static const int NO_POSITION
Invalid box position.
Definition: kbbgraphicsitemonbox.h:56
KBBGraphicsItemOnBox::position
int position()
Definition: kbbgraphicsitemonbox.cpp:71
QGraphicsSceneMouseEvent
KBBGraphicsItemOnBox::KBBGraphicsItemOnBox
KBBGraphicsItemOnBox(KBBScalableGraphicWidget::itemType itemType, KBBScalableGraphicWidget *parent, KBBThemeManager *themeManager, const int boxPosition, const int columns, const int rows)
Definition: kbbgraphicsitemonbox.cpp:50
kbbitemwithposition.h
KBBGraphicsItemOnBox::m_columns
int m_columns
Definition: kbbgraphicsitemonbox.h:68
KBBThemeManager
Theme manager of the scalable graphic widget.
Definition: kbbthememanager.h:51
QObject::parent
QObject * parent() const
KBBGraphicsItemOnBox::m_rows
int m_rows
Definition: kbbgraphicsitemonbox.h:69
KBBScalableGraphicWidget::itemType
itemType
Every graphic items.
Definition: kbbscalablegraphicwidget.h:89
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kblackbox

Skip menu "kblackbox"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal