Package library :: Package pyjamas :: Package ui :: Module PushButton
[hide private]
[frames] | no frames]

Source Code for Module library.pyjamas.ui.PushButton

 1  # Copyright (C) 2006-2009 Google, Inc. 
 2  # Copyright (C) 2009 Laszlo Krekacs 
 3  # Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net> 
 4  # 
 5  # Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 6  # use this file except in compliance with the License. You may obtain a copy of 
 7  # the License at 
 8  # 
 9  # http://www.apache.org/licenses/LICENSE-2.0 
10  # 
11  # Unless required by applicable law or agreed to in writing, software 
12  # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
13  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
14  # License for the specific language governing permissions and limitations under 
15  # the License. 
16   
17  from pyjamas.ui.CustomButton import CustomButton 
18  from pyjamas import Factory 
19   
20 -class PushButton (CustomButton):
21 """ 22 A normal push button with custom styling. 23 24 CSS: .gwt-PushButton- 25 up/down/up-hovering/down-hovering/up-disabled/down-disabled {.html-face} 26 """ 27 STYLENAME_DEFAULT = "gwt-PushButton" 28
29 - def __init__(self, upImageText = None, downImageText=None, handler = None, 30 **kwargs):
31 """ 32 Constructor for PushButton. 33 """ 34 if not kwargs.has_key('StyleName'): kwargs['StyleName']=self.STYLENAME_DEFAULT 35 36 CustomButton.__init__(self, upImageText, downImageText, handler, 37 **kwargs)
38 39
40 - def onClick(self, sender=None):
41 self.setDown(False) 42 CustomButton.onClick(self)
43 44
45 - def onClickCancel(self):
46 self.setDown(False)
47 48
49 - def onClickStart(self):
50 self.setDown(True)
51 52 Factory.registerClass('pyjamas.ui.PushButton', 'PushButton', PushButton) 53