LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DockModeAppMenuContainer.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2011-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef DOCKMODEMENUCONTAINER_H
23 #define DOCKMODEMENUCONTAINER_H
24 
25 #include "Common.h"
26 #include "CustomEvents.h"
27 #include "PtrArray.h"
28 #include <QFont>
29 #include <QGraphicsObject>
30 #include <QPropertyAnimation>
31 #include <QParallelAnimationGroup>
32 #include <stdint.h>
33 #include <QDebug>
34 
35 class StatusBar;
36 class DockModeMenuItem;
39 
41 {
42  Q_OBJECT
43 
44 public:
45  DockModeAppMenuContainer (DockModeMenuManager* parent, int width, int height);
47 
48  QRectF boundingRect() const;
49  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { }
50 
51  void addMenuItem (DockModeLaunchPoint* dlp);
53  void resize (int screenWidth, int screenHeight);
54 
55  virtual void mousePressEvent (QGraphicsSceneMouseEvent* mouseEvent);
56  virtual void mouseMoveEvent (QGraphicsSceneMouseEvent* mouseEvent);
57  virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent* mouseEvent);
58 
59  const QFont font() const { return m_font; }
60 
61  Q_INVOKABLE const int getWidth() const { return m_bounds.width(); }
62  Q_INVOKABLE const int getHeight() const { return m_bounds.height(); }
63 
64  Q_INVOKABLE int getMaximumHeightForMenu() const { return m_maxHeight; }
65  Q_INVOKABLE void mouseWasGrabbedByParent();
66 
67  void appSelected (DockModeLaunchPoint* dlp);
68 
71 
72 Q_SIGNALS:
75 
76 private:
77  QFont m_font;
78  qreal m_menuHeight;
79  qreal m_maxHeight;
80  QRectF m_bounds;
81 
82  bool m_penDown;
83  QPointF m_penDownPos;
84  int m_currentItemIndex;
85 
86  PtrArray<DockModeMenuItem> m_menuItems;
87  std::map<DockModeLaunchPoint*, DockModeMenuItem*> m_menuItemMap;
88 
89 };
90 
91 #endif