Tyro/src/widgets/TabContainer.cpp

48 lines
859 B
C++
Raw Normal View History

/**
* Wrapper around wxAuiNotebook
*/
#include "TabContainer.h"
static unsigned long untitled_document_count = 0;
TabContainer::TabContainer(
wxWindow* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style
) : wxAuiNotebook(parent, id, pos, size, style)
{
this->AddTab();
}
TabContainer::~TabContainer() {}
void TabContainer::AddTab()
{
untitled_document_count++;
wxString caption;
caption.Printf("Untitled %lu", untitled_document_count);
2015-04-09 11:45:19 -04:00
EditPane *editor = new EditPane(this, wxID_ANY);
this->AddPage(editor, caption);
}
void TabContainer::AddTab(wxString filePath)
{
wxString caption=filePath;
2015-04-09 11:45:19 -04:00
EditPane *editor = new EditPane(this, wxID_ANY);
editor->LoadFile(filePath);
2015-04-09 11:45:19 -04:00
this->AddPage(editor, caption);
}
2015-04-09 13:27:30 -04:00
EditPane *TabContainer::GetCurrentEditor()
2015-04-09 11:45:19 -04:00
{
2015-04-09 13:27:30 -04:00
return (EditPane *) this->GetCurrentPage();
2015-04-09 11:45:19 -04:00
}