From 1d6ad03bff558271843a92cc01422b6cf2410e29 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Sat, 19 Jun 2010 03:21:25 +0200 Subject: [PATCH] Removed ListView and ListViewItem class, since they were not used anywhere. --- src/Makefile.am | 6 ++-- src/listview.cpp | 78 -------------------------------------------- src/listview.h | 59 --------------------------------- src/listviewitem.cpp | 30 ----------------- src/listviewitem.h | 48 --------------------------- 5 files changed, 3 insertions(+), 218 deletions(-) delete mode 100644 src/listview.cpp delete mode 100644 src/listview.h delete mode 100644 src/listviewitem.cpp delete mode 100644 src/listviewitem.h diff --git a/src/Makefile.am b/src/Makefile.am index 9855666..96e5866 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,20 +2,20 @@ bin_PROGRAMS = gmenu2x gmenu2x_SOURCES = asfont.cpp button.cpp cpu.cpp dirdialog.cpp filedialog.cpp \ filelister.cpp gmenu2x.cpp iconbutton.cpp imagedialog.cpp inputdialog.cpp \ - inputmanager.cpp linkaction.cpp linkapp.cpp link.cpp listviewitem.cpp \ + inputmanager.cpp linkaction.cpp linkapp.cpp link.cpp \ menu.cpp menusettingbool.cpp menusetting.cpp menusettingdir.cpp \ menusettingfile.cpp menusettingimage.cpp menusettingint.cpp \ menusettingmultistring.cpp menusettingrgba.cpp menusettingstring.cpp \ messagebox.cpp selector.cpp selectordetector.cpp \ settingsdialog.cpp sfontplus.cpp surfacecollection.cpp surface.cpp \ textdialog.cpp textmanualdialog.cpp touchscreen.cpp translator.cpp \ - utilities.cpp wallpaperdialog.cpp listview.cpp \ + utilities.cpp wallpaperdialog.cpp \ browsedialog.cpp buttonbox.cpp dialog.cpp noinst_HEADERS = asfont.h button.h cpu.h dirdialog.h FastDelegate.h \ filedialog.h filelister.h gmenu2x.h gp2x.h iconbutton.h imagedialog.h \ inputdialog.h inputmanager.h jz4740.h linkaction.h linkapp.h link.h \ - listview.h listviewitem.h menu.h menusettingbool.h menusettingdir.h \ + menu.h menusettingbool.h menusettingdir.h \ menusettingfile.h menusetting.h menusettingimage.h menusettingint.h \ menusettingmultistring.h menusettingrgba.h menusettingstring.h \ messagebox.h selectordetector.h selector.h settingsdialog.h \ diff --git a/src/listview.cpp b/src/listview.cpp deleted file mode 100644 index caea476..0000000 --- a/src/listview.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "listview.h" - -ListView::ListView(GMenu2X *gmenu2x) { - this->gmenu2x = gmenu2x; - firstDisplayItem = selectedItem = 0; - itemsPerPage = 11; -} - -ListView::~ ListView() {} - -ListViewItem * ListView::add(ListViewItem *item) { - items.push_back(item); - return item; -} - -ListViewItem * ListView::add(const string &text) { - ListViewItem *item = new ListViewItem(this,text); - return add(item); -} - -void ListView::del(ListViewItem * item) { - vector::iterator p = find(items.begin(), items.end(), item); - if (p != items.end()) - items.erase(p); -} - -void ListView::del(int itemIndex) { - items.erase(items.begin()+itemIndex); -} - -void ListView::clear() { - items.clear(); -} - -ListViewItem * ListView::operator [](int index) { - return items[index]; -} - -void ListView::setPosition(int x, int y) { - rect.x = x; - rect.y = y; -} - -void ListView::setSize(int w, int h) { - rect.w = w; - rect.h = h; -} - -void ListView::paint() { - gmenu2x->s->setClipRect(rect); - - //Selection - int iY = selectedItem-firstDisplayItem; - iY = rect.y+(iY*16); - if (selectedItem<(int)items.size()) - gmenu2x->s->box(1, iY, 309, 14, gmenu2x->skinConfColors[COLOR_SELECTION_BG]); - - //Items - iY = rect.y; - for (int i=firstDisplayItem; i<(int)items.size() && isetPosition(4,iY); - items[i]->paint(); - iY += items[i]->getHeight(); - } - - gmenu2x->drawScrollBar(itemsPerPage, items.size(), firstDisplayItem, 42,175); - - gmenu2x->s->clearClipRect(); -} - -void ListView::handleInput() { - for (int i=firstDisplayItem; i<(int)items.size() && ihandleTS(); -} - -int ListView::getWidth() { - return rect.w; -} diff --git a/src/listview.h b/src/listview.h deleted file mode 100644 index 13c740a..0000000 --- a/src/listview.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * - * * - * 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. * - ***************************************************************************/ -#ifndef LISTVIEW_H_ -#define LISTVIEW_H_ - -#include "gmenu2x.h" -#include "listviewitem.h" - -using std::vector; - -class ListView { -private: - int firstDisplayItem, selectedItem; - int itemsPerPage; - -protected: - vector items; - SDL_Rect rect; - -public: - ListView(GMenu2X *gmenu2x); - virtual ~ListView(); - - GMenu2X *gmenu2x; - - ListViewItem *add(ListViewItem *item); - ListViewItem *add(const string &text); - void del(ListViewItem *item); - void del(int itemIndex); - void clear(); - - void setPosition(int x, int y); - void setSize(int w, int h); - int getWidth(); - - virtual void paint(); - virtual void handleInput(); - - ListViewItem *operator[](int); -}; - -#endif diff --git a/src/listviewitem.cpp b/src/listviewitem.cpp deleted file mode 100644 index 6e2ac18..0000000 --- a/src/listviewitem.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "listview.h" -#include "listviewitem.h" - -ListViewItem::ListViewItem(ListView * parent, const string &text) { - this->parent = parent; - rect.h = 16; - rect.w = parent->getWidth(); -} - -ListViewItem::~ ListViewItem() {} - -void ListViewItem::setPosition(int x, int y) { - rect.x = x; - rect.y = y; -} - -void ListViewItem::paint() { - parent->gmenu2x->s->write(parent->gmenu2x->font, text, rect.x, rect.y, SFontHAlignLeft, SFontVAlignMiddle); -} - -int ListViewItem::getHeight() { - return rect.h; -} - -void ListViewItem::handleTS() { - if (parent->gmenu2x->ts.inRect(rect)) - onClick(); -} - -void ListViewItem::onClick() {} diff --git a/src/listviewitem.h b/src/listviewitem.h deleted file mode 100644 index a52d2b8..0000000 --- a/src/listviewitem.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * - * * - * 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. * - ***************************************************************************/ -#ifndef LISTVIEWITEM_H_ -#define LISTVIEWITEM_H_ - -#include - -using std::string; - -class ListView; - -class ListViewItem { -protected: - ListView *parent; - SDL_Rect rect; - -public: - ListViewItem(ListView *parent, const string &text); - virtual ~ListViewItem(); - - string text; - - void setPosition(int x, int y); - int getHeight(); - - virtual void paint(); - virtual void handleTS(); - virtual void onClick(); -}; - -#endif