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

📄 configtree.cpp

📁 含有完整TCP/IP PPP协议的嵌入式操作系统
💻 CPP
字号:
/* ---------------------------------------------------------------------------- * Copyright (C) 2004-2005 by egnite Software GmbH * * 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. * * ---------------------------------------------------------------------------- * Parts are * * Copyright (C) 1998, 1999, 2000 Red Hat, Inc. * * 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. * * ---------------------------------------------------------------------------- *//* * $Log: configtree.cpp,v $ * Revision 1.4  2005/04/25 08:35:31  haraldkipp * Upgrade to wxWidgets 6.0 * * Revision 1.3  2005/04/22 15:09:00  haraldkipp * Avoid compiler warnings. * Upgraded to wxWidgets 2.5.5. * * Revision 1.2  2004/08/18 13:34:20  haraldkipp * Now working on Linux * * Revision 1.1  2004/06/07 16:13:15  haraldkipp * Complete redesign based on eCos' configtool * */#include "nutconf.h"#include "treeitemdata.h"#include "nutconfhint.h"#include "configitem.h"#include "configtree.h"#if !defined(__WXMSW__)#include "bitmaps/checked.xpm"#include "bitmaps/checked_dis.xpm"#include "bitmaps/closedfolder.xpm"#include "bitmaps/closedfolder_dis.xpm"#include "bitmaps/enumerated.xpm"#include "bitmaps/enumerated_dis.xpm"#include "bitmaps/integer.xpm"#include "bitmaps/integer_dis.xpm"#include "bitmaps/radiooff.xpm"#include "bitmaps/radiooff_dis.xpm"#include "bitmaps/radioon.xpm"#include "bitmaps/radioon_dis.xpm"#include "bitmaps/text.xpm"#include "bitmaps/text_dis.xpm"#include "bitmaps/unchecked.xpm"#include "bitmaps/unchecked_dis.xpm"#include "bitmaps/library.xpm"#include "bitmaps/library_dis.xpm"#include "bitmaps/module.xpm"#include "bitmaps/module_dis.xpm"#endifIMPLEMENT_CLASS(CConfigTree, CScrolledTreeCtrl)BEGIN_EVENT_TABLE(CConfigTree, CScrolledTreeCtrl)    EVT_MOUSE_EVENTS(CConfigTree::OnMouseEvent)    EVT_TREE_SEL_CHANGED(-1, CConfigTree::OnSelChanged)    EVT_SCROLLWIN(CConfigTree::OnScroll)END_EVENT_TABLE();CConfigTree::CConfigTree(wxWindow * parent, wxWindowID id, const wxPoint & pt, const wxSize & sz, long style):  CScrolledTreeCtrl(parent, id, pt, sz, style){    m_imageList = new wxImageList(16, 16, true);    m_iconDB.SetImageList(m_imageList);    SetImageList(m_imageList);    m_iconDB.AddInfo(wxT("Folder"), wxICON(closedfolder), 0, true);    m_iconDB.AddInfo(wxT("Folder"), wxICON(closedfolder_dis), 0, false);    m_iconDB.AddInfo(wxT("Library"), wxICON(library), 0, true);    m_iconDB.AddInfo(wxT("Library"), wxICON(library_dis), 0, false);    m_iconDB.AddInfo(wxT("Module"), wxICON(module), 0, true);    m_iconDB.AddInfo(wxT("Module"), wxICON(module_dis), 0, false);    m_iconDB.AddInfo(wxT("Checkbox"), wxICON(checked), 0, true);    m_iconDB.AddInfo(wxT("Checkbox"), wxICON(checked_dis), 0, false);    m_iconDB.AddInfo(wxT("Checkbox"), wxICON(unchecked), 1, true);    m_iconDB.AddInfo(wxT("Checkbox"), wxICON(unchecked_dis), 1, false);    m_iconDB.AddInfo(wxT("Radiobox"), wxICON(radioon), 0, true);    m_iconDB.AddInfo(wxT("Radiobox"), wxICON(radioon_dis), 0, false);    m_iconDB.AddInfo(wxT("Radiobox"), wxICON(radiooff), 1, true);    m_iconDB.AddInfo(wxT("Radiobox"), wxICON(radiooff_dis), 1, false);    m_iconDB.AddInfo(wxT("Text"), wxICON(text), 0, true);    m_iconDB.AddInfo(wxT("Text"), wxICON(text_dis), 0, false);    m_iconDB.AddInfo(wxT("Enumerated"), wxICON(enumerated), 0, true);    m_iconDB.AddInfo(wxT("Enumerated"), wxICON(enumerated_dis), 0, false);    m_iconDB.AddInfo(wxT("Integer"), wxICON(integer), 0, true);    m_iconDB.AddInfo(wxT("Integer"), wxICON(integer_dis), 0, false);}void CConfigTree::OnMouseEvent(wxMouseEvent & event){    int flags = 0;    wxTreeItemId item = HitTest(wxPoint(event.GetX(), event.GetY()), flags);    if (item == (wxTreeItemId)0L || !item.IsOk()) {        return;    }    if (event.LeftDown()) {        if (flags & wxTREE_HITTEST_ONITEMICON) {            CTreeItemData *data = (CTreeItemData *) GetItemData(item);            data->GetConfigItem()->OnIconLeftDown(*this);        }    } else if (event.RightDown()) {        if ((flags & wxTREE_HITTEST_ONITEMBUTTON) ||            (flags & wxTREE_HITTEST_ONITEMICON) || (flags & wxTREE_HITTEST_ONITEMINDENT) || (flags & wxTREE_HITTEST_ONITEMLABEL)) {            SelectItem(item);        }        return;    }    event.Skip();}void CConfigTree::OnSelChanged(wxTreeEvent & WXUNUSED(event)){    CNutConfDoc *doc = wxGetApp().GetNutConfDoc();    if (doc) {        CNutConfHint hint(NULL, nutSelChanged);        doc->UpdateAllViews(NULL, &hint);    }}CIconList & CConfigTree::GetIconDB(){    return m_iconDB;}/* Debugging only. */void CConfigTree::OnScroll(wxScrollWinEvent & event){    wxLogVerbose(wxT("  CConfigTree::OnScroll"));    CScrolledTreeCtrl::OnScroll(event);}

⌨️ 快捷键说明

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