Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ZLayout.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------------------------------------------
00002 //
00003 //  Header Name: ZLayout.h
00004 //
00005 //  General Description: Layout-related defines and functions
00006 //
00007 //-------------------------------------------------------------------------------------------------
00008 //
00009 //                            Motorola Confidential Proprietary
00010 //                     Template ID and version: TMP_LFC_50068  Version 1.2
00011 //                      (c) Copyright Motorola 2004, All Rights Reserved
00012 //
00013 //-------------------------------------------------------------------------------------------------
00014 
00015 #ifndef Z_LAYOUT_H
00016 #define Z_LAYOUT_H
00017 
00018 #ifndef __cplusplus
00019 #error "This is a C++ header file;it requires C++ to compile."
00020 #endif
00021 
00022 
00023 /**
00024  * Includes common macros and functions about the overall application layout.
00025  *
00026  * The EzX platform styleguide defines the layout for all UI applications.
00027  * The styleguide requirements are codified here.
00028  *
00029  * @note Layout related Interface Format & Naming Rules:
00030  * @{
00031  * QRect getXXXXYYYYmm_nnR( ) are per Motorola Layout Requirements Spec v0.3
00032  * get: never changed as a leading one.
00033  * XXXX: Gnb, Cst, Dlg - Container names.
00034  * YYYY: A, BC - Dialog names only when XXXX is Dlg.
00035  * mm: 2, 3a, 3b - button amount and relevant layout scheme,
00036  * for example, 3a meaning "3 buttons (a) Layout".
00037  * _: never changed as a intermediate between mm and nn.
00038  * nn: 1, 2, 3 - which actual button is pointed here. mm_nn means the number nn button
00039  * in mm buttons Layout.
00040  * R: never changed as a tail meaning Rect or Region.
00041  *
00042  * Return QRect object meaning a rectangle area for the specific widget.
00043  *
00044  * For example, a function getCst4a_2R( ) regulates the 2nd button rectangle area
00045  * of CST with 4 buttons, which is a layout scheme marked (a) in LRS document.
00046  *
00047  * Motorola internal developers should be able to find the appropriate function to 
00048  * use by referencing the layout requirement specification for their application.
00049  *
00050  * @}
00051  *
00052  * @see ZLRS.h
00053  */
00054 
00055 #include <qrect.h>
00056 
00057 /**
00058  * Dialog (Maxium) Width
00059  * No dialog or transient can be wider this.
00060  */
00061 #define EZX_DLG_WIDTH 224
00062 
00063 /**
00064  * Dialog Title Left Spacing
00065  * Title text for dialogs must have spacing to the left border of the title area,
00066  * especially for the gradient title bar.
00067  */
00068 #define EZX_DLGTITLE_LEFT_SPACING 5
00069 
00070 /**
00071  * EzX CheckBox BoxSize
00072  * Qt default CheckBox BoxSize (16) is too small for a handset device.
00073  * EzX wants to larger the BoxSize for QCheckBox and QListViewItem, etc.
00074  */
00075 #define EZX_CHECK_BOXSIZE 20
00076 
00077 /**
00078  * Default font sizes for the application UI display.
00079  * The Macros are total Theme bounded, mapping to Theme setup UI with
00080  * "Text Size" Small/Medium/Large.
00081  * @see EZX_FONT_SIZE_T
00082  */
00083 #define DEFAULT_FONT_SIZE_SMALL 15
00084 #define DEFAULT_FONT_SIZE_MEDIUM 18
00085 #define DEFAULT_FONT_SIZE_LARGE 21
00086 
00087 /**
00088  * @enum EZX_FONT_SIZE_T maps to Theme setup UI "Text Size" setting.
00089  * This enumeration doesn't bookkeep the exact font size.
00090  * @see DEFAULT_FONT_SIZE_SMALL
00091  * @see DEFAULT_FONT_SIZE_MEDIUM
00092  * @see DEFAULT_FONT_SIZE_LARGE
00093  */
00094 typedef enum
00095 {
00096      EZX_FONT_SIZE_SMALL=0,
00097      EZX_FONT_SIZE_MEDIUM,
00098      EZX_FONT_SIZE_LARGE,
00099 } EZX_FONT_SIZE_T;
00100 
00101 /**
00102  * Define the extensions of all scroll bars seen in UI applications.
00103  * For vertical scroll bars, the extension defines the width of scroll bar;
00104  * for horizontal scroll bar, teh extension defines the height of scroll bar.
00105  */
00106 #define EZX_SCROLLBAR_EXTENSION 19
00107 
00108 /**
00109  * Macro functions for convenience
00110  */
00111 #define ZSetLayout(widgetPtr, globalR) widgetPtr->setGeometry(ZGlobal::mapFromGlobalR(widgetPtr, globalR))
00112 #define ZDiffR(parent, child) ZGlobal::diffRect(ZGlobal::get##parent(), ZGlobal::get##child())
00113 
00114 class QWidget;
00115 class QPopupMenu;
00116 class QPoint;
00117 
00118 namespace ZGlobal
00119 {
00120     /**
00121      * Two functions to keep old code working well
00122      * @return The appropriate line heigth which is related to application font size
00123      * @see getLineSpace()
00124      */
00125     int getLineHeight();
00126   
00127     /**
00128      * line space for multi-line widget, such as ZMultiLineEdit
00129      * @return The appropriate line spacing between lines
00130      * @see getLineHeight()
00131      */
00132     int getLineSpace();
00133   
00134     /**
00135      *
00136      * @param gRect rectangle area in global screen coordinates
00137      * @param self the widget gRect are going to turn on
00138      * @return rectangle area in widget coordinate, translated from global screen rectangle gRect
00139      * @see ZSetLayout(widgetPtr, globalR)
00140      * 
00141      * @code
00142      * //parent widget is a CST with 4 buttons matching LRS CST 4(b)
00143      * class CSTWidget
00144      * {
00145      *     CSTWidget() //constructor
00146      *     {
00147      *         ...
00148      *         //child widget is a button
00149      *         QPushButton child1=new QPushButton(this);
00150      *         //get correct layout area
00151      *         QRect tmp=ZGlobal::mapFromGlobalR(child1, ZGlobal::getCst4b_1R());
00152      *         //turn on layout regulation
00153      *         child1->setGeometry(tmp);
00154      *         ...
00155      *     }
00156      * };
00157      * @endcode
00158      */
00159      QRect mapFromGlobalR(QWidget* self, QRect gRect);
00160   
00161     /**
00162      * Return the difference of two rectangles belonging to a parent widget and a 
00163      * child widget.
00164      *
00165      * @param parent: parent widget rectangle area in global screen coordinates
00166      * @param child: child widget rectangle area in global screen coordinates
00167      * @return A child rectangle area in parent widget coordinates
00168      * @see ZDiffR(parent, child)
00169      *
00170      * @code
00171      * //parent widget is a dialog B with 2 buttons matching LRS DlgB2_2
00172      * class DialogWidget
00173      * {
00174      *     DialogWidget() //constructor
00175      *     {
00176      *         ...
00177      *         //sample child widget is a button
00178      *         QPushButton child1=new QPushButton(this);
00179      *         //get correct layout area based on the case that DialogWidget
00180      *         //adopts ZGlobal::getDlgBCR( ) layout definition
00181      *         QRect tmp=
00182      *             ZGlobal::diffRect(ZGlobal::getDlgBCR(), ZGlobal::getDlgB2_2R());
00183      *         //turn on layout regulation
00184      *         child1->setGeometry(tmp);
00185      *         ...
00186      *     }
00187      * };
00188      * @endcode
00189      */     
00190     QRect diffRect(QRect parent, QRect child);
00191    
00192     /*
00193      * Following are global layout definition
00194      */
00195    
00196     /**
00197      * @return Screen area: same as Desktop area, just a different name.
00198      */
00199     QRect getScreenR();
00200   
00201     /**
00202      * @return Desktop area: Same infomation as screen
00203      */
00204     QRect getDesktopRect();
00205   
00206     /**
00207      * @return GNB area
00208      */
00209     QRect getGnbR();
00210   
00211     /**
00212      * @return CST area
00213      */
00214     QRect getCstR();
00215   
00216     /**
00217      * @return Home area (screen-gnb)
00218      */
00219     QRect getHomeR();
00220    
00221     /**
00222      * @return content area (screen-gnb-cst)
00223      */
00224     QRect getContentR();
00225   
00226     /**
00227      * @return GNB_Status Bar area: in Content area actually
00228      */
00229     QRect getStatusBarR();
00230   
00231     /**
00232      * @return Content -(GNB_StatusBar) area
00233      */
00234     QRect getSubContentR();
00235     
00236     /**
00237      * @return The small content rect, use it when the kb appears
00238      */
00239     QRect getSmallContentR();
00240   
00241     /**
00242      * @return input keyboard area when popped up
00243      * @note Useless for LRS0.9.3 - compatible interface
00244      */
00245     QRect getKbR();
00246   
00247     /**
00248      * @return The rect of CST area
00249      */
00250     QRect getCSTRect();
00251   
00252     /**
00253      * @return GNB area, the same as getGnbR()
00254      * @see getGnbR()
00255      */
00256     QRect getGNBRect();
00257     
00258     /**
00259      * @return The mainwidget area, excludes CST
00260      * the same as getContentR()
00261      * @see getContentR()
00262      */
00263     QRect getMainWidgetRect();
00264   
00265     /**
00266      * Calculate the prefered popup menu position
00267      * @param base ???
00268      * @param popup The popup menu widget
00269      * @param pos Prefered position to show the popup menu widget popup
00270      * @note Deprecated interface
00271      */
00272     void getPopupMenuTopLeft(QWidget* base,QPopupMenu* popup,QPoint& pos);
00273   
00274     /**
00275      * Function to get the font size
00276      * @param fontSizeType Theme "Text Size" of Small/Medium/Large
00277      * @return The exact font size in terms of Theme "Text Size" of Small/Medium/Large
00278      * @see EZX_FONT_SIZE_T
00279      * @see DEFAULT_FONT_SIZE_SMALL
00280      * @see DEFAULT_FONT_SIZE_MEDIUM
00281      * @see DEFAULT_FONT_SIZE_LARGE
00282      */
00283     int getFontSize(EZX_FONT_SIZE_T fontSizeType);
00284 };
00285 
00286 #endif //Z_LAYOUT_H

Generated at Wed Mar 3 13:22:00 2004 by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001