Docking: fix all red formating warnings for DockCont and DockableCtrl.

This commit is contained in:
Zbigniew Rębacz 2026-02-15 11:19:40 +01:00
parent 6aa7ec52f9
commit ce2ed1a301
4 changed files with 278 additions and 283 deletions

View file

@ -19,16 +19,10 @@ void ImgButton::Paint(Draw &w)
// DockContHandle frame
int DockCont::DockContHandle::GetHandleSize(const DockableCtrl::Style& s) const
{
return (IsNull(s.title_font) ? DPI(12) : s.title_font.GetCy() + DPI(2))
+ (s.handle_vert ? s.handle_margins.GetWidth() : s.handle_margins.GetHeight());
return (IsNull(s.title_font) ? DPI(12) : s.title_font.GetCy() + DPI(2)) +
(s.handle_vert ? s.handle_margins.GetWidth() : s.handle_margins.GetHeight());
}
/*
void DockCont::DockContHandle::RefreshFocus(bool _focus)
{
if (focus != _focus)
{ focus = _focus; Refresh(); }
}
*/
void DockCont::DockContHandle::FrameLayout(Rect& r)
{
if (!dc || !IsShown()) return;
@ -270,6 +264,7 @@ void DockCont::TabContext(int ix)
MenuBar bar;
DockContMenu menu(base);
DockMenu tabmenu(base);
if (ix >= 0) {
Value v = tabbar.GetKey(ix);
if (IsDockCont(v))
@ -656,7 +651,8 @@ DockableCtrl * DockCont::Get0(int ix) const
WString DockCont::GetTitle(bool force_count) const
{
if((IsTabbed() || force_count) && tabbar.GetCount() > 1)
return (WString)Format("%s (%d/%d)", GetCurrent().GetTitle(), tabbar.GetCursor()+1, tabbar.GetCount());
return (WString)Format("%s (%d/%d)", GetCurrent().GetTitle(), tabbar.GetCursor() + 1,
tabbar.GetCount());
return GetCurrent().GetTitle();
}

View file

@ -25,11 +25,6 @@ public:
virtual void ChildAdded(Ctrl *child);
virtual bool Key(dword key, int count);
/* virtual void ChildGotFocus() { handle.RefreshFocus(true); TopWindow::ChildGotFocus(); }
virtual void ChildLostFocus() { handle.RefreshFocus(HasFocusDeep()); TopWindow::ChildLostFocus(); }
virtual void GotFocus() { handle.RefreshFocus(true); }
virtual void LostFocus() { handle.RefreshFocus(HasFocusDeep()); } */
public:
enum DockState {
STATE_NONE = -1,
@ -69,18 +64,17 @@ private:
Callback WhenContext;
Callback WhenLeftDrag;
Callback WhenLeftDouble;
DockContHandle() { dc = NULL; /*focus = false;*/ }
DockContHandle() { dc = NULL; }
DockableCtrl *dc;
// bool focus;
virtual void FrameLayout(Rect& r);
virtual void FrameAddSize(Size& sz);
virtual void Paint(Draw& w);
virtual void LeftDrag(Point p, dword keyflags) { /*RefreshFocus(true);*/ WhenLeftDrag(); }
virtual void LeftDouble(Point p, dword keyflags) { /*RefreshFocus(true);*/ WhenLeftDouble(); }
virtual void RightDown(Point p, dword keyflags) { /*RefreshFocus(true);*/ WhenContext(); }
virtual void LeftDrag(Point p, dword keyflags) { WhenLeftDrag(); }
virtual void LeftDouble(Point p, dword keyflags) { WhenLeftDouble(); }
virtual void RightDown(Point p, dword keyflags) { WhenContext(); }
//void RefreshFocus(bool _focus);
int GetHandleSize(const DockableCtrl::Style& s) const;
};
@ -102,6 +96,7 @@ private:
void TabClosed0(Value v);
void TabClosed(Value v);
void TabsClosed(ValueArray vv);
// Menus/Buttons
void Float();
void Dock(int align);
@ -129,6 +124,7 @@ private:
Ctrl* GetCtrl(int ix) const { return CtrlCast(tabbar.GetKey(ix)); }
static Value ValueCast(DockableCtrl *dc) { return RawToValue<DockableCtrl *>(dc); }
static Value ValueCast(DockCont *dc) { return RawToValue<DockCont *>(dc); }
public:
void SetCursor(int ix) { tabbar.SetCursor(ix); TabSelected(); }
void SetCursor(Ctrl& c);

View file

@ -18,8 +18,9 @@ DockableCtrl& DockableCtrl::Set(const Image& _icon, const char *_title, String
bool DockableCtrl::IsHotKey(dword key)
{
return (keycode == key || (keyinfo &&
(key == keyinfo().key[0] || key == keyinfo().key[1] || key == keyinfo().key[2] || key == keyinfo().key[3])));
return (keycode == key ||
(keyinfo && (key == keyinfo().key[0] || key == keyinfo().key[1] ||
key == keyinfo().key[2] || key == keyinfo().key[3])));
}
DockableCtrl& DockableCtrl::SizeHint(const Size& min, const Size& max, const Size& std)

View file

@ -38,8 +38,10 @@ private:
const Style *style;
void StopHighlight() { Refresh(); }
protected:
DockCont *GetContainer() const;
public:
Callback1<Bar&> WhenMenuBar;
Callback WhenState;