Laxkit
0.0.7.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
lax
itemslider.h
1
//
2
//
3
// The Laxkit, a windowing toolkit
4
// Please consult http://laxkit.sourceforge.net about where to send any
5
// correspondence about this software.
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
// Library General Public License for more details.
16
//
17
// You should have received a copy of the GNU Library General Public
18
// License along with this library; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
//
21
// Copyright (C) 2004-2010 by Tom Lechner
22
//
23
#ifndef _LAX_ITEMSLIDER_H
24
#define _LAX_ITEMSLIDER_H
25
26
27
#include <lax/anxapp.h>
28
29
namespace
Laxkit {
30
31
// SENDALL means send sendthis message on Idle,Select/Previous/Next
32
// AUTOSHIFT means move mouse outside window then sit also selects prev/next based on (how far out of window)/movewidth
33
#define ITEMSLIDER_XSHIFT (1<<16)
34
#define ITEMSLIDER_YSHIFT (1<<17)
35
#define ITEMSLIDER_SENDALL (1<<18)
36
#define ITEMSLIDER_AUTOSHIFT (1<<19)
37
#define ITEMSLIDER_POPUP (1<<20)
38
39
class
ItemSlider
:
public
anXWindow
40
{
41
protected
:
42
int
timerid;
43
int
nitems;
44
int
curitem,
lbitem
;
45
int
mx,my,lx,ly;
46
int
ox,oy;
47
int
buttondown, buttondowndevice;
48
virtual
int
send
();
49
virtual
int
getid(
int
i)=0;
50
virtual
int
numitems()=0;
51
public
:
52
int
movewidth;
// moving past this num in x/y dirs selects next or prev
53
ItemSlider
(
anXWindow
*parnt,
const
char
*nname,
const
char
*ntitle,
unsigned
long
nstyle,
54
int
xx,
int
yy,
int
ww,
int
hh,
int
brder,
55
anXWindow
*prev,
unsigned
long
nowner,
const
char
*nsendthis);
56
virtual
~ItemSlider
();
57
virtual
int
init
();
58
virtual
int
Idle
(
int
tid=0);
59
virtual
int
WheelUp(
int
x,
int
y,
unsigned
int
state,
int
count,
const
LaxMouse
*d) {
SelectNext
();
send
();
return
0; }
60
virtual
int
WheelDown(
int
x,
int
y,
unsigned
int
state,
int
count,
const
LaxMouse
*d) {
SelectPrevious
();
send
();
return
0; }
61
virtual
int
LBDown
(
int
x,
int
y,
unsigned
int
state,
int
count,
const
LaxMouse *d);
62
virtual
int
LBUp
(
int
x,
int
y,
unsigned
int
state,
const
LaxMouse *d);
63
virtual
int
MouseMove
(
int
x,
int
y,
unsigned
int
state,
const
LaxMouse *d);
64
65
virtual
void
Refresh() = 0;
66
67
virtual
int
GetCurrentItemId
();
68
virtual
int
SelectPrevious
();
69
virtual
int
SelectNext
();
70
virtual
int
Select
(
int
id
);
71
};
72
73
}
// namespace Laxkit
74
75
#endif
76
Mon Feb 17 2014 11:52:56, Laxkit