1 /** DGui project file. 2 3 Copyright: Trogu Antonio Davide 2011-2013 4 5 License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0). 6 7 Authors: Trogu Antonio Davide 8 */ 9 module dgui.button; 10 11 import dgui.core.controls.abstractbutton; 12 13 /// Standarde windows _Button 14 class Button: AbstractButton 15 { 16 /** 17 Returns: 18 A DialogResult enum (ok, ignore, close, yes, no, cancel, ...) 19 20 See_Also: 21 Form.showDialog() 22 */ 23 @property public DialogResult dialogResult() 24 { 25 return this._dr; 26 } 27 28 /** 29 Sets DialogResult for a button 30 31 Params: 32 dr = DialogResult of the button. 33 34 See_Also: 35 Form.showDialog() 36 */ 37 @property public void dialogResult(DialogResult dr) 38 { 39 this._dr = dr; 40 } 41 42 protected override void createControlParams(ref CreateControlParams ccp) 43 { 44 switch(this._drawMode) 45 { 46 case OwnerDrawMode.normal: 47 this.setStyle(BS_DEFPUSHBUTTON, true); 48 break; 49 50 case OwnerDrawMode.fixed, OwnerDrawMode.variable: 51 this.setStyle(BS_OWNERDRAW, true); 52 break; 53 54 default: 55 break; 56 } 57 58 ccp.className = WC_DBUTTON; 59 60 super.createControlParams(ccp); 61 } 62 } 63 64 /// Standard windows _CheckBox 65 class CheckBox: CheckedButton 66 { 67 protected override void createControlParams(ref CreateControlParams ccp) 68 { 69 switch(this._drawMode) 70 { 71 case OwnerDrawMode.normal: 72 this.setStyle(BS_AUTOCHECKBOX, true); 73 break; 74 75 case OwnerDrawMode.fixed, OwnerDrawMode.variable: 76 this.setStyle(BS_OWNERDRAW, true); 77 break; 78 79 default: 80 break; 81 } 82 83 ccp.className = WC_DCHECKBOX; 84 85 super.createControlParams(ccp); 86 } 87 } 88 89 /// Standard windows _RadioButton 90 class RadioButton: CheckedButton 91 { 92 protected override void createControlParams(ref CreateControlParams ccp) 93 { 94 switch(this._drawMode) 95 { 96 case OwnerDrawMode.normal: 97 this.setStyle(BS_AUTORADIOBUTTON, true); 98 break; 99 100 case OwnerDrawMode.fixed, OwnerDrawMode.variable: 101 this.setStyle(BS_OWNERDRAW, true); 102 break; 103 104 default: 105 break; 106 } 107 108 ccp.className = WC_DRADIOBUTTON; 109 110 super.createControlParams(ccp); 111 } 112 }