Ejemplo n.º 1
0
QuickOutlineDlg::QuickOutlineDlg(wxWindow* parent, const wxString &fileName, int id, wxString title, wxPoint pos, wxSize size, int style )
		: wxDialog( parent, id, title, pos, size, style|wxRAISED_BORDER )
		, m_fileName(fileName)
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );

	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxVERTICAL );
	m_textFilter = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0|wxNO_BORDER );
	m_textFilter->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
	bSizer1->Add( m_textFilter, 0, wxALL|wxEXPAND, 5 );
	m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	m_staticline1->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
	bSizer1->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );

	//build the outline view
	m_treeOutline = new CppSymbolTree( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxNO_BORDER);
	m_treeOutline->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
	m_treeOutline->SetSymbolsImages(CreateSymbolTreeImages());

	Connect(wxEVT_CMD_CPP_SYMBOL_ITEM_SELECTED, wxCommandEventHandler(QuickOutlineDlg::OnItemSelected), NULL, this);

	//no hidden root
	m_treeOutline->BuildTree(m_fileName);
	m_treeOutline->ExpandAll();

	bSizer1->Add( m_treeOutline, 1, wxALL|wxEXPAND, 5 );
	this->SetSizer( bSizer1 );
	this->Layout();
	Centre();
	m_textFilter->SetFocus();
}
Ejemplo n.º 2
0
QuickOutlineDlg::QuickOutlineDlg(
    wxWindow* parent, const wxString& fileName, int id, wxString title, wxPoint pos, wxSize size, int style)
    : wxDialog(parent, id, title, pos, size, style | wxRESIZE_BORDER)
    , m_fileName(fileName)
{
    wxBoxSizer* dialogSizer = new wxBoxSizer(wxVERTICAL);
    SetSizer(dialogSizer);
    wxPanel* mainPanel = new wxPanel(this);
    dialogSizer->Add(mainPanel, 1, wxEXPAND);
    wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
    mainPanel->SetSizer(mainSizer);

#ifdef __WXGTK__
    wxColour bgCol = DrawingUtils::GetPanelBgColour();
    wxColour fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
#else
    wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK);
    wxColour fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT);
#endif

    mainPanel->SetBackgroundColour(bgCol);

    // build the outline view
    m_treeOutline =
        new CppSymbolTree(mainPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE | wxNO_BORDER);
    m_keyboard.reset(new clTreeKeyboardInput(m_treeOutline));
    m_treeOutline->Bind(wxEVT_KEY_DOWN, &QuickOutlineDlg::OnKeyDown, this);
    m_treeOutline->SetBackgroundColour(bgCol);
    m_treeOutline->SetForegroundColour(fgCol);
    m_treeOutline->SetSymbolsImages(CreateSymbolTreeImages());

    Connect(wxEVT_CMD_CPP_SYMBOL_ITEM_SELECTED, wxCommandEventHandler(QuickOutlineDlg::OnItemSelected), NULL, this);
    mainSizer->Add(m_treeOutline, 1, wxALL | wxEXPAND, 5);
    
    Layout();
    SetName("QuickOutlineDlg");
    SetMinClientSize(wxSize(500,400));
    
    CentreOnParent();

    // no hidden root
    m_treeOutline->BuildTree(m_fileName);
    m_treeOutline->ExpandAll();
    m_treeOutline->SetFocus();
    // Fix bug on GTK3 and prevent the window to shrink
    // indefinitely
}