LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QuicklaunchLayout.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 #ifndef QUICKLAUNCHLAYOUT_H
22 #define QUICKLAUNCHLAYOUT_H
23 
24 #include "Common.h"
25 
26 /*
27  * In the quicklaunch the layout has several components:
28  *
29  * Internal padding indicates how much space should be left from the edge of
30  * the card to the icons. Right now there are no complicated calculations about
31  * what the actual padding will be (in other words automatically increase that & decrease
32  * number of items in a column if the parameters don't match up).
33  *
34  * An item is the launcher item - it consists of an icon & label.
35  *
36  * The distance between the left of one item & the left of next one in the row is:
37  * gItemWidth + gItemXPad
38  *
39  * The position of the icon within the item icon space is given by:
40  * (gItemWidth - gIconWidth) / 2, (gItemIconHeight - gIconHeight) / 2
41  *
42  * The co-ordinates here are assumed to be 0,0 = top-left & increasing bottom-right.
43  */
44 
45 #include <QRect>
46 #include <QPoint>
47 
48 namespace QuicklaunchLayout {
49  struct Position {
50  int x;
51  int y;
52  };
53 
54  struct GridPosition {
55  int row;
56  int column;
57  };
58 
60  void initConstants(int qlMaxWidth, int iconYOffset);
61 
62  void setNewQuicklaunchWidth(int width);
63 
64  int maxNumColumns();
66 
67  QRect iconBounds(int i, int numIcons);
68  QRect iconBounds(const QPoint& position);
69 
70  QRect iconSlotBounds(int i, int numIcons);
71 
72  // The internal quicklaunch dimenions - they do not necessarily reflect the size on the
73  // screen at any point in time.
74  // TODO: These are global constants calculated at runtime - hide behind function calls.
75  extern int QuicklaunchWidth;
76  extern int QuicklaunchHeight;
77 
78  extern int gIconYPos;
79 
80  extern int gIconHeight;
81  extern int gIconWidth;
82 }
83 
84 #endif // QUICKLAUNCHLAYOUT_H_