First checkin, AXE release 0.2
[AXE.git] / src / button.cpp
1
2 /**************************************************************************
3 **  (c) Copyright 1998, Andromeda Technology & Automation
4 ***************************************************************************
5 ** MODULE INFORMATION *
6 ***********************
7 **      FILE NAME      : button.cpp
8 **      SYSTEM NAME    : AXE - Andromeda X-windows Encapsulation
9 **      VERSION NUMBER : $Revision: 1.1 $
10 **
11 **  DESCRIPTION      :  Implementation of button classes
12 **
13 **  EXPORTED OBJECTS : 
14 **  LOCAL    OBJECTS : 
15 **  MODULES  USED    :
16 ***************************************************************************
17 **  ADMINISTRATIVE INFORMATION *
18 ********************************
19 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
20 **      CREATION DATE   : Mar 13, 1998
21 **      LAST UPDATE     : Mar 13, 1998
22 **      MODIFICATIONS   : 
23 **************************************************************************/
24
25 /*****************************
26    $Log: button.cpp,v $
27    Revision 1.1  2002-07-25 08:01:26  arjen
28    First checkin, AXE release 0.2
29
30 *****************************/
31
32 static const char *RCSID = "$Id: button.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $";
33
34 #include "button.h"
35
36 int touch_button::EV_ButtonPress(XButtonEvent ev)
37 {
38    Strength(-Strength());
39    click();
40    return 1;
41 }
42
43 void touch_button::click(void)
44 {
45 }
46
47 void toggle_button::click(void)
48 {
49    state = state == State_On ? State_Off : State_On;
50    redraw();
51 }
52
53 void toggle_button::redraw(void)
54 {
55    if (state == State_On)
56       XFillRectangle(stddpy, ID(), red_gc, 6, 6, 12, 20);
57    else
58       XFillRectangle(stddpy, ID(), green_gc, 6, 6, 12, 20);
59 }