CtrlCore: Fixed issue with SetLayout_*

git-svn-id: svn://ultimatepp.org/upp/trunk@12716 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-01-25 13:59:22 +00:00
parent a1014a975f
commit e3c5691f96
4 changed files with 18 additions and 6 deletions

View file

@ -540,4 +540,16 @@ void ArrangeOKCancel(Ctrl& ok, Ctrl& cancel)
}
}
void SetLayout_Size(Ctrl& ctrl, Size sz)
{
sz = ctrl.AddFrameSize(sz);
ctrl.SetMinSize(sz);
ctrl.SetRect(sz);
}
void SetLayout_Size(Ctrl& ctrl, int cx, int cy)
{
SetLayout_Size(ctrl, Size(cx, cy));
}
}

View file

@ -193,6 +193,9 @@ void ArrangeOKCancel(Ctrl& ok, Ctrl& cancel);
int SwapOKCancel();
void SwapOKCancel_Write(int b);
void SetLayout_Size(Ctrl& ctrl, Size sz);
void SetLayout_Size(Ctrl& ctrl, int cx, int cy);
template <class L>
void InitLayout(Ctrl& ctrl, L& layout)
{
@ -202,9 +205,7 @@ void InitLayout(Ctrl& ctrl, L& layout)
template <class T>
void CtrlLayout(T& ctrl) {
InitLayout(ctrl, ctrl, ctrl, ctrl);
Size sz = ctrl.AddFrameSize(T::GetLayoutSize());
ctrl.SetMinSize(sz);
ctrl.SetRect(sz);
SetLayout_Size(ctrl, T::GetLayoutSize());
}
template <class T>

View file

@ -26,7 +26,7 @@
#undef ITEM
#undef END_LAYOUT
#define LAYOUT(nm, x, y) template<class T> inline void SetLayout_##nm(T& parent, bool add = false, bool show = false) {
#define LAYOUT(nm, x, y) template<class T> inline void SetLayout_##nm(T& parent, bool add = false, bool show = false) { SetLayout_Size(parent, x, y);
#define UNTYPED(var, param) parent.var.param; if(add) parent.Add(parent.var); if(show) parent.var.Show();
#define ITEM(clss, var, param) UNTYPED(var, param);
#define END_LAYOUT }
@ -38,7 +38,7 @@
#undef ITEM
#undef END_LAYOUT
#define LAYOUT(nm, x, y) template<class T, class D> inline void SetLayout_##nm(T& ctrl, D& parent, bool add = false, bool show = false) {
#define LAYOUT(nm, x, y) template<class T, class D> inline void SetLayout_##nm(T& ctrl, D& parent, bool add = false, bool show = false) { SetLayout_Size(parent, x, y);
#define UNTYPED(var, param) parent.var.param; if(add) ctrl.Add(parent.var); if(show) parent.var.Show();
#define ITEM(clss, var, param) UNTYPED(var, param);
#define END_LAYOUT }

View file

@ -297,7 +297,6 @@ void IconDes::InsertFile()
ml.Add(mm);
}
int ii = 0;
DDUMP(ml.GetCount());
for(Image m : ml) {
String id = Filter(GetFileTitle(fn), CharFilterImageId);
if(!IsAlpha(*id) && *id != '_')