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

uitem.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/widgets/uitem.hpp 00008 begin : Sat May 24 2003 00009 $Id: uitem.hpp,v 1.8 2005/05/21 15:20:06 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 #ifndef UITEM_HPP 00029 #define UITEM_HPP 00030 00031 #include "../uobject.hpp" 00032 00033 #include "../util/udimension.hpp" 00034 #include "../util/urectangle.hpp" 00035 00036 namespace ufo { 00037 00038 class UGraphics; 00039 class UColor; 00040 class UWidget; 00041 class UStyleHints; 00042 00050 class UFO_EXPORT UItem : public virtual UObject { 00051 UFO_DECLARE_ABSTRACT_CLASS(UItem) 00052 public: 00055 virtual void paintItem( 00056 UGraphics * g, 00057 const URectangle & rect, 00058 const UStyleHints * hints, 00059 uint32_t state, 00060 const UWidget * parent = NULL) = 0; 00062 virtual UDimension getItemSize( 00063 const UDimension & maxSize, 00064 const UStyleHints * hints, 00065 const UWidget * parent = NULL) const = 0; 00066 00070 virtual std::string itemToString() const = 0; 00071 00072 virtual void install(UWidget * parent) = 0; 00073 virtual void uninstall(UWidget * parent) = 0; 00074 }; 00075 00076 class UIcon; 00080 class UFO_EXPORT UStringItem : public UItem { 00081 UFO_DECLARE_DYNAMIC_CLASS(UStringItem) 00082 public: 00083 UStringItem(); 00084 UStringItem(const std::string & str); 00085 UStringItem(UIcon * i); 00086 UStringItem(const std::string & str, UIcon * icon); 00087 00088 public: // Implements UItem 00089 virtual void paintItem( 00090 UGraphics * g, 00091 const URectangle & rect, 00092 const UStyleHints * hints, 00093 uint32_t state, 00094 const UWidget * parent = NULL); 00095 00096 virtual UDimension getItemSize( 00097 const UDimension & maxSize, 00098 const UStyleHints * hints, 00099 const UWidget * parent = NULL) const; 00100 00101 virtual std::string itemToString() const; 00102 00103 virtual void install(UWidget * parent); 00104 virtual void uninstall(UWidget * parent); 00105 00106 protected: // Overrides UObject 00107 virtual std::ostream & paramString(std::ostream & os) const; 00108 private: // Private attributes 00109 UIcon * m_icon; 00110 std::string m_text; 00111 }; 00112 00113 } // namespace ufo 00114 00115 #endif // UITEM_HPP

The libUFO Project - written by Johannes Schmidt