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

libkdegames

  • sources
  • kde-4.14
  • kdegames
  • libkdegames
kgamepopupitem.h
Go to the documentation of this file.
1 /*******************************************************************
2  Copyright 2007 Dmitry Suzdalev <dimsuz@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ********************************************************************/
18 #ifndef K_GAME_POPUP_ITEM_H
19 #define K_GAME_POPUP_ITEM_H
20 
21 #include <libkdegames_export.h>
22 
23 #include <QtGui/QGraphicsPathItem>
24 #include <QtCore/QObject>
25 
26 class KGamePopupItemPrivate;
27 
45 class KDEGAMES_EXPORT KGamePopupItem : public QObject, public QGraphicsItem
46 {
47  Q_OBJECT
48  Q_INTERFACES(QGraphicsItem)
49 public:
54  enum ReplaceMode { LeavePrevious, ReplacePrevious };
58  enum Sharpness { Square=0, Sharp=2, Soft=5, Softest=10 };
62  enum Position { TopLeft, TopRight, BottomLeft, BottomRight, Center };
66  KGamePopupItem(QGraphicsItem * parent = 0);
70  ~KGamePopupItem();
86  void showMessage( const QString& text, Position pos, ReplaceMode mode = LeavePrevious);
98  void setMessageTimeout( int msec );
102  int messageTimeout() const;
108  void setMessageOpacity( qreal opacity );
112  qreal messageOpacity() const;
116  void setMessageIcon( const QPixmap& pix );
121  void setHideOnMouseClick( bool hide );
125  bool hidesOnMouseClick() const;
129  enum HideType { InstantHide, AnimatedHide };
133  void forceHide(HideType type=AnimatedHide);
139  void setBackgroundBrush( const QBrush& brush );
145  void setTextColor( const QColor& color );
149  virtual QRectF boundingRect() const;
153  virtual void paint( QPainter* p, const QStyleOptionGraphicsItem *option, QWidget* widget );
157  void setSharpness( Sharpness sharpness );
161  Sharpness sharpness() const;
162 Q_SIGNALS:
166  void linkActivated( const QString& link );
170  void linkHovered( const QString& link );
175  void hidden();
176 private Q_SLOTS:
177  void animationFrame(int);
178  void hideMe();
179  void playHideAnimation();
180  void onLinkHovered(const QString&);
181  void onTextItemClicked();
182 private:
183  void setupTimeline();
184  virtual void mousePressEvent( QGraphicsSceneMouseEvent* );
185  virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent* );
186  virtual void hoverEnterEvent( QGraphicsSceneHoverEvent* );
187  virtual void hoverLeaveEvent( QGraphicsSceneHoverEvent* );
188 
189  KGamePopupItemPrivate * const d;
190 };
191 
192 #endif
QGraphicsItem::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
KGamePopupItem::ReplaceMode
ReplaceMode
Possible values for message showing mode in respect to a previous message.
Definition: kgamepopupitem.h:54
QWidget
QGraphicsItem::hoverLeaveEvent
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
QGraphicsItem::hoverEnterEvent
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
QGraphicsItem::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)=0
libkdegames_export.h
KGamePopupItem
QGraphicsItem capable of showing short popup messages which do not interrupt the gameplay.
Definition: kgamepopupitem.h:45
QBrush
QGraphicsItem
KDEGAMES_EXPORT
#define KDEGAMES_EXPORT
Definition: libkdegames_export.h:32
QObject
QGraphicsSceneMouseEvent
QPainter
QGraphicsItem::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
KGamePopupItem::Position
Position
The possible places in the scene where a message can be shown.
Definition: kgamepopupitem.h:62
KGamePopupItem::TopRight
Definition: kgamepopupitem.h:62
QString
QColor
QGraphicsSceneHoverEvent
QPixmap
QGraphicsItem::boundingRect
virtual QRectF boundingRect() const =0
QRectF
QStyleOptionGraphicsItem
KGamePopupItem::Sharpness
Sharpness
Possible values for the popup angles sharpness.
Definition: kgamepopupitem.h:58
KGamePopupItem::InstantHide
Definition: kgamepopupitem.h:129
KGamePopupItem::HideType
HideType
Used to specify how to hide in forceHide() - instantly or animatedly.
Definition: kgamepopupitem.h:129
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames

Skip menu "libkdegames"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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