Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# text_painter.hpp

    00001 // text_painter.hpp
    00002
    00003 // Copyright (C) 2004 Steven Weiß (steven11@gmx.de)
    00004 //
    00005 // Permission to copy, use, sell and distribute this software is granted
    00006 // provided this copyright notice appears in all copies.
    00007 // Permission to modify the code and to distribute modified code is granted
    00008 // provided this copyright notice appears in all copies, and a notice
    00009 // that the code was modified is included with the copyright notice.
    00010 //
    00011 // This software is provided "as is" without express or implied warranty,
    00012 // and with no claim as to its suitability for any purpose.
    00013
    00014
    00015 #pragma once
    00016 #include <background_wnd/detail/include.hpp>
    00017 #include <background_wnd/painter_base.hpp>
    00018
    00019
    00020 namespace win32 { namespace gui {
    00021
    00022 class text_painter : public painter_base
    00023 {
    00024 public:
    00025      // info structure needed to load the text_painter
    00026      struct font_info;
    00027
    00028      typedef const std::string& param0;
    00029      typedef const font_info& param1;
    00030
    00031      // c'tor
    00032      text_painter(const std::string& str, const font_info& info);
    00033
    00034      // virtual functions of painter_base
    00035      text_painter* clone() const;
    00036      void draw(HDC hDC, int cx, int cy);
    00037
    00038      // own functions
    00039      void text(const std::string& str);
    00040      std::string text() const;
    00041      void info(const font_info& info);
    00042      font_info info() const;
    00043      void draw_text_options(unsigned flags);
    00044      unsigned draw_text_options() const;
    00045      int last_used_text_height() const;
    00046
    00047      struct font_info
    00048      {
    00049           font_info(LOGFONT lf, int min_font_height, int max_font_height, COLORREF cr = RGB(0, 0, 0));
    00050
    00051           LOGFONT lf_;
    00052           int min_font_height_;    // FIX: negative font heights are possible!
    00053           int max_font_height_;
    00054           COLORREF cr_;
    00055      };
    00056
    00057 private:
    00058      font_info info_;
    00059      std::string  str_;
    00060      unsigned draw_text_options_;
    00061 };
    00062
    00063 } }  // namespace win32::gui

| by Steven Weiss. You can contact me at steven11@gmx.de.