2002-07-12 16:24:11 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2003-03-06 21:46:56 +00:00
|
|
|
* Copyright (C) 2002-2003 The ScummVM project
|
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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SCROLLBARWIDGET_H
|
|
|
|
#define SCROLLBARWIDGET_H
|
|
|
|
|
|
|
|
#include "widget.h"
|
|
|
|
|
2002-07-12 23:00:35 +00:00
|
|
|
enum {
|
|
|
|
kScrollBarWidth = 9
|
|
|
|
};
|
2002-07-12 16:24:11 +00:00
|
|
|
|
2002-07-13 22:41:29 +00:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
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:
|
|
|
|
ScrollBarWidget(Dialog *boss, int x, int y, int w, int h);
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
// 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:
|
|
|
|
void drawWidget(bool hilite);
|
2002-07-13 22:41:29 +00:00
|
|
|
void checkBounds(int old_pos);
|
2002-07-12 16:24:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|