2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-07-12 16:24:11 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-07-12 16:24:11 +00:00
|
|
|
*
|
2006-02-11 10:08:56 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-07-12 16:24:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SCROLLBARWIDGET_H
|
|
|
|
#define SCROLLBARWIDGET_H
|
|
|
|
|
2003-11-10 23:40:48 +00:00
|
|
|
#include "gui/widget.h"
|
|
|
|
|
|
|
|
namespace GUI {
|
2002-07-12 16:24:11 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
kSetPositionCmd = 'SETP'
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ScrollBarWidget : public Widget, public CommandSender {
|
|
|
|
protected:
|
2002-07-13 22:41:29 +00:00
|
|
|
typedef enum {
|
2002-07-12 16:24:11 +00:00
|
|
|
kNoPart,
|
|
|
|
kUpArrowPart,
|
|
|
|
kDownArrowPart,
|
|
|
|
kSliderPart,
|
|
|
|
kPageUpPart,
|
|
|
|
kPageDownPart
|
2002-07-13 22:41:29 +00:00
|
|
|
} Part;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2002-07-13 22:41:29 +00:00
|
|
|
Part _part;
|
2002-07-12 16:24:11 +00:00
|
|
|
int _sliderHeight;
|
|
|
|
int _sliderPos;
|
2002-07-12 23:00:35 +00:00
|
|
|
|
2002-07-13 22:41:29 +00:00
|
|
|
Part _draggingPart;
|
2002-07-12 23:00:35 +00:00
|
|
|
int _sliderDeltaMouseDownPos;
|
|
|
|
|
2002-07-12 16:24:11 +00:00
|
|
|
public:
|
|
|
|
int _numEntries;
|
|
|
|
int _entriesPerPage;
|
|
|
|
int _currentPos;
|
2002-07-13 22:41:29 +00:00
|
|
|
|
2002-07-12 16:24:11 +00:00
|
|
|
public:
|
2003-11-02 14:50:53 +00:00
|
|
|
ScrollBarWidget(GuiObject *boss, int x, int y, int w, int h);
|
2002-07-12 16:24:11 +00:00
|
|
|
|
2002-07-27 14:16:14 +00:00
|
|
|
void handleMouseDown(int x, int y, int button, int clickCount);
|
|
|
|
void handleMouseUp(int x, int y, int button, int clickCount);
|
2002-10-16 20:32:12 +00:00
|
|
|
void handleMouseWheel(int x, int y, int direction);
|
2002-07-12 16:24:11 +00:00
|
|
|
void handleMouseMoved(int x, int y, int button);
|
|
|
|
void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); }
|
2002-07-13 18:32:09 +00:00
|
|
|
void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); _part = kNoPart; draw(); }
|
2002-07-13 22:41:29 +00:00
|
|
|
void handleTickle();
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2002-07-13 22:41:29 +00:00
|
|
|
// FIXME - this should be private, but then we also have to add accessors
|
|
|
|
// for _numEntries, _entriesPerPage and _currentPos. This again leads to the question:
|
|
|
|
// should these accessors force a redraw?
|
2002-07-12 16:24:11 +00:00
|
|
|
void recalc();
|
|
|
|
|
|
|
|
protected:
|
2007-11-04 03:38:30 +00:00
|
|
|
void drawWidget();
|
2002-07-13 22:41:29 +00:00
|
|
|
void checkBounds(int old_pos);
|
2002-07-12 16:24:11 +00:00
|
|
|
};
|
|
|
|
|
2003-11-10 23:40:48 +00:00
|
|
|
} // End of namespace GUI
|
2002-07-12 16:24:11 +00:00
|
|
|
|
|
|
|
#endif
|