text_halign.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #if !defined TEXT_HALIGN_HEADER
00020 #define TEXT_HALIGN_HEADER
00021 
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/attribute.h"
00028 
00029 // Attribute class for specifying text horizontal alignment
00030 class WHIPTK_API WT_Text_HAlign : public WT_Attribute
00031 {
00032         friend class WT_Rendition;
00033         friend class WT_W2D_Class_Factory;
00034         friend class WT_Opcode;
00035 
00036 public:
00037     enum WT_HAlign
00038     {
00039         Left    = 0,    // left-aligned
00040         Center  = 1,    // centered horizontally
00041         Right   = 2     // right-aligned
00042     };
00043 
00044 public:
00045     // constructs a WT_Text_HAlign object
00046     WT_Text_HAlign();
00047 
00048     // constructs a WT_Text_HAlign object with the given alignment
00049     WT_Text_HAlign(WT_HAlign hAlign);
00050 
00052         WT_Text_HAlign(WT_Text_HAlign const& hAlign)
00053         {
00054                 *this = hAlign;
00055         }
00056 
00057     // destructor
00058     virtual ~WT_Text_HAlign();
00059 
00060 public:
00061     // returns the horizontal alignment
00062     inline const WT_HAlign& hAlign() const { return m_eAlignment; }
00063     inline WT_HAlign&       hAlign()       { return m_eAlignment; }
00064     inline WT_Text_HAlign const& operator=( WT_HAlign& eAlign ) { m_eAlignment = eAlign; return *this; }
00065 
00066     // WT_Attribute virtual methods
00067     WT_Boolean operator==(WT_Attribute const & attrib) const;
00068 
00069     // WT_Object virtual methods
00070     WT_Result      materialize(WT_Opcode const & opcode, WT_File & file);
00071     WT_ID          object_id() const;
00072     WT_Result      process(WT_File & file);
00073     WT_Result      serialize(WT_File & file) const;
00074     WT_Result      skip_operand(WT_Opcode const & opcode, WT_File & file);
00075     WT_Result      sync(WT_File &) const;
00076     // provide a default action handler for this object
00077     static WT_Result default_process(
00078         WT_Text_HAlign & item, // The object to process.
00079         WT_File & file         // The file being read.
00080         );
00081 protected:
00082      // static methods
00083     static const char*     enum_to_string(WT_HAlign eVAlign);
00084     static WT_Boolean      string_to_enum(const char* pStr, WT_HAlign& outEnum);
00085 
00086 private:
00087     // data members
00088     WT_HAlign m_eAlignment;
00089 
00090 private:
00091     // const char strings
00092     static const char* str_HAlign_Left;
00093     static const char* str_HAlign_Right;
00094     static const char* str_HAlign_Center;
00095 
00096 };
00097 
00098 
00099 #endif //TEXT_HALIGN_HEADER
00100 // endif

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5