diff --git a/bazaar/Docking/DockCont.cpp b/bazaar/Docking/DockCont.cpp index f5dd7e3e7..bc88c0217 100644 --- a/bazaar/Docking/DockCont.cpp +++ b/bazaar/Docking/DockCont.cpp @@ -444,14 +444,16 @@ void DockCont::RestoreCurrent() void DockCont::AddFrom(DockCont& cont, int except) { bool all = except < 0 || except >= cont.GetCount(); + int ix = GetCount(); for (int i = cont.GetCount() - 1; i >= 0; i--) if (i != except) { Ctrl *c = cont.GetCtrl(i); c->Remove(); Add(*c); - } + } if (all) cont.tabbar.Clear(); + SignalStateChange(ix, GetCount()-1); } void DockCont::Clear() @@ -494,7 +496,12 @@ void DockCont::State(DockWindow& dock, DockCont::DockState state) void DockCont::SignalStateChange() { - for (int i = tabbar.GetCount()-1; i >= 0; i--) { + SignalStateChange(GetCount()-1, 0); +} + +void DockCont::SignalStateChange(int from, int to) +{ + for (int i = to; i >= from; i--) { if (IsDockCont(tabbar.GetKey(i))) ContCast(tabbar.GetKey(i))->SignalStateChange(); else @@ -716,6 +723,14 @@ WString DockCont::GetTitle(bool force_count) const return GetCurrent().GetTitle(); } +void DockCont::ChildTitleChanged() +{ + tabbar.SyncRepos(); + if (!GetParent()) + Title(GetTitle()); + RefreshFrame(); +} + void DockCont::Serialize(Stream& s) { int ctrl = 'D'; diff --git a/bazaar/Docking/DockCont.h b/bazaar/Docking/DockCont.h index bf1bee3fe..925ccd4e5 100644 --- a/bazaar/Docking/DockCont.h +++ b/bazaar/Docking/DockCont.h @@ -185,6 +185,7 @@ public: void SyncFrames(); void SyncFrames(bool hidehandle); void SignalStateChange(); + void SignalStateChange(int from, int to); void Grouping(bool grouping) { tabbar.Grouping(grouping); GroupRefresh(); } void GroupRefresh(); @@ -203,6 +204,7 @@ public: void SyncUserSize(bool h, bool v); WString GetTitle(bool force_count = false) const; + void ChildTitleChanged(); bool IsDockAllowed(int align, int dc_ix = -1) const; diff --git a/bazaar/Docking/DockableCtrl.cpp b/bazaar/Docking/DockableCtrl.cpp index d97f6e34f..82a1bcc32 100644 --- a/bazaar/Docking/DockableCtrl.cpp +++ b/bazaar/Docking/DockableCtrl.cpp @@ -29,6 +29,11 @@ DockableCtrl& DockableCtrl::SizeHint(const Size& min, const Size& max, const Si return *this; } +DockableCtrl& DockableCtrl::Title(const WString& _title) +{ + title = _title; if (GetContainer()) GetContainer()->ChildTitleChanged(); return *this; +} + bool DockableCtrl::IsFloating() const { DockCont *c = GetContainer(); diff --git a/bazaar/Docking/DockableCtrl.h b/bazaar/Docking/DockableCtrl.h index 015a02e58..93b2bf5a4 100644 --- a/bazaar/Docking/DockableCtrl.h +++ b/bazaar/Docking/DockableCtrl.h @@ -54,8 +54,8 @@ public: const Image& GetIcon() { return icon; } DockableCtrl& Icon(const Image& m) { icon = m; return *this; } - DockableCtrl& Title(const char *_title) { title = _title; if (GetParent()) GetParent()->RefreshFrame(); return *this; } - DockableCtrl& Title(const WString& _title) { title = _title; if (GetParent()) GetParent()->RefreshFrame(); return *this; } + DockableCtrl& Title(const char *_title) { return Title((WString)_title); } + DockableCtrl& Title(const WString& _title); const WString& GetTitle() { return title; } DockableCtrl& Set(const Image& icon, const char *_title, String group = Null);