1 /*
2   Copyright (C) 2009 Facundo Domínguez
3 
4   This file is part of Spacejunk.
5 
6   Spacejunk is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10 
11   Foobar is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15 
16   You should have received a copy of the GNU General Public License
17   along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef ZOOMCONTROL_H
21 #define ZOOMCONTROL_H
22 
23 #include "cworld.h"
24 
25 class ZoomControl {
26     cWorld * w;
27     Graphic minus,plus;
28 public:
29     enum {Z_IN,Z_OUT,Z_NONE} state;
30     ZoomControl(cWorld * w);
31     void draw(int x,int y);
32     void step(int delta);
33     void mousePress(int x,int y,int mx,int my);
34     void release();
35     void pressIn();
36     void pressOut();
37     void releaseIn();
38     void releaseOut();
39 };
40 
41 
42 class Button {
43 public:
44     Button(int x,int y,const std::string & released,const std::string & pressed);
45     bool mousePressed(int x,int y,bool left);
46     bool mouseReleased(int x,int y,bool left);
47     void mouseMotion(int x,int y);
48     void draw();
49     typedef enum {PRESSED,ACTIVE,RELEASED} STATE;
50     void setState(STATE state);
51 private:
52     Graphic released, pressed;
53     int btx,bty,btw,bth;
54     STATE state;
55 };
56 
57 #endif // ZOOMCONTROL_H
58