LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
alphabetpage.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2010-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 ALPHABETPAGE_H_
23 #define ALPHABETPAGE_H_
24 
25 #include "page.h"
26 #include <QPointer>
27 #include "thing.h"
28 #include "icon.h"
29 
30 class AlphabetIconLayout;
31 class PixmapObject;
32 class AlphabetPage : public Page
33 {
34  Q_OBJECT
35 
36 public:
37  friend class AlphabetIconLayout;
38 
39  Q_INVOKABLE AlphabetPage(const QRectF& pageGeometry,LauncherObject * p_belongsTo);
40  virtual ~AlphabetPage();
41 
42  //returns true if at least 1 item was laid out, false for a total fail
43  virtual bool layoutFromItemList(const ThingList& items);
44  virtual bool layoutFromItemList(const IconList& items);
45 
46  virtual bool canAcceptIcons() const;
47  virtual PageMode::Enum pageMode() const;
48  virtual void setPageMode(PageMode::Enum v);
49 
50  virtual bool releaseTransferredIcon(IconBase * p_transferredIcon);
51 
52  virtual bool resize(quint32 w, quint32 h);
53 
54  virtual bool addIcon(IconBase * p_icon);
55  virtual bool addIconNoAnimations(IconBase * p_icon);
56  virtual bool removeIcon(const QUuid& iconUid);
57  virtual bool removeIconNoAnimations(const QUuid& iconUid);
58 
59 
60 public Q_SLOTS:
61 
62  virtual void dbg_slotPrintLayout();
63 
64 protected Q_SLOTS:
65 
66 // the reorder layout uses this to tell me that the tracking has been canceled/lost
67 // DON'T USE TO DO ANYTHING "HEAVY"...it's just meant for dealing with the Page's version of tracking
68 // the icon(s) being moved by the user's touch point inputs
69  virtual void slotTrackedIconCancelTrack(const QUuid& uid);
70 
71  virtual void slotReorderInLayoutStarted();
72  virtual void slotReorderInLayoutEnded();
73 
74  virtual void slotLauncherCmdStartReorderMode();
75  virtual void slotLauncherCmdEndReorderMode();
76 
77 protected:
78 
79  virtual bool tapGesture(QTapGesture *tapEvent,QGestureEvent * baseGestureEvent);
80  virtual bool tapAndHoldGesture(QTapAndHoldGesture *tapHoldEvent,QGestureEvent * baseGestureEvent);
81 
82  //passing in id, but really for now only 1 id can be tracked
83  virtual void touchTrackedPointMoved(int id,const QPointF& scenePosition,const QPointF& lastScenePosition,const QPointF& initialPosition);
84  virtual void touchTrackedPointReleased(int id,const QPointF& scenePosition,const QPointF& lastScenePosition,const QPointF& initialPosition);
85  virtual void iconRelease();
86 
88  virtual void paintOffscreen(QPainter *painter);
89 
90  //TODO: OOP-S: all the detect and handle special area fns should be moved to the Page class; overrides can happen here as needed
91  virtual bool detectAndHandleSpecialMoveAreas(int id,const QPointF& pageCoordinate);
92  virtual bool handleTopBorderSpecialMoveArea(int id,const QPointF& pageCoordinate);
93  virtual bool handleBottomBorderSpecialMoveArea(int id,const QPointF& pageCoordinate);
94  virtual bool handleLeftBorderSpecialMoveArea(int id,const QPointF& pageCoordinate);
95  virtual bool handleRightBorderSpecialMoveArea(int id,const QPointF& pageCoordinate);
96 
97  virtual bool detectAndHandleSpecialReleaseAreas(int id,const QPointF& pageCoordinate);
98  virtual bool handleQuickLaunchSpecialReleaseArea(int id,const QPointF& pageCoordinate);
99 
100  virtual void activatePage();
101  virtual void deactivatePage();
102 
103  virtual void switchToNormalMode();
104  virtual void switchToReorderMode();
105 
106 protected:
107 
110  //TODO: implement a better system; this is just done ad-hoc for scaffolding to get page reorder going
111  // in particular, I'd like multi-touch support.
112  QPair<QUuid,QUuid> m_trackingIconUids;
113  QPointer<IconBase> m_qp_cached_trackingIcon; //value2 of the uid pair above is this icon; it's stored here so it doesn't have to be
114  // looked up from the heap each time
115 
116 };
117 
118 #endif /* ALPHABETPAGE_H_ */