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 FocusedLabel import FocusedLabel
33
class MenuItem(FocusedLabel):
34
def __init__(self,Parent,MenuName,Y,X,DisplayName = "", itemDescription="",
35
statusbarlink=None, **properties):
36
FocusedLabel.__init__(self,Parent,MenuName,Y,X,DisplayName, **properties)
37
self.TITLE = DisplayName
38
self.DESCRIPTION = itemDescription
39
self.STATUSBARLINK = statusbarlink
40
self.SetColor('MENUBAR','MENUBAR_FOCUS')
42
def Run(self,v1,v2,v3):
43
Container = self.PARENT.Screen()
45
self.ExecMethod("CLICK", self, None, None)
48
ch = Container.GetChar()
49
if self.PARENT.BreakOrder(ch) :
52
if ch in (Container.TokRightArrow, Container.TokLeftArrow):
54
if ch == Container.TokLeftArrow:
59
elif ch in (Container.TokDownArrow, Container.TokNextField):
62
elif ch in (Container.TokUpArrow,):
65
elif ch == Container.TokActivate:
66
self.ExecMethod("CLICK",self,None,None)
69
self.ExecMethod("SYSGOTFOCUS",None,None,None)
71
# def Paint(self, HasFocus, v2, v3):
72
# Container = self.PARENT.Screen()
75
# color = self.FOCUSCOLOR
76
# if self.STATUSBARLINK and self.STATUSBARLINK.STATUSBAR:
77
# self.STATUSBARLINK.STATUSBAR.SetText(self.STATUSBARLINK.STATUSBAR_INDEX, self.DESCRIPTION)
84
# caption = self.CAPTION
85
# Container.PrintAt(Y,X,caption, color)