1 /**
2  * Widget module.
3  *
4  * License:
5  *     MIT. See LICENSE for full details.
6  */
7 module tkd.widget.frame;
8 
9 /**
10  * Imports.
11  */
12 import tkd.element.uielement;
13 import tkd.widget.common.border;
14 import tkd.widget.common.height;
15 import tkd.widget.common.padding;
16 import tkd.widget.common.relief;
17 import tkd.widget.common.width;
18 import tkd.widget.reliefstyle;
19 import tkd.widget.widget;
20 
21 /**
22  * A frame widget is a container, used to group other widgets together.
23  *
24  * Example:
25  * ---
26  * auto frame = new Frame(2, ReliefStyle.groove)
27  * 	.pack(0, 10);
28  *
29  * // Add a button to the frame.
30  * auto button = new Button(frame, "Text")
31  * 	.pack();
32  * ---
33  *
34  * Common_Commands:
35  *     These are injected common commands that can also be used with this widget.
36  *     $(P
37  *         $(LINK2 ./common/border.html, Border) $(BR)
38  *         $(LINK2 ./common/height.html, Height) $(BR)
39  *         $(LINK2 ./common/padding.html, Padding) $(BR)
40  *         $(LINK2 ./common/relief.html, Relief) $(BR)
41  *         $(LINK2 ./common/width.html, Width) $(BR)
42  *     )
43  *
44  * Additional_Events:
45  *     Additional events that can also be bound to using the $(LINK2 ../element/uielement.html#UiElement.bind, bind) method.
46  *     $(P
47  *         <<PrevWindow>>,
48  *         <Alt-Key>,
49  *         <Key-F10>,
50  *         <Key-Tab>,
51  *     )
52  *
53  * See_Also:
54  *     $(LINK2 ./widget.html, tkd.widget.widget)
55  */
56 class Frame : Widget
57 {
58 	/**
59 	 * Construct the widget.
60 	 *
61 	 * Params:
62 	 *     parent = The parent of this widget.
63 	 *     borderWidth = The width of the frame border.
64 	 *     relief = The relief style of the border.
65 	 *
66 	 * See_Also:
67 	 *     $(LINK2 ../element/uielement.html, tkd.element.UiElement) $(BR)
68 	 *     $(LINK2 ./reliefstyle.html, tkd.widget.reliefstyle) $(BR)
69 	 */
70 	public this(UiElement parent, int borderWidth = 0, string relief = ReliefStyle.flat)
71 	{
72 		super(parent);
73 		this._elementId = "frame";
74 
75 		this._tk.eval("ttk::frame %s", this.id);
76 
77 		this.setBorderWidth(borderWidth);
78 		this.setRelief(relief);
79 	}
80 
81 	/**
82 	 * Construct the widget.
83 	 *
84 	 * Params:
85 	 *     borderWidth = The width of the frame border.
86 	 *     relief = The relief style of the border.
87 	 *
88 	 * See_Also:
89 	 *     $(LINK2 ./reliefstyle.html, tkd.widget.reliefstyle) $(BR)
90 	 */
91 	public this(int borderWidth = 0, string relief = ReliefStyle.flat)
92 	{
93 		this(null, borderWidth, relief);
94 	}
95 
96 	/**
97 	 * Mixin common commands.
98 	 */
99 	mixin Border;
100 	mixin Height;
101 	mixin Padding;
102 	mixin Relief;
103 	mixin Width;
104 }