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 dguihub.button; 10 11 import dguihub.core.controls.abstractbutton; 12 13 /// Standarde windows _Button 14 class Button : AbstractButton { 15 /** 16 Returns: 17 A DialogResult enum (ok, ignore, close, yes, no, cancel, ...) 18 19 See_Also: 20 Form.showDialog() 21 */ 22 @property public DialogResult dialogResult() { 23 return this._dr; 24 } 25 26 /** 27 Sets DialogResult for a button 28 29 Params: 30 dr = DialogResult of the button. 31 32 See_Also: 33 Form.showDialog() 34 */ 35 @property public void dialogResult(DialogResult dr) { 36 this._dr = dr; 37 } 38 39 protected override void createControlParams(ref CreateControlParams ccp) { 40 switch (this._drawMode) { 41 case OwnerDrawMode.normal: 42 this.setStyle(BS_PUSHBUTTON, true); 43 break; 44 45 case OwnerDrawMode.fixed, OwnerDrawMode.variable: 46 this.setStyle(BS_OWNERDRAW, true); 47 break; 48 49 default: 50 break; 51 } 52 53 ccp.className = WC_DBUTTON; 54 55 super.createControlParams(ccp); 56 } 57 } 58 59 /// Standard windows _CheckBox 60 class CheckBox : CheckedButton { 61 protected override void createControlParams(ref CreateControlParams ccp) { 62 switch (this._drawMode) { 63 case OwnerDrawMode.normal: 64 this.setStyle(BS_AUTOCHECKBOX, true); 65 break; 66 67 case OwnerDrawMode.fixed, OwnerDrawMode.variable: 68 this.setStyle(BS_OWNERDRAW, true); 69 break; 70 71 default: 72 break; 73 } 74 75 ccp.className = WC_DCHECKBOX; 76 77 super.createControlParams(ccp); 78 } 79 } 80 81 /// Standard windows _RadioButton 82 class RadioButton : CheckedButton { 83 protected override void createControlParams(ref CreateControlParams ccp) { 84 switch (this._drawMode) { 85 case OwnerDrawMode.normal: 86 this.setStyle(BS_AUTORADIOBUTTON, true); 87 break; 88 89 case OwnerDrawMode.fixed, OwnerDrawMode.variable: 90 this.setStyle(BS_OWNERDRAW, true); 91 break; 92 93 default: 94 break; 95 } 96 97 ccp.className = WC_DRADIOBUTTON; 98 99 super.createControlParams(ccp); 100 } 101 }