UTDrawable.h

Go to the documentation of this file.
00001 //==================================================================================================
00002 // Copyright (C) 2010  Brian Tietz    sdbtietz at yahoo dot com
00003 //
00004 // This program is free software; you can redistribute it and/or modify it under the terms of the
00005 // GNU General Public License as published by the Free Software Foundation, version 2.0 of the
00006 // License.
00007 //
00008 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
00009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00010 // General Public License for more details.
00011 //
00012 // You should have received a copy of the GNU General Public License along with this program; if
00013 // not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00014 // 02110-1301, USA.
00015 //
00016 // For commercial software, the copyright holder (Brian Tietz, email sdbtietz at yahoo dot com)
00017 // reserves the right and is willing to waive the proprietary source code disclosure aspects of that
00018 // license as applied to the UT library in exchange for either substantial contributions to the
00019 // development of the UT library or other forms of compensation.  Any such waiver must be
00020 // established in writing between the copyright holder and the commercial entity obtaining such a
00021 // waiver.
00022 //==================================================================================================
00023 
00024 
00025 #ifndef _UT_DRAWABLE_H_
00026 #define _UT_DRAWABLE_H_
00027 
00030 
00031 
00032 //==================================================================================================
00033 //=== Project headers
00034 //==================================================================================================
00035 #include "UTgfx.h"
00036 
00037 
00038 //==================================================================================================
00039 //=== Types and constants
00040 //==================================================================================================
00045 enum line_cap_type_t
00046 {
00047     eLCT_butt,
00048     eLCT_butt_extended_half_width,
00049     eLCT_round
00050 };
00051 
00052 
00053 //==================================================================================================
00054 //=== Forward name declarations
00055 //==================================================================================================
00056 class Font_t;
00057 
00058 
00059 //==================================================================================================
00060 class UTGFX_EXPORT Drawable_t
00061 //==================================================================================================
00077 {
00078     //----------------------------------------------------------------------------------------------
00079     public:
00080     //----------------------------------------------------------------------------------------------
00081                             Drawable_t();
00083 
00084     virtual                 ~Drawable_t();
00086 
00087     virtual void            SetBrush(   const Color_t& color,
00088                                         float brush_width = 1,
00089                                         line_cap_type_t cap_type = eLCT_butt_extended_half_width );
00091 
00092     inline const Color_t&   BrushColor() const;
00094 
00095     inline float            BrushWidth() const;
00097 
00098     inline line_cap_type_t  BrushLineCapType() const;
00100 
00101     virtual void            SetFillColor(const Color_t& color);
00105 
00106     inline const Color_t&   FillColor() const;
00108 
00109     virtual void            DrawLine(   const Point_t& from,
00110                                         const Point_t& to,
00111                                         bool anti_alias = true ) = 0;
00118 
00119     virtual void            DrawRect(   const Rect_t& rect,
00120                                         bool anti_alias = true,
00121                                         bool fill = false ) = 0;
00128 
00129     virtual void            DrawText(   const String_t& string,
00130                                         const Point_t& where,
00131                                         bool anti_alias = true ) = 0;
00139 
00140     void                    SetFont(const Font_t& font);
00143 
00144     const Font_t*           Font(bool create_new_if_null = false) const;
00150 
00151     //----------------------------------------------------------------------------------------------
00152     private:
00153     //----------------------------------------------------------------------------------------------
00154     Color_t                 m_brush_color;
00155     float                   m_brush_width;
00156     line_cap_type_t         m_brush_line_cap_type;
00157     Color_t                 m_fill_color;
00158     Font_t*                 m_font;
00159 };
00160 
00161 
00162 
00163 
00164 //==================================================================================================
00165 //==================================================================================================
00166 //===
00167 //=== Inline function implementations
00168 //===
00169 //==================================================================================================
00170 //==================================================================================================
00171 inline const Color_t&
00172 Drawable_t::BrushColor() const
00173 {
00174     return m_brush_color;
00175 }
00176 
00177 
00178 inline float
00179 Drawable_t::BrushWidth() const
00180 {
00181     return m_brush_width;
00182 }
00183 
00184 
00185 inline line_cap_type_t
00186 Drawable_t::BrushLineCapType() const
00187 {
00188     return m_brush_line_cap_type;
00189 }
00190 
00191 
00192 inline const Color_t&
00193 Drawable_t::FillColor() const
00194 {
00195     return m_fill_color;
00196 }
00197 
00198 
00199 #endif // _UT_DRAWABLE_H_

Generated on Tue Dec 14 22:35:05 2010 for UT library by  doxygen 1.6.1