| 1 |
#include "DbExplorerFrame.h" |
| 2 |
#include "DbViewerPanel.h" |
| 3 |
#include "codelite_events.h" |
| 4 |
#include "event_notifier.h" |
| 5 |
#include "globals.h" |
| 6 |
|
| 7 |
DbExplorerFrame::DbExplorerFrame(wxWindow* parent, wxWindow* page, const wxString& label, DbViewerPanel* viewer) |
| 8 |
: DbExplorerFrameBase(parent, wxID_ANY, label, wxDefaultPosition, wxSize(500, 500), |
| 9 |
wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT) |
| 10 |
, m_viewer(viewer) |
| 11 |
{ |
| 12 |
page->Reparent(this); |
| 13 |
GetSizer()->Add(page, 1, wxEXPAND); |
| 14 |
GetSizer()->Layout(); |
| 15 |
SetLabel(label); |
| 16 |
Bind(wxEVT_CLOSE_WINDOW, &DbExplorerFrame::OnClose, this); |
| 17 |
|
| 18 |
// If this instance does not exists, set the default size |
| 19 |
if(parent) { |
| 20 |
CentreOnParent(); |
| 21 |
} |
| 22 |
::clSetTLWindowBestSizeAndPosition(this); |
| 23 |
} |
| 24 |
|
| 25 |
DbExplorerFrame::~DbExplorerFrame() { Unbind(wxEVT_CLOSE_WINDOW, &DbExplorerFrame::OnClose, this); } |
| 26 |
|
| 27 |
void DbExplorerFrame::OnClose(wxCloseEvent& event) |
| 28 |
{ |
| 29 |
event.Skip(); |
| 30 |
m_viewer->RemoveFrame(this); |
| 31 |
} |