2
# This file is part of GNU Enterprise.
4
# GNU Enterprise is free software; you can redistribute it
5
# and/or modify it under the terms of the GNU General Public
6
# License as published by the Free Software Foundation; either
7
# version 2, or (at your option) any later version.
9
# GNU Enterprise is distributed in the hope that it will be
10
# useful, but WITHOUT ANY WARRANTY; without even the implied
11
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public
15
# License along with program; see the file COPYING. If not,
16
# write to the Free Software Foundation, Inc., 59 Temple Place
17
# - Suite 330, Boston, MA 02111-1307, USA.
19
# Copyright 2002-2005 Free Software Foundation
30
from constants import *
31
from GraphicObject import GraphicObject
33
class Control(GraphicObject):
40
def __init__(self, Parent, x, y, w=1, h=1, **properties):
41
GraphicObject.__init__(self, Parent.SCREEN, **properties)
42
self.SetColor('DIALOG','BACKGROUND')
49
self.Methods["CLICK"] = None
50
self.Methods["PAINT"] = None
51
self.Methods["GOTFOCUS"] = None
52
self.Methods["LOSTFOCUS"] = None
53
self.Methods["ACTION"] = None
55
Parent.AddControl(self)
58
## def DetermineAndSetColor(self, HasFocus):
61
## self.SetColor(self.FOCUSCOLOR)
63
## self.SetColor(self.COLOR)
68
def CreateProperty(self, Property, Value):
69
self.__dict__[Property] = Value
71
def SetMethod(self, MethodName, MethodValue):
72
self.Methods[MethodName] = MethodValue
74
def GetMethod(self, MethodName):
75
if self.Methods.has_key(MethodName):
76
return(self.Methods[MethodName])
79
def Paint(self, v1,v2,v3):
82
def ExecMethod(self, MethodName, Arg1, Arg2, Arg3):
83
if not self.Methods.has_key(MethodName):
85
if self.Methods[MethodName] == None:
88
return self.Methods[MethodName](Arg1, Arg2, Arg3)
90
def DeActivate(self, state):
91
if self.active != state:
94
self.ExecMethod("REFRESH",None,None,None)
97
def SetActiveState( self, state):
98
self.DeActivate( state)