- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ustyle.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/ui/ustyle.hpp 00008 begin : Sat Nov 29 2003 00009 $Id: ustyle.hpp,v 1.7 2005/10/24 16:00:26 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00026 ***************************************************************************/ 00027 00028 00029 #ifndef USTYLE_HPP 00030 #define USTYLE_HPP 00031 00032 #include "../uobject.hpp" 00033 00034 #include "../util/udimension.hpp" 00035 #include "../util/urectangle.hpp" 00036 #include "../util/uinsets.hpp" 00037 00038 namespace ufo { 00039 00040 class UGraphics; 00041 class UColor; 00042 class UFont; 00043 class UIcon; 00044 00045 class UWidget; 00046 class UCaret; 00047 00048 class UStyleHints; 00049 class UStyleOption; 00050 class UWidgetModel; 00051 class UBorderModel; 00052 00053 00064 class UFO_EXPORT UStyle : public UObject { 00065 UFO_DECLARE_ABSTRACT_CLASS(UStyle) 00066 public: // Public types 00067 enum PrimitiveElement { 00069 PE_IndicatorArrowUp, 00070 PE_IndicatorArrowDown, 00071 PE_IndicatorArrowLeft, 00072 PE_IndicatorArrowRight, 00073 PE_IndicatorCheckBox, 00074 PE_IndicatorCheckBoxMask, 00075 PE_IndicatorRadioButton, 00076 PE_IndicatorRadioButtonMask, 00077 PE_IndicatorButtonDropDown, 00078 PE_TextCaret, 00079 PE_PanelButtonBevel, 00080 PE_PanelButtonTool, 00081 PE_PanelToolBar, 00082 PE_PanelWidget, 00083 PE_Frame, 00084 PE_FrameWindow, 00085 PE_FrameMenu, 00086 PE_FrameButtonBevel, 00087 PE_FrameDefaultButton, 00088 PE_FrameTabWidget, 00089 PE_FrameStatusBar, 00090 PE_FrameLineEdit, 00091 PE_FrameFocusRect, 00092 PE_Gripper 00093 }; 00094 enum ComponentElement { 00095 CE_Widget, 00096 CE_Compound, 00097 CE_Label, 00098 CE_StaticText, 00099 CE_Button, 00100 CE_ToolButton, 00101 CE_CheckBox, 00102 CE_RadioButton, 00103 CE_MenuItem, 00104 CE_MenuBarItem, 00105 CE_MenuTearOff, 00106 CE_ListBox, 00107 CE_LineEdit, 00108 CE_TextEdit, 00109 CE_TextWidget, 00110 CE_Separator, 00111 CE_ProgressBar, 00112 CE_ProgressBarGroove, 00113 CE_ProgressBarContents, 00114 CE_TabBarTab, 00115 CE_Splitter, 00116 CE_ComboBox, 00117 CE_SpinBox, 00118 CE_Slider, 00119 CE_TitleBar, 00120 CE_InternalFrame, 00121 CE_ScrollBar, 00122 CE_GroupBox 00123 }; 00124 enum SubControls { 00125 SC_None = 0, 00126 SC_ScrollBarHome = 1 << 0, 00127 SC_ScrollBarAddLine = 1 << 1, 00128 SC_ScrollBarSubLine = 1 << 2, 00129 SC_ScrollBarAddPage = 1 << 3, 00130 SC_ScrollBarSubPage = 1 << 4, 00131 SC_ScrollBarSlider = 1 << 5, 00132 SC_ScrollBarGroove = 1 << 6, 00133 SC_ScrollBarEnd = 1 << 7, 00134 SC_ScrollBarFirst = SC_ScrollBarHome, 00135 SC_ScrollBarLast = SC_ScrollBarEnd, 00136 SC_SpinBoxUp = 1 << 0, 00137 SC_SpinBoxDown = 1 << 1, 00138 SC_SpinBoxFrame = 1 << 2, 00139 SC_SpinBoxEditField = 1 << 3, 00140 SC_SpinBoxFirst = SC_SpinBoxUp, 00141 SC_SpinBoxLast = SC_SpinBoxEditField, 00142 SC_ComboBoxEditField = 1 << 0, 00143 SC_ComboBoxArrow = 1 << 1, 00144 SC_ComboBoxFrame = 1 << 2, 00145 SC_ComboBoxListBoxPopup = 1 << 3, 00146 SC_ComboBoxFirst = SC_ComboBoxEditField, 00147 SC_ComboBoxLast = SC_ComboBoxListBoxPopup, 00148 SC_SliderGroove = 1 << 0, 00149 SC_SliderHandle = 1 << 1, 00150 SC_SliderTickmarks = 1 << 2, 00151 SC_SliderFirst = SC_SliderGroove, 00152 SC_SliderLast = SC_SliderTickmarks, 00153 SC_ToolButton = 1 << 0, 00154 SC_ToolButtonMenu = 1 << 1, 00155 SC_TitleBarSysMenu = 1 << 0, 00156 SC_TitleBarMinButton = 1 << 1, 00157 SC_TitleBarMaxButton = 1 << 2, 00158 SC_TitleBarCloseButton = 1 << 3, 00159 SC_TitleBarLabel = 1 << 4, 00160 SC_TitleBarFirst = SC_TitleBarSysMenu, 00161 SC_TitleBarLast = SC_TitleBarLabel 00162 }; 00163 public: // basic drawing 00165 virtual void paintPrimitive(UGraphics * g, 00166 PrimitiveElement elem, 00167 const URectangle & rect, 00168 const UStyleHints * hints, 00169 uint32_t widgetState) = 0; 00170 00175 virtual void paintComponent(UGraphics * g, 00176 ComponentElement elem, 00177 const URectangle & rect, 00178 const UStyleHints * hints, 00179 const UWidgetModel * model, 00180 UWidget * w = NULL) = 0; 00181 00183 virtual void paintBorder(UGraphics * g, 00184 uint32_t borderType, 00185 const URectangle & rect, 00186 const UStyleHints * hints, 00187 uint32_t widgetState) = 0; 00188 00190 virtual UInsets getBorderInsets( 00191 ComponentElement elem, 00192 const UStyleHints * hints) = 0; 00193 00196 virtual SubControls getSubControlAt( 00197 ComponentElement elem, 00198 const URectangle & rect, 00199 const UStyleHints * hints, 00200 const UWidgetModel * model, 00201 const UPoint & pos, 00202 UWidget * w = NULL) = 0; 00203 00205 virtual URectangle getSubControlBounds( 00206 ComponentElement elem, 00207 const URectangle & rect, 00208 const UStyleHints * hints, 00209 const UWidgetModel * model, 00210 SubControls subElem, 00211 UWidget * w = NULL) = 0; 00212 00213 00217 virtual UInsets getInsets( 00218 ComponentElement elem, 00219 const UStyleHints * hints, 00220 const UWidgetModel * model, 00221 UWidget * w = NULL) = 0; 00222 00226 virtual UDimension getSizeFromContents( 00227 ComponentElement elem, 00228 const UDimension & contentsSize, 00229 const UStyleHints * hints, 00230 const UWidgetModel * model, 00231 UWidget * w = NULL) = 0; 00232 00234 virtual void paintCompound( 00235 UGraphics * g, 00236 const UStyleHints * hints, 00237 const std::string & text, 00238 UIcon * icon, 00239 const URectangle & rect, 00240 uint32_t widgetState, 00241 int acceleratorIndex = -1) = 0; 00242 00244 virtual UDimension getCompoundPreferredSize( 00245 const UStyleHints * hints, 00246 const std::string & text, 00247 UIcon * icon) = 0; 00248 00250 virtual void layoutCompound( 00251 const UStyleHints * hints, 00252 const std::string & text, 00253 UIcon * icon, 00254 const URectangle & viewRect, 00255 URectangle * textRect, 00256 URectangle * iconRect) = 0; 00257 00261 virtual void install(UWidget * w) = 0; 00262 virtual void uninstall(UWidget * w) = 0; 00263 #if 0 00264 // API ideas 00267 virtual UDimension getPreferredSizeFromModel( 00268 ComponentElement elem, 00269 const UDimension & maxSize, 00270 const UStyleHints * hints, 00271 const UWidgetModel * model, 00272 UWidget * w = NULL) = 0; 00273 00277 virtual void paintModelBackground( 00278 ComponentElement elem, 00279 const URectangle & rect, 00280 const UStyleHints * hints, 00281 const UWidgetModel * model, 00282 UWidget * w = NULL) = 0; 00283 00287 virtual void paintModel( 00288 ComponentElement elem, 00289 const URectangle & rect, 00290 const UStyleHints * hints, 00291 const UWidgetModel * model, 00292 UWidget * w = NULL) = 0; 00293 00297 virtual UPoint viewToModel( 00298 ComponentElement elem, 00299 const URectangle & rect, 00300 const UStyleHints * hints, 00301 const UWidgetModel * model, 00302 const UPoint & pos, 00303 UWidget * w = NULL) = 0; 00304 00306 virtual URectangle modelToView( 00307 ComponentElement elem, 00308 const URectangle & rect, 00309 const UStyleHints * hints, 00310 const UWidgetModel * model, 00311 const UPoint & pos, 00312 UWidget * w = NULL) = 0; 00313 #endif 00314 }; 00315 00316 } // namespace ufo 00317 00318 #endif // USTYLE_HPP

The libUFO Project - written by Johannes Schmidt