1 /** 2 * Outline color module. 3 * 4 * License: 5 * MIT. See LICENSE for full details. 6 */ 7 module tkd.widget.common.canvas.outlinecolor; 8 9 /** 10 * These are common commands that apply to all widgets that have them injected. 11 */ 12 mixin template OutlineColor() 13 { 14 /** 15 * The outline color. 16 */ 17 private string _outlineColor; 18 19 /** 20 * The active outline color. 21 */ 22 private string _activeOutlineColor; 23 24 /** 25 * The disabled outline color. 26 */ 27 private string _disabledOutlineColor; 28 29 /** 30 * Get the outline color. 31 * 32 * Returns: 33 * The outline color; 34 */ 35 public string getOutlineColor() 36 { 37 if (this._parent) 38 { 39 this._tk.eval("%s itemcget %s -outline", this._parent.id, this.id); 40 this._outlineColor = this._tk.getResult!(string); 41 } 42 43 return this._outlineColor; 44 } 45 46 /** 47 * Set the outline color. 48 * Use colors from the preset color $(LINK2 ../../../element/color.html, list) or a web style hex color. 49 * 50 * Params: 51 * color = The outline color. 52 * 53 * Returns: 54 * This widget to aid method chaining. 55 * 56 * See_Also: 57 * $(LINK2 ../../../element/color.html, tkd.widget.color) $(BR) 58 */ 59 public auto setOutlineColor(this T)(string color) 60 { 61 this._outlineColor = color; 62 63 if (this._parent && this._outlineColor.length) 64 { 65 this._tk.eval("%s itemconfigure %s -outline {%s}", this._parent.id, this.id, this._outlineColor); 66 } 67 68 return cast(T) this; 69 } 70 71 /** 72 * Get the active outline color. 73 * An item's active state is triggered when the mouse rolls over the item. 74 * 75 * Returns: 76 * The active outline color; 77 */ 78 public string getActiveOutlineColor() 79 { 80 if (this._parent) 81 { 82 this._tk.eval("%s itemcget %s -activeoutline", this._parent.id, this.id); 83 this._activeOutlineColor = this._tk.getResult!(string); 84 } 85 86 return this._activeOutlineColor; 87 } 88 89 /** 90 * Set the active outline color. 91 * An item's active state is triggered when the mouse rolls over the item. 92 * Use colors from the preset color $(LINK2 ../../../element/color.html, list) or a web style hex color. 93 * 94 * Params: 95 * color = The outline color. 96 * 97 * Returns: 98 * This widget to aid method chaining. 99 * 100 * See_Also: 101 * $(LINK2 ../../../element/color.html, tkd.widget.color) $(BR) 102 */ 103 public auto setActiveOutlineColor(this T)(string color) 104 { 105 this._activeOutlineColor = color; 106 107 if (this._parent && this._activeOutlineColor.length) 108 { 109 this._tk.eval("%s itemconfigure %s -activeoutline {%s}", this._parent.id, this.id, this._activeOutlineColor); 110 } 111 112 return cast(T) this; 113 } 114 115 /** 116 * Get the disabled outline color. 117 * 118 * Returns: 119 * The disabled outline color; 120 */ 121 public string getDisabledOutlineColor() 122 { 123 if (this._parent) 124 { 125 this._tk.eval("%s itemcget %s -disabledoutline", this._parent.id, this.id); 126 this._disabledOutlineColor = this._tk.getResult!(string); 127 } 128 129 return this._disabledOutlineColor; 130 } 131 132 /** 133 * Set the disabled outline color. 134 * Use colors from the preset color $(LINK2 ../../../element/color.html, list) or a web style hex color. 135 * 136 * Params: 137 * color = The outline color. 138 * 139 * Returns: 140 * This widget to aid method chaining. 141 * 142 * See_Also: 143 * $(LINK2 ../../../element/color.html, tkd.widget.color) $(BR) 144 */ 145 public auto setDisabledOutlineColor(this T)(string color) 146 { 147 this._disabledOutlineColor = color; 148 149 if (this._parent && this._disabledOutlineColor.length) 150 { 151 this._tk.eval("%s itemconfigure %s -disabledoutline {%s}", this._parent.id, this.id, this._disabledOutlineColor); 152 } 153 154 return cast(T) this; 155 } 156 }