RenderBlock {P} at (0,0) size 139x19
RenderText {TEXT} at (0,4) size 28x18
text run at (0,4) width 28: "bang "
- RenderRadioButton {INPUT} at (31,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (31,3) size 12x13 [color=#000000]
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {P} at (0,19) size 139x19
RenderText {TEXT} at (0,4) size 47x18
text run at (0,4) width 47: "whimper "
- RenderRadioButton {INPUT} at (50,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (50,3) size 12x13 [color=#000000]
RenderText {TEXT} at (0,0) size 0x0
RenderBlock (anonymous) at (10,58) size 139x0
RenderInline {FORM} at (0,0) size 0x0
RenderText {TEXT} at (0,2) size 220x20
text run at (0,2) width 220: "Your research is primarily focused on:"
RenderBlock {SPAN} at (325,250) size 180x20 [color=#333333]
- RenderRadioButton {INPUT} at (3,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (3,3) size 12x13 [color=#000000]
RenderText {TEXT} at (18,2) size 32x20
text run at (18,2) width 32: "Texts"
RenderBlock {SPAN} at (325,270) size 180x20 [color=#333333]
- RenderRadioButton {INPUT} at (3,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (3,3) size 12x13 [color=#000000]
RenderText {TEXT} at (18,2) size 133x20
text run at (18,2) width 133: "Performance materials"
RenderBlock {SPAN} at (325,290) size 180x20 [color=#333333]
- RenderRadioButton {INPUT} at (3,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (3,3) size 12x13 [color=#000000]
RenderText {TEXT} at (18,2) size 21x20
text run at (18,2) width 21: "n/a"
RenderBlock {H2} at (0,335) size 560x16 [color=#333333]
RenderBlock {SPAN} at (325,361) size 180x20 [color=#333333]
RenderText {TEXT} at (0,2) size 19x20
text run at (0,2) width 19: "Yes"
- RenderRadioButton {INPUT} at (22,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (22,3) size 12x13 [color=#000000]
RenderText {TEXT} at (37,2) size 19x20
text run at (37,2) width 4: " "
text run at (41,2) width 15: "No"
- RenderRadioButton {INPUT} at (59,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (59,3) size 12x13 [color=#000000]
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {P} at (0,394) size 560x20 [color=#333333]
RenderText {TEXT} at (0,2) size 378x20
RenderTableCell {TD} at (0,0) size 20x20 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderBlock {INPUT} at (4,4) size 12x12
RenderTableCell {TD} at (20,9) size 760x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
- RenderBlock {P} at (0,138) size 784x25
- RenderTable {TABLE} at (0,0) size 784x25 [border: (2px outset #808080)]
- RenderTableSection {TBODY} at (2,2) size 0x21
+ RenderBlock {P} at (0,138) size 784x24
+ RenderTable {TABLE} at (0,0) size 784x24 [border: (2px outset #808080)]
+ RenderTableSection {TBODY} at (2,2) size 0x20
RenderTableRow {TR} at (0,0) size 0x0
- RenderTableCell {TD} at (0,0) size 20x21 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
- RenderRadioButton {INPUT} at (4,4) size 12x13
+ RenderTableCell {TD} at (0,0) size 20x20 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderBlock {INPUT} at (4,4) size 12x12
RenderTableCell {TD} at (20,9) size 760x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
- RenderBlock {P} at (0,179) size 784x28
+ RenderBlock {P} at (0,178) size 784x28
RenderTable {TABLE} at (0,0) size 784x28 [border: (2px outset #808080)]
RenderTableSection {TBODY} at (2,2) size 0x24
RenderTableRow {TR} at (0,0) size 0x0
RenderTableCell {TD} at (0,0) size 42x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderSubmitButton {INPUT} at (3,3) size 36x18
RenderTableCell {TD} at (42,11) size 738x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
- RenderBlock {P} at (0,223) size 784x66
+ RenderBlock {P} at (0,222) size 784x66
RenderTable {TABLE} at (0,0) size 784x24 [border: (2px outset #808080)]
RenderTableSection {TBODY} at (2,2) size 0x20
RenderTableRow {TR} at (0,0) size 0x0
RenderTableCell {TD} at (132,4) size 18x19 [r=0 c=2 rs=1 cs=1]
RenderBlock {DIV} at (1,1) size 16x17 [border: (2px solid #0000FF)]
RenderInline {FONT} at (0,0) size 12x13
- RenderRadioButton {INPUT} at (2,2) size 12x13
+ RenderBlock {INPUT} at (2,2) size 12x13
RenderBlock (anonymous) at (1,18) size 16x0
RenderInline {FONT} at (0,0) size 0x0
RenderTableCell {TD} at (152,5) size 18x18 [r=0 c=3 rs=1 cs=1]
RenderSelect {SELECT} at (2,2) size 62x18
RenderTableCell {TD} at (132,4) size 18x19 [r=0 c=2 rs=1 cs=1]
RenderBlock {DIV} at (1,1) size 16x17 [border: (2px solid #0000FF)]
- RenderRadioButton {INPUT} at (2,2) size 12x13
+ RenderBlock {INPUT} at (2,2) size 12x13
RenderTableCell {TD} at (152,5) size 18x18 [r=0 c=3 rs=1 cs=1]
RenderBlock {DIV} at (1,1) size 16x16 [border: (2px solid #0000FF)]
RenderBlock {INPUT} at (2,2) size 12x12
RenderTableCell {TD} at (132,4) size 18x19 [r=0 c=2 rs=1 cs=1]
RenderBlock {DIV} at (1,1) size 16x17 [border: (2px solid #0000FF)]
RenderInline {FONT} at (0,0) size 12x12
- RenderRadioButton {INPUT} at (2,2) size 12x13
+ RenderBlock {INPUT} at (2,2) size 12x13
RenderTableCell {TD} at (152,5) size 18x18 [r=0 c=3 rs=1 cs=1]
RenderBlock {DIV} at (1,1) size 16x16 [border: (2px solid #0000FF)]
RenderInline {FONT} at (0,0) size 12x12
RenderText {TEXT} at (0,0) size 200x28
text run at (0,0) width 200: "Baseline Alignment"
RenderBlock {DIV} at (0,360) size 784x29
- RenderInline {FONT} at (0,0) size 219x28
+ RenderInline {FONT} at (0,0) size 213x28
RenderText {TEXT} at (0,0) size 43x28
text run at (0,0) width 43: "text "
RenderSubmitButton {INPUT} at (45,9) size 52x18
RenderSelect {SELECT} at (107,9) size 62x18
RenderText {TEXT} at (171,0) size 6x28
text run at (171,0) width 6: " "
- RenderRadioButton {INPUT} at (180,11) size 12x13
- RenderText {TEXT} at (195,0) size 6x28
- text run at (195,0) width 6: " "
- RenderBlock {INPUT} at (204,12) size 12x12
+ RenderBlock {INPUT} at (180,11) size 12x13
+ RenderBlock {INPUT} at (198,12) size 12x12
RenderBlock {DIV} at (0,389) size 784x22
RenderText {TEXT} at (0,1) size 27x18
text run at (0,1) width 27: "text "
RenderSelect {SELECT} at (89,2) size 62x18
RenderText {TEXT} at (153,1) size 4x18
text run at (153,1) width 4: " "
- RenderRadioButton {INPUT} at (160,4) size 12x13
+ RenderBlock {INPUT} at (160,4) size 12x13
RenderText {TEXT} at (175,1) size 4x18
text run at (175,1) width 4: " "
RenderBlock {INPUT} at (182,5) size 12x12
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {DIV} at (0,411) size 784x22
- RenderInline {FONT} at (0,0) size 185x13
+ RenderInline {FONT} at (0,0) size 182x13
RenderText {TEXT} at (0,5) size 18x13
text run at (0,5) width 18: "text "
RenderSubmitButton {INPUT} at (20,2) size 52x18
RenderSelect {SELECT} at (79,2) size 62x18
RenderText {TEXT} at (143,5) size 3x13
text run at (143,5) width 3: " "
- RenderRadioButton {INPUT} at (149,4) size 12x13
- RenderText {TEXT} at (164,5) size 3x13
- text run at (164,5) width 3: " "
- RenderBlock {INPUT} at (170,5) size 12x12
+ RenderBlock {INPUT} at (149,4) size 12x13
+ RenderBlock {INPUT} at (167,5) size 12x12
RenderBlock {DIV} at (0,433) size 784x37
RenderText {TEXT} at (0,16) size 27x18
text run at (0,16) width 27: "text "
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {FORM} at (0,0) size 784x19
- RenderRadioButton {INPUT} at (3,3) size 12x13
+ RenderBlock {INPUT} at (3,3) size 12x13
RenderText {TEXT} at (18,0) size 34x18
text run at (18,0) width 34: "Two "
- RenderRadioButton {INPUT} at (55,3) size 12x13
+ RenderBlock {INPUT} at (55,3) size 12x13
RenderText {TEXT} at (70,0) size 37x18
text run at (70,0) width 37: "Three"
RenderBlock {FORM} at (0,35) size 784x19
- RenderRadioButton {INPUT} at (3,3) size 12x13
+ RenderBlock {INPUT} at (3,3) size 12x13
RenderText {TEXT} at (18,0) size 31x18
text run at (18,0) width 31: "One "
- RenderRadioButton {INPUT} at (52,3) size 12x13
+ RenderBlock {INPUT} at (52,3) size 12x13
RenderText {TEXT} at (67,0) size 34x18
text run at (67,0) width 34: "Two "
- RenderRadioButton {INPUT} at (104,3) size 12x13
+ RenderBlock {INPUT} at (104,3) size 12x13
RenderText {TEXT} at (119,0) size 41x18
text run at (119,0) width 41: "Three "
- RenderRadioButton {INPUT} at (163,3) size 12x13
+ RenderBlock {INPUT} at (163,3) size 12x13
RenderText {TEXT} at (178,0) size 27x18
text run at (178,0) width 27: "One"
RenderBlock (anonymous) at (0,70) size 784x36
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {FORM} at (0,0) size 784x19
- RenderRadioButton {INPUT} at (3,3) size 12x13
- RenderRadioButton {INPUT} at (21,3) size 12x13
+ RenderBlock {INPUT} at (3,3) size 12x13
+ RenderBlock {INPUT} at (21,3) size 12x13
RenderBlock (anonymous) at (0,35) size 784x36
RenderText {TEXT} at (0,0) size 777x36
text run at (0,0) width 777: "There should be two elements in the first form and one in the second. The count in form one is 2, and the count in form two"
RenderText {TEXT} at (1,1) size 216x18
text run at (1,1) width 216: "radio with value property changed"
RenderTableCell {TD} at (389,148) size 236x21 [r=6 c=1 rs=1 cs=1]
- RenderRadioButton {INPUT} at (4,4) size 12x13
+ RenderBlock {INPUT} at (4,4) size 12x13
RenderTableCell {TD} at (627,148) size 62x20 [r=6 c=2 rs=1 cs=1]
RenderText {TEXT} at (1,1) size 28x18
text run at (1,1) width 28: "after"
+2005-08-08 David Hyatt <hyatt@apple.com>
+
+ This patch implements support for <input type=radio> in the engine and removes the NSView-based
+ control.
+
+ Reviewed by: John Sullivan
+
+ * ForwardingHeaders/qradiobutton.h: Removed.
+ * WebCore.xcodeproj/project.pbxproj:
+ Removing the old QRadioButton from the project.
+
+ * khtml/css/html4.css:
+ Add the CSS rule to give radio buttons the correct appearance.
+
+ * khtml/html/html_formimpl.cpp:
+ (DOM::HTMLInputElementImpl::click):
+ Now that radio button has no corresponding QWidget, move its click handling case down to match
+ the other widget-less controls.
+
+ (DOM::HTMLInputElementImpl::createRenderer):
+ The special renderer doesn't have to be made any more. Radio now behaves like checkbox and just
+ makes a renderer based off the specified display type in CSS.
+
+ (DOM::HTMLInputElementImpl::setChecked):
+ Fix a regression that prevented unnamed checkboxes from functioning properly. Make sure to
+ only disallow the selecting of unnamed radio buttons.
+
+ (DOM::HTMLInputElementImpl::valueWithDefault):
+ Fix some mis-indented ifdefs.
+
+ (DOM::HTMLInputElementImpl::preDispatchEventHandler):
+ Added a new event handler method that is called prior to the dispatch of the event into the DOM.
+ This function is necessary because checkboxes and radio buttons need to check/uncheck *prior* to
+ the onclick actually being sent into the DOM.
+
+ (DOM::HTMLInputElementImpl::defaultEventHandler):
+ Remove the code that attempted to check/uncheck checkboxes from this function, since it was called
+ *after* onclick was handled in the DOM, and this was too late. The code has moved into
+ preDispatchEventHandler instead.
+
+ * khtml/html/html_formimpl.h:
+ * khtml/rendering/render_form.cpp:
+ * khtml/rendering/render_form.h:
+ Removed RenderRadioButton, the custom renderer that used to wrap QRadioButton.
+
+ * khtml/rendering/render_theme.cpp:
+ (khtml::RenderTheme::adjustStyle):
+ (khtml::RenderTheme::paint):
+ Add the radio button case to these methods.
+
+ (khtml::RenderTheme::adjustCheckboxStyle):
+ (khtml::RenderTheme::adjustRadioStyle):
+ Rework these methods to move all of the control size selection based off font into the
+ derived class. These methods stay in the base class and call a virtual setCheckbox/RadioSize
+ method to get the size set up properly.
+
+ * khtml/rendering/render_theme.h:
+ (khtml::RenderTheme::setCheckboxSize):
+ (khtml::RenderTheme::setRadioSize):
+ The two new virtual methods that a derived class can override to set initial sizes.
+
+ * khtml/rendering/render_theme_mac.h:
+ * khtml/rendering/render_theme_mac.mm:
+ (khtml::RenderThemeMac::inflateRect):
+ (khtml::RenderThemeMac::setControlSize):
+ (khtml::RenderThemeMac::sizeForFont):
+ (khtml::RenderThemeMac::setSizeFromFont):
+ (khtml::RenderThemeMac::checkboxSizes):
+ (khtml::RenderThemeMac::setCheckboxCellState):
+ (khtml::RenderThemeMac::setCheckboxSize):
+ Patched all of these methods to deal with QSizes instead of ints, since radio buttons are not
+ square.
+
+ (khtml::RenderThemeMac::paintRadio):
+ (khtml::RenderThemeMac::radioSizes):
+ (khtml::RenderThemeMac::radioMargins):
+ (khtml::RenderThemeMac::setRadioCellState):
+ (khtml::RenderThemeMac::setRadioSize):
+ The implementation of radio buttons. Virtually identical to checkbox.
+
+ * khtml/xml/dom_nodeimpl.cpp:
+ (DOM::NodeImpl::dispatchGenericEvent):
+ Add the invocation of preDispatchEventHandler prior to the dispatch of the event.
+
+ * khtml/xml/dom_nodeimpl.h:
+ (DOM::NodeImpl::preDispatchEventHandler):
+ The stubbed out empty virtual function in the base class. Overridden in HTMLInputElementImpl
+ to check/uncheck radio buttons and checkboxes prior to the click event being sent into the DOM.
+
+ * kwq/KWQAccObject.mm:
+ (-[KWQAccObject actionElement]):
+ (-[KWQAccObject role]):
+ (-[KWQAccObject roleDescription]):
+ (-[KWQAccObject value]):
+ (-[KWQAccObject accessibilityIsAttributeSettable:]):
+ The implementation of radio button accessibility. Identical to checkbox (just a different role).
+
+ * kwq/KWQRadioButton.h: Removed.
+ * kwq/KWQRadioButton.mm: Removed.
+ Removed the old radio button files for QRadioButton.
+
2005-08-08 Eric Seidel <eseidel@apple.com>
Reviewed by darin.
+++ /dev/null
-#import "KWQRadioButton.h"
93F1998408245E59001E9ABC /* KWQPtrStack.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B802DE3B8601EA4122 /* KWQPtrStack.h */; };
93F1998508245E59001E9ABC /* KWQPtrVector.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786C402DE3B8601EA4122 /* KWQPtrVector.h */; };
93F1998608245E59001E9ABC /* KWQPushButton.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B002DE3B8601EA4122 /* KWQPushButton.h */; };
- 93F1998708245E59001E9ABC /* KWQRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B102DE3B8601EA4122 /* KWQRadioButton.h */; };
93F1998808245E59001E9ABC /* KWQRect.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B202DE3B8601EA4122 /* KWQRect.h */; };
93F1998908245E59001E9ABC /* KWQRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = F587852A02DE375901EA4122 /* KWQRefPtr.h */; };
93F1998A08245E59001E9ABC /* KWQRegExp.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B302DE3B8601EA4122 /* KWQRegExp.h */; };
93F19A4508245E59001E9ABC /* KWQPoint.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852302DE375901EA4122 /* KWQPoint.mm */; };
93F19A4608245E59001E9ABC /* KWQPointArray.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852402DE375901EA4122 /* KWQPointArray.mm */; };
93F19A4708245E59001E9ABC /* KWQPtrDictImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852602DE375901EA4122 /* KWQPtrDictImpl.mm */; };
- 93F19A4808245E59001E9ABC /* KWQRadioButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852802DE375901EA4122 /* KWQRadioButton.mm */; };
93F19A4908245E59001E9ABC /* KWQRect.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852902DE375901EA4122 /* KWQRect.mm */; };
93F19A4A08245E59001E9ABC /* KWQRegExp.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852B02DE375901EA4122 /* KWQRegExp.mm */; };
93F19A4B08245E59001E9ABC /* KWQRegion.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852C02DE375901EA4122 /* KWQRegion.mm */; };
A8212B4F08794A2300677359 /* KWQPtrStack.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B802DE3B8601EA4122 /* KWQPtrStack.h */; };
A8212B5008794A2300677359 /* KWQPtrVector.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786C402DE3B8601EA4122 /* KWQPtrVector.h */; };
A8212B5108794A2300677359 /* KWQPushButton.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B002DE3B8601EA4122 /* KWQPushButton.h */; };
- A8212B5208794A2300677359 /* KWQRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B102DE3B8601EA4122 /* KWQRadioButton.h */; };
A8212B5308794A2300677359 /* KWQRect.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B202DE3B8601EA4122 /* KWQRect.h */; };
A8212B5408794A2300677359 /* KWQRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = F587852A02DE375901EA4122 /* KWQRefPtr.h */; };
A8212B5508794A2300677359 /* KWQRegExp.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B302DE3B8601EA4122 /* KWQRegExp.h */; };
A8212C2C08794A2300677359 /* KWQPoint.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852302DE375901EA4122 /* KWQPoint.mm */; };
A8212C2D08794A2300677359 /* KWQPointArray.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852402DE375901EA4122 /* KWQPointArray.mm */; };
A8212C2E08794A2300677359 /* KWQPtrDictImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852602DE375901EA4122 /* KWQPtrDictImpl.mm */; };
- A8212C2F08794A2300677359 /* KWQRadioButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852802DE375901EA4122 /* KWQRadioButton.mm */; };
A8212C3008794A2300677359 /* KWQRect.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852902DE375901EA4122 /* KWQRect.mm */; };
A8212C3108794A2300677359 /* KWQRegExp.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852B02DE375901EA4122 /* KWQRegExp.mm */; };
A8212C3208794A2300677359 /* KWQRegion.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587852C02DE375901EA4122 /* KWQRegion.mm */; };
F587852402DE375901EA4122 /* KWQPointArray.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQPointArray.mm; sourceTree = "<group>"; };
F587852502DE375901EA4122 /* KWQPtrDictImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQPtrDictImpl.h; sourceTree = "<group>"; };
F587852602DE375901EA4122 /* KWQPtrDictImpl.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQPtrDictImpl.mm; sourceTree = "<group>"; };
- F587852802DE375901EA4122 /* KWQRadioButton.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQRadioButton.mm; sourceTree = "<group>"; };
F587852902DE375901EA4122 /* KWQRect.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQRect.mm; sourceTree = "<group>"; };
F587852A02DE375901EA4122 /* KWQRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQRefPtr.h; sourceTree = "<group>"; };
F587852B02DE375901EA4122 /* KWQRegExp.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQRegExp.mm; sourceTree = "<group>"; };
F58786AE02DE3B8601EA4122 /* KWQPtrStack.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQPtrStack.h; sourceTree = "<group>"; };
F58786AF02DE3B8601EA4122 /* KWQPtrVector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQPtrVector.h; sourceTree = "<group>"; };
F58786B002DE3B8601EA4122 /* KWQPushButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQPushButton.h; sourceTree = "<group>"; };
- F58786B102DE3B8601EA4122 /* KWQRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQRadioButton.h; sourceTree = "<group>"; };
F58786B202DE3B8601EA4122 /* KWQRect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQRect.h; sourceTree = "<group>"; };
F58786B302DE3B8601EA4122 /* KWQRegExp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQRegExp.h; sourceTree = "<group>"; };
F58786B402DE3B8601EA4122 /* KWQRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQRegion.h; sourceTree = "<group>"; };
F58786AF02DE3B8601EA4122 /* KWQPtrVector.h */,
F58786B002DE3B8601EA4122 /* KWQPushButton.h */,
F550D70A02E13281018635CA /* KWQPushButton.mm */,
- F58786B102DE3B8601EA4122 /* KWQRadioButton.h */,
- F587852802DE375901EA4122 /* KWQRadioButton.mm */,
F58786B202DE3B8601EA4122 /* KWQRect.h */,
F587852902DE375901EA4122 /* KWQRect.mm */,
F58786B302DE3B8601EA4122 /* KWQRegExp.h */,
93F1998408245E59001E9ABC /* KWQPtrStack.h in Headers */,
93F1998508245E59001E9ABC /* KWQPtrVector.h in Headers */,
93F1998608245E59001E9ABC /* KWQPushButton.h in Headers */,
- 93F1998708245E59001E9ABC /* KWQRadioButton.h in Headers */,
93F1998808245E59001E9ABC /* KWQRect.h in Headers */,
93F1998908245E59001E9ABC /* KWQRefPtr.h in Headers */,
93F1998A08245E59001E9ABC /* KWQRegExp.h in Headers */,
A8212B4F08794A2300677359 /* KWQPtrStack.h in Headers */,
A8212B5008794A2300677359 /* KWQPtrVector.h in Headers */,
A8212B5108794A2300677359 /* KWQPushButton.h in Headers */,
- A8212B5208794A2300677359 /* KWQRadioButton.h in Headers */,
A8212B5308794A2300677359 /* KWQRect.h in Headers */,
A8212B5408794A2300677359 /* KWQRefPtr.h in Headers */,
A8212B5508794A2300677359 /* KWQRegExp.h in Headers */,
93F19A4508245E59001E9ABC /* KWQPoint.mm in Sources */,
93F19A4608245E59001E9ABC /* KWQPointArray.mm in Sources */,
93F19A4708245E59001E9ABC /* KWQPtrDictImpl.mm in Sources */,
- 93F19A4808245E59001E9ABC /* KWQRadioButton.mm in Sources */,
93F19A4908245E59001E9ABC /* KWQRect.mm in Sources */,
93F19A4A08245E59001E9ABC /* KWQRegExp.mm in Sources */,
93F19A4B08245E59001E9ABC /* KWQRegion.mm in Sources */,
A8212C2C08794A2300677359 /* KWQPoint.mm in Sources */,
A8212C2D08794A2300677359 /* KWQPointArray.mm in Sources */,
A8212C2E08794A2300677359 /* KWQPtrDictImpl.mm in Sources */,
- A8212C2F08794A2300677359 /* KWQRadioButton.mm in Sources */,
A8212C3008794A2300677359 /* KWQRect.mm in Sources */,
A8212C3108794A2300677359 /* KWQRegExp.mm in Sources */,
A8212C3208794A2300677359 /* KWQRegion.mm in Sources */,
-khtml-appearance: checkbox
}
+input[type="radio"] {
+ -khtml-appearance: radio
+}
+
/* inline elements */
u, ins {
case HIDDEN:
// a no-op for this type
break;
- case RADIO:
case SUBMIT:
case RESET:
case BUTTON:
HTMLGenericFormElementImpl::click(sendMouseEvents, showPressedLook);
break;
case CHECKBOX:
+ case RADIO:
case IMAGE:
case ISINDEX:
case PASSWORD:
case SEARCH:
#endif
case ISINDEX: return new (arena) RenderLineEdit(this);
- case CHECKBOX: return RenderObject::createObject(this, style);
- case RADIO: return new (arena) RenderRadioButton(this);
+ case CHECKBOX:
+ case RADIO:
+ return RenderObject::createObject(this, style);
case SUBMIT: return new (arena) RenderSubmitButton(this);
case IMAGE: return new (arena) RenderImageButton(this);
case RESET: return new (arena) RenderResetButton(this);
void HTMLInputElementImpl::setChecked(bool _checked)
{
// WinIE does not allow unnamed radio buttons to even be checked.
- if (checked() == _checked || name().isEmpty())
+ if (checked() == _checked || (m_type == RADIO && name().isEmpty()))
return;
if (m_form && m_type == RADIO && _checked)
case ISINDEX:
case PASSWORD:
case RADIO:
- #if APPLE_CHANGES
+#if APPLE_CHANGES
case RANGE:
case SEARCH:
- #endif
+#endif
case TEXT:
break;
}
getDocument()->setFocusNode(this);
}
+void HTMLInputElementImpl::preDispatchEventHandler(EventImpl *evt)
+{
+ if (evt->isMouseEvent() && evt->id() == EventImpl::CLICK_EVENT && static_cast<MouseEventImpl*>(evt)->button() == 0) {
+ if (m_type == CHECKBOX || m_type == RADIO)
+ setChecked(!checked());
+ }
+}
+
void HTMLInputElementImpl::defaultEventHandler(EventImpl *evt)
{
if (evt->isMouseEvent() &&
}
m_activeSubmit = false;
}
- } else if (m_type == CHECKBOX || m_type == RADIO) {
- if (m_type == CHECKBOX || (renderer() && renderer()->style()->hasAppearance()))
- // FIXME: We key off appearance for now, but this is temporary. When we cut over
- // for real this will just always be used.
- setChecked(!checked());
- }
+ }
}
#if APPLE_CHANGES
class RenderTextArea;
class RenderSelect;
class RenderLineEdit;
- class RenderRadioButton;
class RenderFileButton;
#if APPLE_CHANGES
class RenderSlider;
class HTMLInputElementImpl : public HTMLGenericFormElementImpl
{
friend class khtml::RenderLineEdit;
- friend class khtml::RenderRadioButton;
friend class khtml::RenderFileButton;
#if APPLE_CHANGES
int clickX() const { return xPos; }
int clickY() const { return yPos; }
+ virtual void preDispatchEventHandler(EventImpl *evt);
virtual void defaultEventHandler(EventImpl *evt);
virtual bool isEditable();
// -------------------------------------------------------------------------------
-RenderRadioButton::RenderRadioButton(HTMLInputElementImpl *element)
- : RenderButton(element)
-{
- QRadioButton* b = new QRadioButton(view()->viewport());
- b->setAutoMask(true);
- b->setMouseTracking(true);
- setQWidget(b);
- connect(b, SIGNAL(clicked()), this, SLOT(slotClicked()));
-}
-
-void RenderRadioButton::updateFromElement()
-{
- widget()->setChecked(element()->checked());
-
- RenderButton::updateFromElement();
-}
-
-void RenderRadioButton::slotClicked()
-{
- element()->setChecked(true);
-
- // emit mouseClick event etc
- RenderButton::slotClicked();
-}
-
-void RenderRadioButton::calcMinMaxWidth()
-{
- KHTMLAssert( !minMaxKnown() );
-
-#if APPLE_CHANGES
- // Let the widget tell us how big it wants to be.
- QSize s(widget()->sizeHint());
-#else
- QRadioButton *rb = static_cast<QRadioButton *>( m_widget );
- QSize s( rb->style().pixelMetric( QStyle::PM_ExclusiveIndicatorWidth ),
- rb->style().pixelMetric( QStyle::PM_ExclusiveIndicatorHeight ) );
-#endif
- setIntrinsicWidth( s.width() );
- setIntrinsicHeight( s.height() );
-
- RenderButton::calcMinMaxWidth();
-}
-
-// -------------------------------------------------------------------------------
-
RenderSubmitButton::RenderSubmitButton(HTMLInputElementImpl *element)
: RenderButton(element)
{
#include <qtextedit.h>
#include <klineedit.h>
-#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qhbox.h>
#include <klistbox.h>
// -------------------------------------------------------------------------
-class RenderRadioButton : public RenderButton
-{
- Q_OBJECT
-public:
- RenderRadioButton(DOM::HTMLInputElementImpl* node);
-
- virtual const char *renderName() const { return "RenderRadioButton"; }
-
- virtual void calcMinMaxWidth();
- virtual void updateFromElement();
-
- QRadioButton *widget() const { return static_cast<QRadioButton*>(m_widget); }
-
-public slots:
- void slotClicked();
-};
-
-// -------------------------------------------------------------------------
-
class RenderSubmitButton : public RenderButton
{
public:
switch (style->appearance()) {
case CheckboxAppearance:
return adjustCheckboxStyle(style);
+ case RadioAppearance:
+ return adjustRadioStyle(style);
default:
break;
}
switch (o->style()->appearance()) {
case CheckboxAppearance:
return paintCheckbox(o, i, r);
+ case RadioAppearance:
+ return paintRadio(o, i, r);
default:
break;
}
return o->element()->active();
}
-int RenderTheme::sizeForFont(RenderStyle* style) const
-{
- return style->fontSize();
-}
-
-void RenderTheme::setSizeFromFont(RenderStyle* style) const
-{
- int size = sizeForFont(style);
- if (style->width().isVariable())
- style->setWidth(Length(size, Fixed));
- if (style->height().isVariable())
- style->setHeight(Length(size, Fixed));
-}
-
-void RenderTheme::setCheckboxSize(RenderStyle* style) const
+void RenderTheme::adjustCheckboxStyle(RenderStyle* style) const
{
- // If the width and height are both specified, then we have nothing to do.
- if (!style->width().isVariable() && !style->height().isVariable())
- return;
+ // A summary of the rules for checkbox designed to match WinIE:
+ // width/height - honored (WinIE actually scales its control for small widths, but lets it overflow for small heights.)
+ // font-size - not honored (control has no text), but we use it to decide which control size to use.
+ setCheckboxSize(style);
+
+ // padding - not honored by WinIE, needs to be removed.
+ style->resetPadding();
- // Use the font size to determine the intrinsic width of the control.
- setSizeFromFont(style);
+ // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme)
+ // for now, we will not honor it.
+ style->resetBorder();
}
-void RenderTheme::adjustCheckboxStyle(RenderStyle* style) const
+void RenderTheme::adjustRadioStyle(RenderStyle* style) const
{
// A summary of the rules for checkbox designed to match WinIE:
// width/height - honored (WinIE actually scales its control for small widths, but lets it overflow for small heights.)
// font-size - not honored (control has no text), but we use it to decide which control size to use.
- setCheckboxSize(style);
+ setRadioSize(style);
// padding - not honored by WinIE, needs to be removed.
style->resetPadding();
// Methods for each appearance value.
virtual void adjustCheckboxStyle(RenderStyle* style) const;
virtual void paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r) = 0;
- virtual int sizeForFont(RenderStyle* style) const;
-
- void setSizeFromFont(RenderStyle* style) const;
- void setCheckboxSize(RenderStyle* style) const;
-
+ virtual void setCheckboxSize(RenderStyle* style) const {};
+
+ virtual void adjustRadioStyle(RenderStyle* style) const;
+ virtual void paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r) = 0;
+ virtual void setRadioSize(RenderStyle* style) const {};
};
// Function to obtain the theme. This is implemented in your platform-specific theme implementation to hand
protected:
// Methods for each appearance value.
virtual void paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r);
- virtual int sizeForFont(RenderStyle* style) const;
+ virtual void setCheckboxSize(RenderStyle* style) const;
+
+ virtual void paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r);
+ virtual void setRadioSize(RenderStyle* style) const;
private:
- QRect inflateRect(const QRect& r, int size, const int* margins) const;
+ QRect inflateRect(const QRect& r, const QSize& size, const int* margins) const;
// Get the control size based off the font. Used by some of the controls (like buttons).
NSControlSize controlSizeForFont(RenderStyle* style) const;
- void setControlSize(NSCell* cell, const int* sizes, int minSize);
+ void setControlSize(NSCell* cell, const QSize* sizes, const QSize& minSize);
+ void setSizeFromFont(RenderStyle* style, const QSize* sizes) const;
+ QSize sizeForFont(RenderStyle* style, const QSize* sizes) const;
void updateCheckedState(NSCell* cell, const RenderObject* o);
void updateEnabledState(NSCell* cell, const RenderObject* o);
void updatePressedState(NSCell* cell, const RenderObject* o);
// Helpers for adjusting appearance and for painting
- const int* checkboxSizes() const;
+ const QSize* checkboxSizes() const;
const int* checkboxMargins() const;
void setCheckboxCellState(const RenderObject* o, const QRect& r);
-
+
+ const QSize* radioSizes() const;
+ const int* radioMargins() const;
+ void setRadioCellState(const RenderObject* o, const QRect& r);
+
private:
NSButtonCell* checkbox;
+ NSButtonCell* radio;
};
}
}
}
-QRect RenderThemeMac::inflateRect(const QRect& r, int size, const int* margins) const
+QRect RenderThemeMac::inflateRect(const QRect& r, const QSize& size, const int* margins) const
{
// Only do the inflation if the available width/height are too small. Otherwise try to
// fit the glow/check space into the available box's width/height.
- int widthDelta = r.width() - (size + margins[leftMargin] + margins[rightMargin]);
- int heightDelta = r.height() - (size + margins[topMargin] + margins[bottomMargin]);
+ int widthDelta = r.width() - (size.width() + margins[leftMargin] + margins[rightMargin]);
+ int heightDelta = r.height() - (size.height() + margins[topMargin] + margins[bottomMargin]);
QRect result(r);
if (widthDelta < 0) {
result.setX(result.x() - margins[leftMargin]);
short RenderThemeMac::baselinePosition(const RenderObject* o) const
{
- if (o->style()->appearance() == CheckboxAppearance)
- return o->marginTop() + o->height() - 2; // The baseline is 2px up from the bottom of the checkbox in AppKit.
+ if (o->style()->appearance() == CheckboxAppearance || o->style()->appearance() == RadioAppearance)
+ return o->marginTop() + o->height() - 2; // The baseline is 2px up from the bottom of the checkbox/radio in AppKit.
return RenderTheme::baselinePosition(o);
}
return NSMiniControlSize;
}
-int RenderThemeMac::sizeForFont(RenderStyle* style) const
-{
- return checkboxSizes()[controlSizeForFont(style)];
-}
-
-void RenderThemeMac::setControlSize(NSCell* cell, const int* sizes, int minSize)
+void RenderThemeMac::setControlSize(NSCell* cell, const QSize* sizes, const QSize& minSize)
{
NSControlSize size;
- if (minSize >= sizes[NSRegularControlSize])
+ if (minSize.width() >= sizes[NSRegularControlSize].width() &&
+ minSize.height() >= sizes[NSRegularControlSize].height())
size = NSRegularControlSize;
- else if (minSize >= sizes[NSSmallControlSize])
+ else if (minSize.width() >= sizes[NSSmallControlSize].width() &&
+ minSize.height() >= sizes[NSSmallControlSize].height())
size = NSSmallControlSize;
else
size = NSMiniControlSize;
[cell setControlSize:size];
}
+QSize RenderThemeMac::sizeForFont(RenderStyle* style, const QSize* sizes) const
+{
+ return sizes[controlSizeForFont(style)];
+}
+
+void RenderThemeMac::setSizeFromFont(RenderStyle* style, const QSize* sizes) const
+{
+ QSize size = sizeForFont(style, sizes);
+ if (style->width().isVariable())
+ style->setWidth(Length(size.width(), Fixed));
+ if (style->height().isVariable())
+ style->setHeight(Length(size.height(), Fixed));
+}
+
void RenderThemeMac::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r)
{
// Determine the width and height needed for the control and prepare the cell for painting.
[checkbox setControlView: nil];
}
-const int* RenderThemeMac::checkboxSizes() const
+const QSize* RenderThemeMac::checkboxSizes() const
{
- static const int sizes[3] = { 14, 12, 10 };
+ static const QSize sizes[3] = { QSize(14, 14), QSize(12, 12), QSize(10, 10) };
return sizes;
}
}
// Set the control size based off the rectangle we're painting into.
- setControlSize(checkbox, checkboxSizes(), kMin(r.width(), r.height()));
+ setControlSize(checkbox, checkboxSizes(), QSize(r.width(), r.height()));
// Update the various states we respond to.
updateCheckedState(checkbox, o);
updateFocusedState(checkbox, o);
}
+
+void RenderThemeMac::setCheckboxSize(RenderStyle* style) const
+{
+ // If the width and height are both specified, then we have nothing to do.
+ if (!style->width().isVariable() && !style->height().isVariable())
+ return;
+
+ // Use the font size to determine the intrinsic width of the control.
+ setSizeFromFont(style, checkboxSizes());
+}
+
+void RenderThemeMac::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r)
+{
+ // Determine the width and height needed for the control and prepare the cell for painting.
+ setRadioCellState(o, r);
+
+ // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox
+ // shadow" and the check. We don't consider this part of the bounds of the control in WebKit.
+ QRect inflatedRect = inflateRect(r, radioSizes()[[radio controlSize]], radioMargins());
+ [radio drawWithFrame:NSRect(inflatedRect) inView:o->canvas()->view()->getDocumentView()];
+ [radio setControlView: nil];
+}
+
+const QSize* RenderThemeMac::radioSizes() const
+{
+ static const QSize sizes[3] = { QSize(14, 15), QSize(12, 13), QSize(10, 10) };
+ return sizes;
+}
+
+const int* RenderThemeMac::radioMargins() const
+{
+ static const int margins[3][4] =
+ {
+ { 2, 2, 4, 2 },
+ { 3, 2, 3, 2 },
+ { 1, 0, 2, 0 },
+ };
+ return margins[[radio controlSize]];
+}
+
+void RenderThemeMac::setRadioCellState(const RenderObject* o, const QRect& r)
+{
+ if (!radio) {
+ radio = [[NSButtonCell alloc] init];
+ [radio setButtonType:NSRadioButton];
+ [radio setTitle:nil];
+ }
+
+ // Set the control size based off the rectangle we're painting into.
+ setControlSize(radio, radioSizes(), QSize(r.width(), r.height()));
+
+ // Update the various states we respond to.
+ updateCheckedState(radio, o);
+ updateEnabledState(radio, o);
+ updatePressedState(radio, o);
+ updateFocusedState(radio, o);
+}
+
+
+void RenderThemeMac::setRadioSize(RenderStyle* style) const
+{
+ // If the width and height are both specified, then we have nothing to do.
+ if (!style->width().isVariable() && !style->height().isVariable())
+ return;
+
+ // Use the font size to determine the intrinsic width of the control.
+ setSizeFromFont(style, radioSizes());
+}
+
}
nodeChain.prepend(n);
}
+
+ QPtrListIterator<NodeImpl> it(nodeChain);
+
+ // Before we begin dispatching events, give each node a chance to do some work prior
+ // to the DOM event handlers getting a crack.
+ for (; it.current() && !evt->propagationStopped(); ++it)
+ it.current()->preDispatchEventHandler(evt);
+
// trigger any capturing event handlers on our way down
evt->setEventPhase(Event::CAPTURING_PHASE);
- QPtrListIterator<NodeImpl> it(nodeChain);
+ it.toFirst();
for (; it.current() && it.current() != this && !evt->propagationStopped(); ++it) {
evt->setCurrentTarget(it.current());
it.current()->handleLocalEvents(evt,true);
void handleLocalEvents(EventImpl *evt, bool useCapture);
+ // A handler to do actions before an event is dispatched.
+ virtual void preDispatchEventHandler(EventImpl *evt) {};
+
/**
* Perform the default action for an event e.g. submitting a form
*/
{
if (m_renderer->element() && m_renderer->element()->hasTagName(inputTag)) {
HTMLInputElementImpl* input = static_cast<HTMLInputElementImpl*>(m_renderer->element());
- if (!input->disabled() && input->inputType() == HTMLInputElementImpl::CHECKBOX)
+ if (!input->disabled() && (input->inputType() == HTMLInputElementImpl::CHECKBOX ||
+ input->inputType() == HTMLInputElementImpl::RADIO))
return input;
}
HTMLInputElementImpl* input = static_cast<HTMLInputElementImpl*>(m_renderer->element());
if (input->inputType() == HTMLInputElementImpl::CHECKBOX)
return NSAccessibilityCheckBoxRole;
+ if (input->inputType() == HTMLInputElementImpl::RADIO)
+ return NSAccessibilityRadioButtonRole;
}
if (m_renderer->isBlockFlow())
if ([role isEqualToString:NSAccessibilityCheckBoxRole])
return NSAccessibilityRoleDescription(NSAccessibilityCheckBoxRole, nil);
+
+ if ([role isEqualToString:NSAccessibilityRadioButtonRole])
+ return NSAccessibilityRoleDescription(NSAccessibilityRadioButtonRole, nil);
if ([role isEqualToString:@"AXWebArea"])
return UI_STRING("web area", "accessibility role description for web area");
if (m_renderer->element() && m_renderer->element()->hasTagName(inputTag)) {
HTMLInputElementImpl* input = static_cast<HTMLInputElementImpl*>(m_renderer->element());
- if (input->inputType() == HTMLInputElementImpl::CHECKBOX)
+ if (input->inputType() == HTMLInputElementImpl::CHECKBOX ||
+ input->inputType() == HTMLInputElementImpl::RADIO)
// Checkboxes return their state as an integer. 0 for off, 1 for on.
return [NSNumber numberWithInt:input->checked()];
}
return YES;
if ([attributeName isEqualToString: NSAccessibilityFocusedAttribute]) {
if ([[self role] isEqualToString:@"AXLink"] ||
- ([[self role] isEqualToString:NSAccessibilityCheckBoxRole] &&
+ (([[self role] isEqualToString:NSAccessibilityCheckBoxRole] ||
+ ([[self role] isEqualToString:NSAccessibilityRadioButtonRole])) &&
m_renderer->element()->isEnabled()))
return YES;
}
} else if ([attributeName isEqualToString: NSAccessibilityFocusedAttribute]) {
ASSERT(number);
if ([[self role] isEqualToString:@"AXLink"] ||
- ([[self role] isEqualToString:NSAccessibilityCheckBoxRole] &&
+ (([[self role] isEqualToString:NSAccessibilityCheckBoxRole] ||
+ ([[self role] isEqualToString:NSAccessibilityRadioButtonRole])) &&
m_renderer->element()->isEnabled())) {
if ([number intValue] != 0)
m_renderer->document()->setFocusNode(m_renderer->element());
+++ /dev/null
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef QRADIOBUTTON_H_
-#define QRADIOBUTTON_H_
-
-#include "KWQButton.h"
-
-class QRadioButton : public QButton {
-public:
- QRadioButton(QWidget *);
-
- void setChecked(bool);
- bool isChecked() const;
-
- QSize sizeHint() const;
- int baselinePosition(int height) const;
- QRect frameGeometry() const;
- void setFrameGeometry(const QRect &);
-
-private:
- const int *dimensions() const;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "KWQRadioButton.h"
-
-#import "KWQExceptions.h"
-
-enum {
- topMargin,
- bottomMargin,
- leftMargin,
- rightMargin,
- baselineFudgeFactor,
- dimWidth,
- dimHeight
-};
-
-QRadioButton::QRadioButton(QWidget *w)
-{
- NSButton *button = (NSButton *)getView();
- KWQ_BLOCK_EXCEPTIONS;
- [button setButtonType:NSRadioButton];
- KWQ_UNBLOCK_EXCEPTIONS;
-}
-
-QSize QRadioButton::sizeHint() const
-{
- return QSize(dimensions()[dimWidth], dimensions()[dimHeight]);
-}
-
-QRect QRadioButton::frameGeometry() const
-{
- QRect r = QWidget::frameGeometry();
- return QRect(r.x() + dimensions()[leftMargin], r.y() + dimensions()[topMargin],
- r.width() - (dimensions()[leftMargin] + dimensions()[rightMargin]),
- r.height() - (dimensions()[topMargin] + dimensions()[bottomMargin]));
-}
-
-void QRadioButton::setFrameGeometry(const QRect &r)
-{
- QWidget::setFrameGeometry(QRect(r.x() - dimensions()[leftMargin], r.y() - dimensions()[topMargin],
- r.width() + dimensions()[leftMargin] + dimensions()[rightMargin],
- r.height() + dimensions()[topMargin] + dimensions()[bottomMargin]));
-}
-
-void QRadioButton::setChecked(bool isChecked)
-{
- NSButton *button = (NSButton *)getView();
- KWQ_BLOCK_EXCEPTIONS;
- [button setState:isChecked ? NSOnState : NSOffState];
- KWQ_UNBLOCK_EXCEPTIONS;
-}
-
-bool QRadioButton::isChecked() const
-{
- NSButton *button = (NSButton *)getView();
-
- KWQ_BLOCK_EXCEPTIONS;
- return [button state] == NSOnState;
- KWQ_UNBLOCK_EXCEPTIONS;
-
- return false;
-}
-
-int QRadioButton::baselinePosition(int height) const
-{
- return height - dimensions()[baselineFudgeFactor];
-}
-
-const int *QRadioButton::dimensions() const
-{
- // We empirically determined these dimensions.
- // It would be better to get this info from AppKit somehow.
- static const int w[3][7] = {
- { 2, 4, 2, 2, 2, 14, 15 },
- { 3, 3, 2, 2, 2, 12, 13 },
- { 1, 2, 0, 0, 2, 10, 10 },
- };
- NSControl * const button = static_cast<NSControl *>(getView());
-
- KWQ_BLOCK_EXCEPTIONS;
- return w[[[button cell] controlSize]];
- KWQ_UNBLOCK_EXCEPTIONS;
-
- return w[NSSmallControlSize];
-}