Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Layout.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: Layout.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Layout Manager class for ActiveWindow panels
13 */
14 
15 #ifndef Layout_h
16 #define Layout_h
17 
18 #include "ActiveWindow.h"
19 
20 // +--------------------------------------------------------------------+
21 
22 class Layout
23 {
24 public:
25  static const char* TYPENAME() { return "Layout"; }
26 
27  Layout();
28  virtual ~Layout();
29 
30  virtual bool DoLayout(ActiveWindow* panel);
31 
32  virtual void Clear();
33  virtual void AddCol(DWORD min_width, float col_factor);
34  virtual void AddRow(DWORD min_height, float row_factor);
35 
36  virtual void SetConstraints(const std::vector<DWORD>& min_x,
37  const std::vector<DWORD>& min_y,
38  const std::vector<float>& weight_x,
39  const std::vector<float>& weight_y);
40 
41  virtual void SetConstraints(const std::vector<float>& min_x,
42  const std::vector<float>& min_y,
43  const std::vector<float>& weight_x,
44  const std::vector<float>& weight_y);
45 
46  virtual void SetConstraints(int ncols,
47  int nrows,
48  const int* min_x,
49  const int* min_y,
50  const float* weight_x,
51  const float* weight_y);
52 
53 
54 protected:
55  virtual void ScaleWeights();
56  virtual void CalcCells(DWORD w, DWORD h, std::vector<DWORD>& cell_x, std::vector<DWORD>& cell_y);
57 
58  std::vector<DWORD> cols;
59  std::vector<DWORD> rows;
60  std::vector<float> col_weights;
61  std::vector<float> row_weights;
62 };
63 
64 #endif Layout_h
65