faithcore/faith/style.h

Go to the documentation of this file.
00001 #ifndef KDE__STYLE_H
00002 #define KDE__STYLE_H
00003 
00004 #include <faith/painter.h>
00005 #include <faith/pixmap.h>
00006 
00007 namespace Faith
00008 {
00009 
00014 class FAITH_CORE_EXPORT Style
00015 {
00016 public:
00027         enum StyleFlags
00028         {
00029                 Style_Default = 0,
00030                 Style_Enabled = 1<< 0,
00031                 Style_HasFocus = 1<< 1,
00032                 Style_Raised = 1<< 2,
00033                 Style_Sunken = 1<< 3,
00034                 Style_ButtonDefault = 1<< 4,
00035                 Style_On = 1<< 5,
00036                 Style_Off = 1<< 6,
00037                 Style_Down = 1<< 7,
00038                 Style_MouseOver = 1<< 8,
00039                 Style_Active = 1<< 9,
00040                 Style_Horizontal = 1<< 10,
00041                 Style_Vertical = 1<< 11
00042         };
00043 
00044         enum PrimitiveElement
00045         {
00046                 PE_ButtonBevel,
00047                 PE_PanelLineEdit,
00048                 PE_ButtonDefault,
00049                 PE_ButtonTool,
00050                 PE_WindowFrame,
00051                 PE_PanelPopup,
00052                 
00053                 PE_ScrollBarAddPage,
00054                 PE_ScrollBarSubPage,
00055                 PE_ScrollBarSubLine,
00056                 PE_ScrollBarAddLine,
00057                 PE_ScrollBarFirst,
00058                 PE_ScrollBarLast,
00059                 PE_ScrollBarSlider,
00060                 PE_FocusRect,
00061                 
00062                 PE_ArrowUp,
00063                 PE_ArrowDown,
00064                 PE_ArrowLeft,
00065                 PE_ArrowRight,
00066                 
00067                 PE_DockWindowHandle,
00068                 PE_CheckMark,
00069                 
00070                 PE_SliderHandle,
00071                 PE_SliderGroove,
00072 
00073                 PE_SpinWidgetUp,
00074                 PE_SpinWidgetDown
00075         };
00076 
00085         enum ControlElement
00086         {
00087                 CE_PushButton,
00088                 CE_PushButtonLabel,
00089                 CE_ToolButtonLabel,
00090                 CE_MenuBarItem,
00091                 CE_PopupMenuItem
00092         };
00093         
00097         enum ComplexControl
00098         {
00099                 CC_ScrollBar,
00100                 CC_ToolButton,
00101                 CC_Slider,
00102                 CC_ComboBox
00103         };
00104         
00105         enum SubControl
00106         {
00107                 SC_None = 0,
00108                 
00109                 SC_ScrollBarAddLine = 1 << 0,
00110                 SC_ScrollBarSubLine = 1 << 1,
00111                 SC_ScrollBarAddPage = 1 << 2,
00112                 SC_ScrollBarSubPage = 1 << 3,
00113                 SC_ScrollBarFirst = 1 << 4,
00114                 SC_ScrollBarLast = 1 << 5,
00115                 SC_ScrollBarSlider = 1 << 6,
00116                 SC_ScrollBarGroove = 1 << 7,
00117                 
00118                 SC_ToolButton = 1 << 8,
00119                 SC_ToolButtonMenu = 1 << 9,
00120                 
00121                 SC_SliderHandle = 1 << 10,
00122                 SC_SliderGroove = 1 << 11,
00123                 SC_SliderAddPage = 1 << 12,
00124                 SC_SliderSubPage = 1 << 13,
00125                 
00126                 SC_ComboBoxEditField = 1 << 14,
00127                 SC_ComboBoxArrow = 1 << 15,
00128                 SC_ComboBoxFrame = 1 << 16,
00129                 SC_ComboBoxListBoxPopup = 1 << 17
00130         };
00131         
00143         enum PixelMetrics
00144         {
00145                 PM_ButtonMargin,
00146                 PM_ButtonShiftVertical,
00147                 PM_ButtonShiftHorizontal,
00148                 PM_LineEditMargin,
00149                 PM_ScrollBarExtent,
00150                 PM_ScrollBarSliderMin,
00151                 PM_MenuBarItemSpacing,
00152                 PM_SliderExtent,
00153                 PM_SliderHandleExtent,
00154                 PM_DefaultFrameWidth
00155         };
00156 
00157         enum SubRect
00158         {
00159                 SR_PushButtonContents,
00160                 SR_ToolButtonContents,
00161                 SR_DockWindowHandleRect,
00162                 SR_ComboBoxFocusRect
00163         };
00164 
00165         enum ContentsType
00166         {
00167                 CT_PopupMenuItem,
00168                 CT_ToolButton
00169         };
00170 
00171         Style();
00172         virtual ~Style();
00173 
00174         virtual void polish(Faith::Widget *w)=0;// { (void)w; }
00175         virtual void unpolish(Faith::Widget *w)=0;// { (void)w; }
00176 
00177 
00178         virtual void drawControl(
00179                         ControlElement which, Painter *with, const Widget *what,
00180                         const ColorGroup &cg, const Rect &where, unsigned int flags = 0, void *opt=0
00181                 )=0;
00182                 
00183         virtual void drawComplexControl(
00184                         ComplexControl which,
00185                         Painter *with,
00186                         const Widget *what,
00187                         const Rect &where,
00188                         const ColorGroup &cg,
00189                         unsigned int flags,
00190                         unsigned int controls,
00191                         SubControl active,
00192                         void *opt=0
00193                 )=0;
00194         
00195         virtual void drawPrimitive(
00196                         PrimitiveElement which, Painter *with, const Rect &where,
00197                         const ColorGroup &cg, unsigned int flags = 0, void *opt=0
00198                 )=0;
00199 
00200         virtual void drawItem(
00201                         Painter *with, const Rect &where, int textflags, const ColorGroup &cg,
00202                         bool enabled, const Pixmap &pixmap, const String &text, int len,
00203                         const Faith::Color &color
00204                 );
00208         virtual int pixelMetric(PixelMetrics which, const Widget *what) const=0;
00209 
00213         virtual Faith::Rect subRect(SubRect subrect, const Widget *widget) const=0;
00214 
00215         virtual Faith::Style::SubControl querySubControl(
00216                 ComplexControl control,
00217                 const Widget *widget,
00218                 const Point &at,
00219                 void *opt=0
00220         ) const=0;
00221         
00222         virtual Faith::Rect querySubControlMetrics(
00223                         ComplexControl control,
00224                         const Widget *widget,
00225                         SubControl sc,
00226                         void *opt=0
00227                 ) const=0;
00228         
00229         virtual Faith::Size sizeFromContents(
00230                         ContentsType t,
00231                         const Widget *widget,
00232                         const Size &s,
00233                         const void *opt=0
00234                 ) const=0;
00235 
00236         // TODO ???
00237         static Faith::Rect visualRect(const Rect &rect, const Widget *)
00238         {
00239                 return rect;
00240         }
00241 };
00242 
00243 }
00244 
00245 #endif

Generated on Fri Sep 1 00:23:07 2006 for Faith by  doxygen 1.4.7