Docking: Title update fixes

git-svn-id: svn://ultimatepp.org/upp/trunk@2403 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
mrjt 2010-05-17 10:39:47 +00:00
parent 57d4328721
commit 353bb06ba6
4 changed files with 26 additions and 4 deletions

View file

@ -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';

View file

@ -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;

View file

@ -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();

View file

@ -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);