00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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 namespace bg_wnd {
00023
00024 struct res_info
00025 {
00026 static HINSTANCE module_handle()
00027 {
00028 return GetModuleHandle(NULL);
00029 }
00030
00031 res_info(unsigned nResource, unsigned uType, int cx = 0, int cy = 0,
00032 unsigned fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, HINSTANCE hInst = module_handle());
00033 res_info(const char* pchResource, unsigned uType, int cx = 0, int cy = 0,
00034 unsigned fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, HINSTANCE hInst = module_handle());
00035
00036 const char* pchResource_;
00037 unsigned uType_;
00038 int cx_;
00039 int cy_;
00040 unsigned fuLoad_;
00041 HINSTANCE hInst_;
00042 };
00043
00044 }
00045
00046
00047
00048 namespace detail {
00049
00050 struct resource_painter_base : painter_base
00051 {
00052 typedef const bg_wnd::res_info& param0;
00053
00054
00055 resource_painter_base(const bg_wnd::res_info& info);
00056 resource_painter_base(const resource_painter_base& p);
00057 virtual ~resource_painter_base();
00058 const resource_painter_base& operator= (const resource_painter_base& p);
00059
00060 void load_resource(const bg_wnd::res_info& info);
00061 SIZE resource_size() const;
00062
00063 protected:
00064 void draw_resource(HDC hDC, int x, int y, int cx, int cy);
00065
00066 private:
00067 void delete_resource();
00068
00069 HANDLE hResource_;
00070 unsigned uType_;
00071 };
00072
00073 }
00074
00075
00076
00077 class resource_painter : public detail::resource_painter_base
00078 {
00079 typedef detail::resource_painter_base Base;
00080
00081 public:
00082
00083 resource_painter(const bg_wnd::res_info& info);
00084
00085
00086 resource_painter* clone() const;
00087 void draw(HDC hDC, int cx, int cy);
00088 };
00089
00090
00091
00092 class tile_resource_painter : public detail::resource_painter_base
00093 {
00094 typedef detail::resource_painter_base Base;
00095 SIZE tile_size_;
00096
00097 public:
00098 typedef SIZE param1;
00099
00100
00101 tile_resource_painter(const bg_wnd::res_info& info);
00102 tile_resource_painter(const bg_wnd::res_info& info, SIZE tile_size);
00103
00104
00105 tile_resource_painter* clone() const;
00106 void draw(HDC hDC, int cx, int cy);
00107
00108
00109 void tile_size(SIZE tile_size);
00110 SIZE tile_size() const;
00111 };
00112
00113 } }