ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

scrollbar.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GUI_WIDGETS_SCROLLBAR_H
00024 #define GUI_WIDGETS_SCROLLBAR_H
00025 
00026 #include "gui/widget.h"
00027 
00028 namespace GUI {
00029 
00030 enum {
00031     kSetPositionCmd     = 'SETP'
00032 };
00033 
00034 
00035 class ScrollBarWidget : public Widget, public CommandSender {
00036 protected:
00037     typedef enum {
00038         kNoPart,
00039         kUpArrowPart,
00040         kDownArrowPart,
00041         kSliderPart,
00042         kPageUpPart,
00043         kPageDownPart
00044     } Part;
00045 
00046     Part    _part;
00047     int     _sliderHeight;
00048     int     _sliderPos;
00049 
00050     Part    _draggingPart;
00051     int     _sliderDeltaMouseDownPos;
00052 
00053     enum {
00054         kRepeatInitialDelay = 500,
00055         kRepeatDelay = 100
00056     };
00057     uint32  _repeatTimer;
00058 
00059 public:
00060     int     _numEntries;
00061     int     _entriesPerPage;
00062     int     _currentPos;
00063     int     _singleStep;
00064 
00065 public:
00066     ScrollBarWidget(GuiObject *boss, int x, int y, int w, int h);
00067 
00068     void handleMouseDown(int x, int y, int button, int clickCount);
00069     void handleMouseUp(int x, int y, int button, int clickCount);
00070     void handleMouseWheel(int x, int y, int direction);
00071     void handleMouseMoved(int x, int y, int button);
00072     void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); }
00073     void handleMouseLeft(int button)    { clearFlags(WIDGET_HILITED); _part = kNoPart; markAsDirty(); }
00074     void handleTickle();
00075     bool wantsFocus() { return true; }
00076 
00077     // FIXME - this should be private, but then we also have to add accessors
00078     // for _numEntries, _entriesPerPage and _currentPos. This again leads to the question:
00079     // should these accessors force a redraw?
00080     void recalc();
00081 
00082     void checkBounds(int old_pos);
00083 
00084 protected:
00085     void drawWidget();
00086 };
00087 
00088 } // End of namespace GUI
00089 
00090 #endif


Generated on Sat Jul 13 2019 05:01:19 for ResidualVM by doxygen 1.7.1
curved edge   curved edge