foobar2000 SDK  2015-01-14
CDialogResizeHelper.h
Go to the documentation of this file.
2 public:
4 
5  struct Param {
8  };
9 private:
10  void AddSizeGrip();
11 public:
12  inline void set_min_size(unsigned x,unsigned y) {min_x = x; min_y = y;}
13  inline void set_max_size(unsigned x,unsigned y) {max_x = x; max_y = y;}
14 
15 
17  if (uMsg == WM_INITDIALOG) OnInitDialog(hWnd);
19  MSG_WM_DESTROY(OnDestroy)
20  MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
21  END_MSG_MAP()
22 
23  template<typename TParam, t_size paramCount> CDialogResizeHelper(const TParam (& src)[paramCount],CRect const& minMaxRange = CRect(0,0,0,0)) {
24  InitTable(src, paramCount);
25  InitMinMax(minMaxRange);
26  }
27 
28  void InitTable(const Param* table, t_size tableSize);
29  void InitTable(const ParamOld * table, t_size tableSize);
30  void InitMinMax(const CRect & range);
31 
32  bool EvalRect(UINT id, CRect & out) const;
33 
34 private:
35  bool _EvalRect(t_size index, CSize wndSize, CRect & out) const;
36  void OnGetMinMaxInfo(LPMINMAXINFO lpMMI) const;
37  void OnSize(UINT nType, CSize size);
38  void OnInitDialog(CWindow thisWnd);
39  void OnDestroy();
40 
45  unsigned min_x,min_y,max_x,max_y;
46 };
47 
48 template<typename TTracker> class CDialogResizeHelperTracking : public CDialogResizeHelper {
49 public:
50  template<typename TParam, t_size paramCount, typename TCfgVar> CDialogResizeHelperTracking(const TParam (& src)[paramCount],CRect const& minMaxRange, TCfgVar & cfgVar) : CDialogResizeHelper(src, minMaxRange), m_tracker(cfgVar) {}
51 
53  CHAIN_MSG_MAP(CDialogResizeHelper)
54  CHAIN_MSG_MAP_MEMBER(m_tracker)
55  END_MSG_MAP()
56 
57 private:
58  TTracker m_tracker;
59 };
60 
63 
64 #define REDRAW_DIALOG_ON_RESIZE() if (uMsg == WM_SIZE) RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN);
void set_min_size(unsigned x, unsigned y)
pfc::map_t< UINT, CRect > m_origRects
bool EvalRect(UINT id, CRect &out) const
void InitMinMax(const CRect &range)
CDialogResizeHelperTracking(const TParam(&src)[paramCount], CRect const &minMaxRange, TCfgVar &cfgVar)
void OnGetMinMaxInfo(LPMINMAXINFO lpMMI) const
bool _EvalRect(t_size index, CSize wndSize, CRect &out) const
pfc::array_t< Param > m_table
size_t t_size
Definition: int_types.h:48
void set_max_size(unsigned x, unsigned y)
void InitTable(const Param *table, t_size tableSize)
void OnSize(UINT nType, CSize size)
dialog_resize_helper::param ParamOld
void OnInitDialog(CWindow thisWnd)
MSG_WM_SIZE(OnSize) MSG_WM_DESTROY(OnDestroy) MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo) END_MSG_MAP() template< typename TParam
BEGIN_MSG_MAP_EX(CDialogResizeHelper) if(uMsg
uint32_t t_uint32
Definition: int_types.h:5