⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sectiondlg.cpp

📁 ecos实时嵌入式操作系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//####COPYRIGHTBEGIN####//// ----------------------------------------------------------------------------// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.//// This program is part of the eCos host tools.//// This program is free software; you can redistribute it and/or modify it// under the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 of the License, or (at your option)// any later version.//// This program is distributed in the hope that it will be useful, but WITHOUT// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for// more details.//// You should have received a copy of the GNU General Public License along with// this program; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.//// ----------------------------------------------------------------------------////####COPYRIGHTEND####// sectiondlg.cpp :////===========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):   julians// Contact(s):  julians// Date:        2000/09/27// Version:     $Id: sectiondlg.cpp,v 1.2 2001/03/15 17:33:45 julians Exp $// Purpose:// Description: Implementation file for ecSectionDialog// Requires:// Provides:// See also:// Known bugs:// Usage:////####DESCRIPTIONEND####////===========================================================================#ifdef __GNUG__    #pragma implementation "sectiondlg.cpp"#endif#include "ecpch.h"#ifdef __BORLANDC__    #pragma hdrstop#endif#include "wx/notebook.h"#include "wx/cshelp.h"#include "sectiondlg.h"#include "configtool.h"/* * Settings dialog */IMPLEMENT_CLASS(ecSectionDialog, wxDialog)BEGIN_EVENT_TABLE(ecSectionDialog, wxDialog)    EVT_BUTTON(wxID_OK, ecSectionDialog::OnOK)    EVT_BUTTON(wxID_CANCEL, ecSectionDialog::OnCancel)    EVT_BUTTON(wxID_HELP, ecSectionDialog::OnHelp)    EVT_BUTTON(wxID_APPLY, ecSectionDialog::OnApply)    EVT_NOTEBOOK_PAGE_CHANGED(-1, ecSectionDialog::OnPageChange)END_EVENT_TABLE()#define PROPERTY_DIALOG_WIDTH   400#define PROPERTY_DIALOG_HEIGHT  380// For 400x400 settings dialog, size your panels to about 375x325 in dialog editor// (209 x 162 dialog units)ecSectionDialog::ecSectionDialog(wxWindow* parent):    wxDialog(){    SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);    wxDialog::Create(parent, ecID_SECTION_DIALOG, _("Section Properties"), wxPoint(0, 0), wxSize(PROPERTY_DIALOG_WIDTH, PROPERTY_DIALOG_HEIGHT));    // Under MSW, we don't seem to be able to react to a click on the dialog background (no    // event is generated).    SetHelpText(_("TODO"));    wxScreenDC dc;    wxSize ppi = dc.GetPPI();    //double scaleFactor = ((double) charH) / 13.0;    double scaleFactor = ((double) ppi.y) / 96.0;    // Fudge the scale factor to make the dialog slightly smaller,    // otherwise it's a bit big. (We're assuming that most displays    // are 96 or 120 ppi).    if (ppi.y == 120)        scaleFactor = 1.14;    int dialogWidth = (int)(PROPERTY_DIALOG_WIDTH * scaleFactor);    int dialogHeight = (int)(PROPERTY_DIALOG_HEIGHT * scaleFactor);    SetSize(dialogWidth, dialogHeight);            m_notebook = new wxNotebook(this, ecID_SETTINGS_NOTEBOOK,         wxPoint(2, 2), wxSize(PROPERTY_DIALOG_WIDTH - 4, PROPERTY_DIALOG_HEIGHT - 4));    m_general = new ecSectionGeneralDialog(m_notebook);    m_notebook->AddPage(m_general, wxT("General"));    m_general->TransferDataToWindow();    m_relocation = new ecSectionRelocationDialog(m_notebook);    m_notebook->AddPage(m_relocation, wxT("Relocation"));    m_relocation->TransferDataToWindow();    m_note = new ecSectionNoteDialog(m_notebook);    m_notebook->AddPage(m_note, wxT("Note"));    m_note->TransferDataToWindow();    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );    item0->Add( m_notebook, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );    wxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );    wxButton *okButton = new wxButton( this, wxID_OK, "&OK", wxDefaultPosition, wxDefaultSize, 0 );    item1->Add( okButton, 0, wxALIGN_CENTRE|wxALL, 5 );    wxButton *cancelButton = new wxButton( this, wxID_CANCEL, "&Cancel", wxDefaultPosition, wxDefaultSize, 0 );    item1->Add( cancelButton, 0, wxALIGN_CENTRE|wxALL, 5 );    wxButton *applyButton = new wxButton( this, wxID_APPLY, "&Apply", wxDefaultPosition, wxDefaultSize, 0 );    item1->Add( applyButton, 0, wxALIGN_CENTRE|wxALL, 5 );    wxButton *helpButton = new wxButton( this, wxID_HELP, "&Help", wxDefaultPosition, wxDefaultSize, 0 );    item1->Add( helpButton, 0, wxALIGN_CENTRE|wxALL, 5 );#ifdef __WXGTK__    // Context-sensitive help button (question mark)    wxButton *contextButton = new wxContextHelpButton( this );    item1->Add( contextButton, 0, wxALIGN_CENTRE|wxALL, 5 );#endif    // Necessary to add a spacer or the button highlight interferes with the notebook under wxGTK    item0->Add( 4, 4, 0, wxALIGN_CENTRE|wxALL, 0 );    item0->Add( item1, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0 );    this->SetAutoLayout( TRUE );    this->SetSizer( item0 );    okButton->SetDefault();    okButton->SetFocus();    Layout();    m_general->Layout();    m_relocation->Layout();    m_note->Layout();    okButton->SetHelpText(_("Closes the dialog and saves any changes you may have made."));    cancelButton->SetHelpText(_("Closes the dialog without saving any changes you have made."));    helpButton->SetHelpText(_("Invokes help for the selected dialog."));    applyButton->SetHelpText(_("Immediately applies any changes you may have made."));    Centre(wxBOTH);}void ecSectionDialog::OnOK(wxCommandEvent& event){    wxDialog::OnOK(event);}void ecSectionDialog::OnCancel(wxCommandEvent& event){    wxDialog::OnCancel(event);}void ecSectionDialog::OnApply(wxCommandEvent& event){}void ecSectionDialog::OnHelp(wxCommandEvent& event){    int sel = m_notebook->GetSelection();    wxASSERT_MSG( (sel != -1), wxT("A notebook tab should always be selected."));    wxWindow* page = (wxWindow*) m_notebook->GetPage(sel);    wxString helpTopic;    if (page == m_general)    {        helpTopic = wxT("General section dialog");    }    if (!helpTopic.IsEmpty())    {        wxGetApp().GetHelpController().KeywordSearch(helpTopic);    }}// This sets the text for the selected page, but doesn't help// when trying to click on a tab: we would expect the appropriate help// for that tab. We would need to look at the tabs to do this, from within OnContextHelp -// probably not worth it.void ecSectionDialog::OnPageChange(wxNotebookEvent& event){    event.Skip();    int sel = m_notebook->GetSelection();    if (sel < 0)        return;    wxWindow* page = m_notebook->GetPage(sel);    if (page)    {        wxString helpText;#if 0        if (page == m_displayOptions)            helpText = _("The display options dialog allows you to change display-related options.");        else if (page == m_viewerOptions)            helpText = _("The viewer options dialog allows you to configure viewers.");        else if (page == m_pathOptions)            helpText = _("The path options dialog allows you to change tool paths.");        else if (page == m_conflictResolutionOptions)            helpText = _("The conflict resolution options dialog allows you to change options related to conflict resolution.");        m_notebook->SetHelpText(helpText);#endif    }}bool ecSectionDialog::TransferDataToWindow(){    m_general->TransferDataToWindow();    m_relocation->TransferDataToWindow();    m_note->TransferDataToWindow();    return TRUE;}bool ecSectionDialog::TransferDataFromWindow(){    m_general->TransferDataFromWindow();    m_relocation->TransferDataFromWindow();    m_note->TransferDataFromWindow();    return TRUE;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -