"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/src/include/elementstyle.h" (12 May 2020, 3365 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "elementstyle.h": 3.53_vs_3.54.

    1 /***************************************************************************
    2                           elementstyle.h  -  description
    3                              -------------------
    4     begin                : Son Nov 10 2002
    5     copyright            : (C) 2002-2007 by Andre Simon
    6     email                : a.simon@mailbox.org
    7  ***************************************************************************/
    8 
    9 
   10 /*
   11 This file is part of Highlight.
   12 
   13 Highlight is free software: you can redistribute it and/or modify
   14 it under the terms of the GNU General Public License as published by
   15 the Free Software Foundation, either version 3 of the License, or
   16 (at your option) any later version.
   17 
   18 Highlight is distributed in the hope that it will be useful,
   19 but WITHOUT ANY WARRANTY; without even the implied warranty of
   20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   21 GNU General Public License for more details.
   22 
   23 You should have received a copy of the GNU General Public License
   24 along with Highlight.  If not, see <http://www.gnu.org/licenses/>.
   25 */
   26 
   27 
   28 #ifndef ELEMENTSTYLE_H
   29 #define ELEMENTSTYLE_H
   30 
   31 #include "stylecolour.h"
   32 
   33 using namespace std;
   34 
   35 namespace highlight
   36 {
   37 
   38 /** \brief The class stores the basic text formatting properties.
   39 
   40 * @author Andre Simon
   41 */
   42 
   43 class ElementStyle
   44 {
   45 public:
   46 
   47     /** Constructor
   48         \param col Style colour
   49         \param b Bold flag
   50         \param i Italic flag
   51         \param u Underline flag */
   52     ElementStyle ( const Colour& col, bool b, bool i, bool u );
   53 
   54     /** Constructor
   55          \param elementStyleString String with formatting information (eg "00 aa ff bold") */
   56     ElementStyle ( const string & elementStyleString );
   57 
   58     /** Constructor */
   59     ElementStyle();
   60 
   61     /**copy constructor */
   62     ElementStyle ( const ElementStyle &other )
   63     {
   64         colour = other.getColour();
   65         bold = other.isBold();
   66         italic = other.isItalic();
   67         underline = other.isUnderline();
   68     }
   69 
   70     /** operator overloading */
   71     ElementStyle& operator= ( const ElementStyle &other )
   72     {
   73         colour = other.getColour();
   74         bold = other.isBold();
   75         italic = other.isItalic();
   76         underline = other.isUnderline();
   77         return *this;
   78     }
   79 
   80     ~ElementStyle();
   81 
   82     /** initialize object
   83         \param elementStyleString String which contains formatting attributes
   84                (Format: "color attr" where
   85                 color can be HTML hex notation or a hex RGB tuple (ie "#2244ff" or "22 44 ff")
   86                 attr can be a combination of "italic, "bold" and "underline")
   87     */
   88     void set ( const string & elementStyleString );
   89 
   90     /** \return True if italic */
   91     bool isItalic() const;
   92 
   93     /** \return True if bold */
   94     bool isBold() const;
   95 
   96     /** \return True if underline */
   97     bool isUnderline() const;
   98 
   99     /** \param b set italic flag */
  100     void setItalic ( bool b )
  101     {
  102         italic = b;
  103     }
  104 
  105     /** \param b set bold flag */
  106     void setBold ( bool b )
  107     {
  108         bold = b;
  109     }
  110 
  111     /** \param b set underline flag */
  112     void setUnderline ( bool b )
  113     {
  114         underline = b;
  115     }
  116 
  117     /** \return Element colour */
  118     Colour getColour() const;
  119 
  120     /** \param col colour of this element */
  121     void setColour (const Colour& col )
  122     {
  123         colour = col;
  124     }
  125 
  126 private:
  127     Colour colour;
  128     bool bold, italic, underline;
  129 };
  130 
  131 }
  132 
  133 #endif