Laxkit
0.0.7.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
lax
buttonbase.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_BUTTONBASE_H
24
#define _LAX_BUTTONBASE_H
25
26
27
#include <lax/anxapp.h>
28
#include <lax/buttondowninfo.h>
29
30
// sends on LBUp up and mousein
31
// it is assumes that there is only standard grayed, on, off
32
#define BUTTON_MOMENTARY (1<<16)
33
34
// sends on any toggle and LBUp
35
#define BUTTON_TOGGLE (1<<17)
36
37
#define BUTTON_OK (0x1<<24)
38
#define BUTTON_CANCEL (0x2<<24)
39
#define BUTTON_OPEN (0x3<<24)
40
#define BUTTON_SAVE (0x4<<24)
41
#define BUTTON_SAVE_AS (0x5<<24)
42
#define BUTTON_SAVE_ALL (0x6<<24)
43
#define BUTTON_CLOSE (0x7<<24)
44
#define BUTTON_CLOSE_ALL (0x8<<24)
45
#define BUTTON_QUIT (0x9<<24)
46
#define BUTTON_QUIT_ANYWAY (0xa<<24)
47
#define BUTTON_PRINT (0xb<<24)
48
#define BUTTON_PREVIEW (0xc<<24)
49
#define BUTTON_YES (0xd<<24)
50
#define BUTTON_NO (0xe<<24)
51
#define BUTTON_OVERWRITE (0xf<<24)
52
53
#define BUTTON_TEXT_MASK (0xff<<24)
54
55
namespace
Laxkit {
56
57
class
ButtonBase
:
public
anXWindow
58
{
59
protected
:
60
int
mousein
,state,oldstate, id;
61
ButtonBase
*nextbutton,*prevbutton;
62
ButtonDownInfo
buttondown;
63
unsigned
int
button_style;
64
public
:
65
unsigned
int
highlight,shadow;
66
int
bevel;
67
ButtonBase
(
anXWindow
*parnt,
const
char
*nname,
const
char
*ntitle,
68
unsigned
long
nstyle,
int
xx,
int
yy,
int
ww,
int
hh,
int
brder,
69
anXWindow
*prev,
unsigned
long
nowner,
const
char
*nsendmes,
70
int
nid=0);
71
virtual
~ButtonBase
();
72
virtual
int
Grayed
();
73
virtual
int
Grayed
(
int
g);
74
virtual
int
LBDown
(
int
x,
int
y,
unsigned
int
wstate,
int
count,
const
LaxMouse
*d);
75
virtual
int
LBUp
(
int
x,
int
y,
unsigned
int
wstate,
const
LaxMouse
*d);
76
virtual
int
WheelDown
(
int
x,
int
y,
unsigned
int
wstate,
int
count,
const
LaxMouse
*d);
77
virtual
int
WheelUp
(
int
x,
int
y,
unsigned
int
wstate,
int
count,
const
LaxMouse
*d);
78
virtual
int
MouseMove
(
int
x,
int
y,
unsigned
int
state,
const
LaxMouse
*d);
79
virtual
int
CharInput
(
unsigned
int
ch,
const
char
*buffer,
int
len,
unsigned
int
state,
const
LaxKeyboard
*d);
80
virtual
int
Event
(
const
EventData
*e,
const
char
*mes);
81
virtual
int
send
(
int
deviceid,
int
direction);
82
83
virtual
void
Refresh
();
84
virtual
void
draw() = 0;
85
virtual
void
drawon() { draw(); }
86
virtual
void
drawoff() { draw(); }
87
virtual
void
drawgrayed() { drawoff(); }
88
virtual
void
drawother() {}
89
90
virtual
int
toggle
();
91
virtual
int
State
(
int
newstate);
92
virtual
int
State
() {
return
state; }
93
};
94
95
}
// namespace Laxkit
96
97
98
#endif
99
Mon Feb 17 2014 11:52:56, Laxkit