Initial commit
[forms.git] / F / F_Text_Symbol_Region.H
blobcd3af3db1474bc5f7beca0cd064c46d90a3e3403
2 #ifndef _F_TEXT_SYMBOL_REGION_H_
3 #define _F_TEXT_SYMBOL_REGION_H_
5 #include <F_Types.H>
6 #include <F_Text_Symbol.H>
7 #include <F_Point.H>
8 #include <F_Rect.H>
9 #include <F_Region.H>
10 #include <F_Text_Symbol_Buffer.H>
11 #include <F_Log.H>
12 #include <cc++/thread.h>
14 namespace F {
16 class F_Text_Symbol_Region : public F_Region {
18  protected:
19   // TODO: ÒÁÚÒÁÂÏÔÁÔØ thread safe type-independent template [get/set (?!)]
20   ost::Mutex m_;
22  public:
23   // draw buffer for widget
24   F_Text_Symbol_Buffer draw_buf, back_buf;
26   inline void lock() { m_.enterMutex(); }
27   inline void unlock() { m_.leaveMutex(); }
29  private:
31   F_Text_Symbol_Region(const F_Text_Symbol_Region &r) :
32     F_Region(r.w(), r.h()), draw_buf(r.w(), r.h()),
33       back_buf(r.w(), r.h()) { trace_bug(); }
34   // operator=
36  public:
38   F_Text_Symbol_Region(F_Point &lu, F_Rect &r) : F_Region(lu, r),
39     draw_buf(r), back_buf(r) { }
40   F_Text_Symbol_Region(dim_t w, dim_t h) : F_Region(w, h),
41     draw_buf(w, h), back_buf(w, h) { }
42   F_Text_Symbol_Region(coord_t x, coord_t y, dim_t w, dim_t h) :
43     F_Region(x, y, w, h), draw_buf(w, h), back_buf(w, h) { }
44   void resize(dim_t w_, dim_t h_) {
45     lock();
46     w(w_);
47     h(h_);
48     draw_buf.resize(w_, h_);
49     back_buf.resize(w_, h_);
50     unlock();
51   }
52   ~F_Text_Symbol_Region() { }
53  };
56 #endif