#pragma once
|
|
#include <vector>
|
|
using namespace std;
|
|
typedef enum
|
{
|
LT_LayoutH = 1,
|
LT_LayoutV = 2,
|
LT_Window = 4,
|
LT_LayWinH = 5,
|
LT_LayWinV = 6
|
} LayoutType;
|
|
class Layout
|
{
|
public:
|
/************************************************************************/
|
// Layout ¹¹Ô캯Êý
|
// @param type LayoutÀàÐÍ£¬Layout¡¢Window¡¢LayoutWindow£¬ Layoutˮƽ»ò´¹Ö±¶þÑ¡Ò»
|
// @param pWndParent ¸¸´°¿Ú
|
//
|
// @param expandToFill ÊÇ·ñ¿ÉÒÔÀ©Õ¹ÒÔÌî³äÉϲãLayout¿Õ¼ä
|
//
|
// ͬһ¸ö¸¸LayoutµÄËùÓÐ×ÓLayoutÕ¼ÓõÄÈ«²¿¿Õ¼ä£¬
|
// ¼õÈ¥¹Ì¶¨´óСµÄ×ÓLayoutÕ¼ÓõÄÈ«²¿¿Õ¼ä£¬ÎªËùÓпÉÌî³ä×ÓLayoutµÄ¿ÉÌî³ä¿Õ¼ä£¬
|
// ³ýÒÔËùÓпÉÌî³ä×ÓLayoutµÄÈ«²¿·ÝÊý£¬¿ÉµÃµ½Ã¿Ò»·ÝµÄ³ß´ç£¬
|
// ÔÙ°´ÕÕÿ¸ö×ÓLayoutµÄ·ÝÊý¼ÆËãÆäËùÕ¼³ß´ç£¬»òÕß·ÇÌî³äʱµÄÕæʵ³ß´ç
|
//
|
// @param fillSpaceOrRealSize Ìî³äʱËùÕ¼¿Õ¼ä·ÝÊý£¬»ò·ÇÌî³äʱµÄÕæʵ³ß´ç
|
//
|
// @param wndID ´°¿Ú¿Ø¼þID,
|
//
|
// Èç¹ûÊÇWindowÀàÐÍ£¬¼õÈ¥OuterPaddingºóµÃµ½µÄ²ÅÊÇWindowÕæʵRect
|
//
|
// @param outerPaddingLeft
|
// @param outerPaddingRight
|
// @param outerPaddingUp
|
// @param outerPaddingDown
|
//
|
// Èç¹ûÊÇLayoutÀàÐÍ£¬×ÓLayoutÕ¼ÓõĿռ仹ÐèÔÙ¼õÈ¥InnerPadding
|
//
|
// @param innerPaddingLeft
|
// @param innerPaddingRight
|
// @param innerPaddingUp
|
// @param innerPaddingDown
|
/************************************************************************/
|
Layout(
|
LayoutType type ,
|
CWnd* pWndParent ,
|
|
bool expandToFill = true ,
|
int fillSpaceOrRealSize = 1,
|
|
int wndID = 0,
|
|
int outerPaddingLeft = 0 ,
|
int outerPaddingRight = 0 ,
|
|
int outerPaddingUp = 0 ,
|
int outerPaddingDown = 0 ,
|
|
int innerPaddingLeft = 0 ,
|
int innerPaddingRight = 0 ,
|
|
int innerPaddingUp = 0 ,
|
int innerPaddingDown = 0);
|
|
~Layout();
|
|
/************************************************************************/
|
// ´°¿Ú´óС¸üÐÂ
|
// @param w д°¿Ú¿í¶È
|
// @param h д°¿Ú¸ß¶È
|
/************************************************************************/
|
void UpdateSize(int w , int h);
|
|
/************************************************************************/
|
// Layout Ìí¼Ó×ÓLayout, ×ÓLayoutµÄ¸¸´°¿Úͬ¸¸Layout
|
// @param type LayoutÀàÐÍ£¬Layout¡¢Window¡¢LayoutWindow£¬ Layoutˮƽ»ò´¹Ö±¶þÑ¡Ò»
|
//
|
// @param expandToFill ÊÇ·ñ¿ÉÒÔÀ©Õ¹ÒÔÌî³äÉϲãLayout¿Õ¼ä
|
// @param fillSpaceOrRealSize Ìî³äʱËùÕ¼¿Õ¼ä·ÝÊý£¬»òÕß·ÇÌî³äʱµÄÕæʵ³ß´ç
|
//
|
// @param wndID ´°¿Ú¿Ø¼þID,
|
//
|
// Èç¹ûÊÇWindowÀàÐÍ£¬¼õÈ¥OuterPaddingºóµÃµ½µÄ²ÅÊÇWindowÕæʵRect
|
//
|
// @param outerPaddingLeft
|
// @param outerPaddingRight
|
// @param outerPaddingUp
|
// @param outerPaddingDown
|
//
|
// Èç¹ûÊÇLayoutÀàÐÍ£¬×ÓLayoutÕ¼ÓõĿռ仹ÐèÔÙ¼õÈ¥InnerPadding
|
//
|
// @param innerPaddingLeft
|
// @param innerPaddingRight
|
// @param innerPaddingUp
|
// @param innerPaddingDown
|
/************************************************************************/
|
Layout* AddChild(
|
LayoutType type ,
|
|
bool expandToFill = true,
|
int fillSpaceOrRealSize = 1,
|
|
int wndID = 0,
|
|
int outerPaddingLeft = 5 ,
|
int outerPaddingRight = 5 ,
|
|
int outerPaddingUp = 3 ,
|
int outerPaddingDown = 3 ,
|
|
int innerPaddingLeft = 0 ,
|
int innerPaddingRight = 0 ,
|
|
int innerPaddingUp = 0 ,
|
int innerPaddingDown = 0);
|
|
int m_x;
|
int m_y;
|
int m_width;
|
int m_height;
|
|
|
bool m_bExpandToFill;
|
int m_FillSpaceOrRealSize;
|
private:
|
LayoutType m_type;
|
|
CWnd* m_pWndParent;
|
int m_wndID;
|
|
vector<Layout*> m_children;
|
|
int m_outerPaddingUp;
|
int m_outerPaddingLeft;
|
int m_outerPaddingDown;
|
int m_outerPaddingRight;
|
|
int m_innerPaddingUp;
|
int m_innerPaddingLeft;
|
int m_innerPaddingDown;
|
int m_innerPaddingRight;
|
|
void UpdateLayout();
|
void UpdateLayoutH();
|
void UpdateLayoutV();
|
void UpdateWindow();
|
};
|