Reenabled setting the window title. Changed things a bit, though: Each
session (tab) has it's own window title. Switching between them changes the window title, too. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25987 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5d2d3a845c
commit
6df054ee2f
@ -90,6 +90,7 @@ private:
|
||||
struct TermWindow::Session {
|
||||
int32 id;
|
||||
BString name;
|
||||
BString windowTitle;
|
||||
TermViewContainerView* containerView;
|
||||
|
||||
Session(int32 id, TermViewContainerView* containerView)
|
||||
@ -112,6 +113,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Select(int32 tab)
|
||||
{
|
||||
SmartTabView::Select(tab);
|
||||
fWindow->SessionChanged();
|
||||
}
|
||||
|
||||
virtual void RemoveAndDeleteTab(int32 index)
|
||||
{
|
||||
fWindow->_RemoveTab(index);
|
||||
@ -123,7 +130,10 @@ private:
|
||||
|
||||
|
||||
TermWindow::TermWindow(BRect frame, const char* title, Arguments *args)
|
||||
: BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
|
||||
:
|
||||
BWindow(frame, title, B_DOCUMENT_WINDOW,
|
||||
B_CURRENT_WORKSPACE | B_QUIT_ON_WINDOW_CLOSE),
|
||||
fInitialTitle(title),
|
||||
fTabView(NULL),
|
||||
fMenubar(NULL),
|
||||
fFilemenu(NULL),
|
||||
@ -165,6 +175,29 @@ TermWindow::~TermWindow()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::SetSessionWindowTitle(TermView* termView, const char* title)
|
||||
{
|
||||
int32 index = _IndexOfTermView(termView);
|
||||
if (Session* session = (Session*)fSessions.ItemAt(index)) {
|
||||
session->windowTitle = title;
|
||||
BTab* tab = fTabView->TabAt(index);
|
||||
tab->SetLabel(session->windowTitle.String());
|
||||
if (index == fTabView->Selection())
|
||||
SetTitle(session->windowTitle.String());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::SessionChanged()
|
||||
{
|
||||
int32 index = fTabView->Selection();
|
||||
if (Session* session = (Session*)fSessions.ItemAt(index))
|
||||
SetTitle(session->windowTitle.String());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::_InitWindow()
|
||||
{
|
||||
@ -664,6 +697,7 @@ TermWindow::_AddTab(Arguments *args)
|
||||
containerView, view);
|
||||
|
||||
Session* session = new Session(_NewSessionID(), containerView);
|
||||
session->windowTitle = fInitialTitle;
|
||||
fSessions.AddItem(session);
|
||||
|
||||
BTab *tab = new BTab;
|
||||
@ -898,6 +932,6 @@ CustomTermView::NotifyQuit(int32 reason)
|
||||
void
|
||||
CustomTermView::SetTitle(const char *title)
|
||||
{
|
||||
//Window()->SetTitle(title);
|
||||
dynamic_cast<TermWindow*>(Window())->SetSessionWindowTitle(this, title);
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,10 @@ public:
|
||||
TermWindow(BRect frame, const char* title, Arguments *args);
|
||||
virtual ~TermWindow();
|
||||
|
||||
void SetSessionWindowTitle(TermView* termView,
|
||||
const char* title);
|
||||
void SessionChanged();
|
||||
|
||||
protected:
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void WindowActivated(bool);
|
||||
@ -79,6 +83,7 @@ private:
|
||||
void _BuildWindowSizeMenu(BMenu *menu);
|
||||
int32 _NewSessionID();
|
||||
|
||||
BString fInitialTitle;
|
||||
BList fSessions;
|
||||
|
||||
TabView *fTabView;
|
||||
|
Loading…
Reference in New Issue
Block a user