TNB Library
TnbWideLayout.h
[詳解]
1#pragma once
11#include "TnbRatioLayout.h"
12
13
14
15//TNB Library
16namespace TNB
17{
18
19
20
55{
56 DEFSUPER(CRatioLayout);
57public:
58
60 CWideLayout(void) : m_isReverse(false)
61 {
62 m_center[0] = 50;
63 m_center[1] = 50;
64 }
65
72 void SetCenter(bool isWide, DWORD parsent = 50)
73 {
74 m_center[isWide ? 1 : 0] = parsent;
75 }
76
81 void SetReverseMode(bool isReverse = false)
82 {
83 m_isReverse = isReverse;
84 }
85
91 virtual ILayout* Clone(void) const
92 {
93 CWideLayout* P = new CWideLayout();
94 *P = *this;
95 return P;
96 }
97
105 virtual bool GetMinimumSize(SIZE& _size) const
106 {
107 m_SetParameter();
108 return _super::GetMinimumSize(_size);
109 }
110
119 virtual void Decide(int x, int y, WPARAM wParam, LPARAM lParam)
120 {
121 m_SetParameter();
122 _super::Decide(x, y, wParam, lParam);
123 }
124
125private:
126 // パラメタ設定
127 void SetParameter(bool isHorizental, DWORD parsent)
128 {
129 _super::SetParameter(isHorizental, parsent);
130 }
131 // パラメタ設定
132 void m_SetParameter(void) const
133 {
134 bool r = m_IsWideMode();
135 CWideLayout* P = const_cast<CWideLayout*>(this); //constはがし
136 P->SetParameter(r, m_center[r ? 1 : 0]);
137 }
138 // true なら 横画面
139 bool m_IsWideMode(void) const
140 {
141 int nWidth = ::GetSystemMetrics(SM_CXSCREEN);
142 int nHeight = ::GetSystemMetrics(SM_CYSCREEN);
143 return (nHeight < nWidth) ^ (m_isReverse);
144 }
145 size_t m_center[2];
146 bool m_isReverse;
147};
148
149
150
151}; // TNB
レイアウト関係のヘッダ
比率レイアウトアイテムクラス.
ワイドレイアウトアイテムクラス.
Definition: TnbWideLayout.h:55
CWideLayout(void)
コンストラクタ
Definition: TnbWideLayout.h:60
virtual bool GetMinimumSize(SIZE &_size) const
[取得] 最小サイズ取得.
void SetReverseMode(bool isReverse=false)
[設定] リバース設定.
Definition: TnbWideLayout.h:81
virtual ILayout * Clone(void) const
[作成] クローン作成.
Definition: TnbWideLayout.h:91
virtual void Decide(int x, int y, WPARAM wParam, LPARAM lParam)
[処理] 決定.
void SetCenter(bool isWide, DWORD parsent=50)
[設定] 敷居変更.
Definition: TnbWideLayout.h:72
TNB Library
Definition: TnbDoxyTitle.txt:2
レイアウトインターフェース.
Definition: TnbLayout.h:34