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

Source Code for Module library.pyjamas.ui.ToggleButton

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