qhbstyle/qhbstyle_p.h
changeset 4 90517678cc4f
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     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 Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not,
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:
       
    19 *
       
    20 */
       
    21 #ifndef QHBSTYLE_P_H
       
    22 #define QHBSTYLE_P_H
       
    23 
       
    24 #include "qhbstyle.h"
       
    25 
       
    26 #ifndef QT_NO_STYLE_HB
       
    27 
       
    28 QT_BEGIN_NAMESPACE
       
    29 
       
    30 class HbStyle;
       
    31 class QParallelAnimationGroup;
       
    32 
       
    33 enum Item {
       
    34     SP_Arrow,
       
    35     SP_BoxButton,
       
    36     SP_CheckBoxIndicator,
       
    37     SP_CurrentFolderIcon,
       
    38     SP_ErasedNoteIcon,
       
    39     SP_ErrorNoteIcon,
       
    40     SP_HeaderOrderIndicator,
       
    41     SP_InfoNoteIcon,
       
    42     SP_ItemDecoration,
       
    43     SP_LargeMemoryCardIcon,
       
    44     SP_MenuIndicator,
       
    45     SP_MenuSeparator,
       
    46     SP_NewSmallFolderIcon,
       
    47     SP_OkNoteIcon,
       
    48     SP_QueryNoteIcon,
       
    49     SP_RadioButtonIndicator,
       
    50     SP_SelectedIndicator,
       
    51     SP_SeparatorLine,
       
    52     SP_SliderHandle,
       
    53     SP_SliderTick,
       
    54     SP_SmallFileIcon,
       
    55     SP_SmallFolderIcon,
       
    56     SP_SubMenuIndicator,
       
    57     SP_TreeViewCollapsed,
       
    58     SP_TreeViewExpanded,
       
    59     SP_WarningNoteIcon,
       
    60 };
       
    61 
       
    62 enum MultiPartItem {
       
    63     SM_BoxFrame,
       
    64     SM_Dialog,
       
    65     SM_GroupBox,
       
    66     SM_GroupBoxTitle,
       
    67     SM_HeaderItem,
       
    68     SM_ItemViewHighlight,
       
    69     SM_ItemViewItem,
       
    70     SM_LineEdit,
       
    71     SM_ListParent,
       
    72     SM_Menu,
       
    73     SM_MenuItem,
       
    74     SM_MenuScroller,
       
    75     SM_Panel,
       
    76     SM_ProgressBarGroove,
       
    77     SM_ProgressBarIndicator,
       
    78     SM_PushButton,
       
    79     SM_ScrollBarGroove,
       
    80     SM_ScrollBarHandle,
       
    81     SM_SliderGroove,
       
    82     SM_SliderProgress,
       
    83     SM_TableItem,
       
    84     SM_TabShape,
       
    85     SM_TextEdit, //todo: or combine this and  SM_LineEdit to "SM_TextEditor"?
       
    86     SM_ThemeBackground,
       
    87     SM_ToolBar,
       
    88     SM_ToolBarButton,
       
    89     SM_ToolButton,
       
    90     SM_ToolTip,
       
    91 };
       
    92 
       
    93 enum ItemState {
       
    94     SS_Active       = 0x000001,  // "On"
       
    95     SS_Inactive     = 0x000002,  // "Off"
       
    96     SS_Pressed      = 0x000004,
       
    97     SS_Latched      = 0x000008,  // similar to SS_Pressed, but state remains ("toggled")
       
    98     SS_Disabled     = 0x000010,
       
    99     SS_Filled       = 0x000020,
       
   100     SS_Horizontal   = 0x000040,
       
   101     SS_Vertical     = 0x000080,
       
   102     SS_Selected     = 0x000100,  // item is selected (not necessarily focused)
       
   103     SS_Beginning    = 0x000200,  // beginning part of multipart item
       
   104     SS_Middle       = 0x000400,  // middle part of multipart item
       
   105     SS_End          = 0x000800,  // end part of multipart item
       
   106     SS_Flipped      = 0x001000,  // 180 degree rotation
       
   107     SS_Mirrored     = 0x002000,  // graphic is drawn mirrored
       
   108     SS_Down         = 0x004000,
       
   109     SS_Up           = 0x008000,
       
   110     SS_Left         = 0x010000,
       
   111     SS_Right        = 0x020000,
       
   112     SS_RotatedRight = 0x040000,
       
   113     SS_RotatedLeft  = 0x080000,
       
   114     SS_Edited       = 0x100000,
       
   115     SS_Alternate    = 0x200000,
       
   116     SS_Focused      = 0x400000   // item is focused (not necessarily selected)
       
   117 };
       
   118 
       
   119 Q_DECLARE_FLAGS(ItemStates, ItemState)
       
   120 
       
   121 class QHbStylePrivate //: public QObjectPrivate
       
   122 {
       
   123     //Q_DECLARE_PUBLIC(QHbStyle)
       
   124 
       
   125 public:
       
   126     QHbStylePrivate();
       
   127 
       
   128     virtual ~QHbStylePrivate();
       
   129 
       
   130     //Call HbStyle styleManager to avoid name confusion
       
   131     HbStyle* styleManager();
       
   132     void setStyleManager(HbStyle* style);
       
   133 
       
   134     QParallelAnimationGroup* animationGroup();
       
   135 
       
   136     //These return true if drawing was done by the style successfully.
       
   137     bool drawItem(Item part, QPainter *painter, const QRect &rect, ItemStates state = ItemStates(SS_Active | SS_Horizontal), const QColor &color = QColor(QColor::Invalid));
       
   138     bool drawMultiPartItem(MultiPartItem multiPart, QPainter *painter, const QRect &rect, ItemStates state = ItemStates(SS_Active | SS_Horizontal));
       
   139 
       
   140     bool isDialog(const QWidget *widget);
       
   141     bool hbParameter(const QString &parameterName, int &value);
       
   142     void polishFont(QWidget *widget);
       
   143 
       
   144 private:
       
   145     HbStyle *m_styleManager;
       
   146     HbFrameDrawer *m_frameDrawer;
       
   147     QParallelAnimationGroup* m_animationGroup;
       
   148 
       
   149     //QHbStyle *q_ptr;
       
   150 };
       
   151 
       
   152 QT_END_NAMESPACE
       
   153 
       
   154 #endif // QT_NO_STYLE_HB
       
   155 
       
   156 #endif //QHBSTYLE_P_H