scrollAreaComponent.h

Go to the documentation of this file.
00001 #ifndef SCROLL_AREA_COMPONENT_H
00002 #define SCROLL_AREA_COMPONENT_H
00003 
00013 #include "ttfDraw.h"
00014 #include "typeUtils.h"
00015 #include "sdlWindow.h"
00016 #include <stdarg.h>
00017 #include <deque>
00018 
00019 
00025 class ScrollAreaComponent : public ComponentInterface {
00026   enum { InvalidEndl = -1 };
00027 
00028   TTF_Draw& ttf;
00029   int px_size;
00030   typedef struct {
00031     unsigned long fore;
00032     unsigned long back;
00033   } colors_t;
00034   colors_t set_color;
00035   VXV::Rect draw_rect;
00036   typedef struct {
00037     Uint16 ch;
00038     char width;
00039     colors_t color;
00040   } draws_t;
00041   std::deque<draws_t> texts;
00042 
00043   VXV::Grid drawChar(draws_t& dch,
00044                      const VXV::Grid& position, VXV::Grid& cursor);
00045   void setCh(const Uint16 ch, int width = 1);
00046   void createEndl(VXV::Grid& cursor, int& first_endl,
00047                   std::deque<draws_t>::iterator& it);
00048 
00049 public:
00050   ScrollAreaComponent(TTF_Draw& ttfObj, const VXV::Rect& drawRect);
00051   ~ScrollAreaComponent(void);
00052   bool draw(unsigned long ticks, const UserInput& ui);
00053 
00054   void setColor(unsigned long color, unsigned long back = Gray4);
00055   void setPxelSize(int pxelSize);
00056 
00057   // 扱えるのは 1byte 文字のみ
00058   int printf(const char *fmt, ...);
00059   int printf(const char *fmt, va_list ap);
00060   void drawUnicode(const Uint16* text);
00061   void clear(void);
00062 };
00063 
00064 #endif /* !SCROLL_AREA_COMPONENT_H */
00065 

Generated on Mon Apr 13 22:52:02 2009 by  doxygen 1.5.7.1