1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-05 07:31:54 +02:00

Removed ListView and ListViewItem class, since they were not used anywhere.

This commit is contained in:
Maarten ter Huurne 2010-06-19 03:21:25 +02:00
parent 9f05aaf6b9
commit 1d6ad03bff
5 changed files with 3 additions and 218 deletions

View File

@ -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 \

View File

@ -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<ListViewItem*>::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() && i<firstDisplayItem+itemsPerPage; i++) {
items[i]->setPosition(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() && i<firstDisplayItem+itemsPerPage; i++)
items[i]->handleTS();
}
int ListView::getWidth() {
return rect.w;
}

View File

@ -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<ListViewItem*> 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

View File

@ -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() {}

View File

@ -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 <string>
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