xref: /haiku/src/preferences/printers/TestPageView.cpp (revision bc597290b9573d45a5d1738abe35b987f38f43cf)
1260f2d09SPhilippe Houdoin /*
2260f2d09SPhilippe Houdoin  * Copyright 2011, Haiku.
3260f2d09SPhilippe Houdoin  * Distributed under the terms of the MIT License.
4260f2d09SPhilippe Houdoin  *
5260f2d09SPhilippe Houdoin  * Authors:
6260f2d09SPhilippe Houdoin  *		Philippe Houdoin
7260f2d09SPhilippe Houdoin  */
8260f2d09SPhilippe Houdoin 
9260f2d09SPhilippe Houdoin 
10260f2d09SPhilippe Houdoin #include "TestPageView.h"
11260f2d09SPhilippe Houdoin 
12*bc597290SPhilippe Houdoin #include <math.h>
13*bc597290SPhilippe Houdoin 
14*bc597290SPhilippe Houdoin #include <AffineTransform.h>
15260f2d09SPhilippe Houdoin #include <Catalog.h>
16*bc597290SPhilippe Houdoin #include <Font.h>
17260f2d09SPhilippe Houdoin #include <GradientLinear.h>
18*bc597290SPhilippe Houdoin #include <GradientRadial.h>
19*bc597290SPhilippe Houdoin #include <GridLayoutBuilder.h>
20*bc597290SPhilippe Houdoin #include <GroupLayoutBuilder.h>
21*bc597290SPhilippe Houdoin #include <LayoutUtils.h>
22*bc597290SPhilippe Houdoin #include <TextView.h>
23*bc597290SPhilippe Houdoin #include <Shape.h>
24*bc597290SPhilippe Houdoin #include <String.h>
25*bc597290SPhilippe Houdoin #include <StringView.h>
26260f2d09SPhilippe Houdoin 
27260f2d09SPhilippe Houdoin #include "PrinterListView.h"
28260f2d09SPhilippe Houdoin 
29260f2d09SPhilippe Houdoin 
30260f2d09SPhilippe Houdoin #undef B_TRANSLATE_CONTEXT
31260f2d09SPhilippe Houdoin #define B_TRANSLATE_CONTEXT "TestPageView"
32260f2d09SPhilippe Houdoin 
33260f2d09SPhilippe Houdoin 
34*bc597290SPhilippe Houdoin // #pragma mark LeafView
35*bc597290SPhilippe Houdoin 
36*bc597290SPhilippe Houdoin 
37*bc597290SPhilippe Houdoin // path data for the leaf shape
38*bc597290SPhilippe Houdoin static const BPoint kLeafBegin(56.24793f, 15.46287f);
39*bc597290SPhilippe Houdoin static BPoint kLeafCurves[][3] = {
40*bc597290SPhilippe Houdoin 	{ BPoint(61.14, 28.89), BPoint(69.78, 38.25), BPoint(83.48, 44.17) },
41*bc597290SPhilippe Houdoin 	{ BPoint(99.46, 37.52), BPoint(113.27, 29.61), BPoint(134.91, 30.86) },
42*bc597290SPhilippe Houdoin 	{ BPoint(130.58, 36.53), BPoint(126.74, 42.44), BPoint(123.84, 48.81) },
43*bc597290SPhilippe Houdoin 	{ BPoint(131.81, 42.22), BPoint(137.53, 38.33), BPoint(144.37, 33.10) },
44*bc597290SPhilippe Houdoin 	{ BPoint(169.17, 23.55), BPoint(198.90, 15.55), BPoint(232.05, 10.51) },
45*bc597290SPhilippe Houdoin 	{ BPoint(225.49, 18.37), BPoint(219.31, 28.17), BPoint(217.41, 40.24) },
46*bc597290SPhilippe Houdoin 	{ BPoint(227.70, 26.60), BPoint(239.97, 14.63), BPoint(251.43, 8.36) },
47*bc597290SPhilippe Houdoin 	{ BPoint(288.89, 9.12), BPoint(322.73, 14.33), BPoint(346.69, 31.67) },
48*bc597290SPhilippe Houdoin 	{ BPoint(330.49, 37.85), BPoint(314.36, 44.25), BPoint(299.55, 54.17) },
49*bc597290SPhilippe Houdoin 	{ BPoint(292.48, 52.54), BPoint(289.31, 49.70), BPoint(285.62, 47.03) },
50*bc597290SPhilippe Houdoin 	{ BPoint(283.73, 54.61), BPoint(284.46, 57.94), BPoint(285.62, 60.60) },
51*bc597290SPhilippe Houdoin 	{ BPoint(259.78, 76.14), BPoint(233.24, 90.54), BPoint(202.41, 98.10) },
52*bc597290SPhilippe Houdoin 	{ BPoint(194.43, 95.36), BPoint(185.96, 92.39), BPoint(179.63, 88.33) },
53*bc597290SPhilippe Houdoin 	{ BPoint(180.15, 94.75), BPoint(182.73, 99.76), BPoint(185.62, 104.53) },
54*bc597290SPhilippe Houdoin 	{ BPoint(154.83, 119.46), BPoint(133.21, 118.97), BPoint(125.62, 94.88) },
55*bc597290SPhilippe Houdoin 	{ BPoint(124.70, 98.79), BPoint(124.11, 103.67), BPoint(124.19, 110.60) },
56*bc597290SPhilippe Houdoin 	{ BPoint(116.42, 111.81), BPoint(85.82, 99.60), BPoint(83.25, 51.96) },
57*bc597290SPhilippe Houdoin 	{ BPoint(62.50, 42.57), BPoint(58.12, 33.18), BPoint(50.98, 23.81) } };
58*bc597290SPhilippe Houdoin static const int kNumLeafCurves = sizeof(kLeafCurves) / sizeof(kLeafCurves[0]);
59*bc597290SPhilippe Houdoin static const float kLeafWidth = 372.f;
60*bc597290SPhilippe Houdoin static const float kLeafHeight = 121.f;
61*bc597290SPhilippe Houdoin 
62*bc597290SPhilippe Houdoin 
63*bc597290SPhilippe Houdoin class LeafView : public BView {
64*bc597290SPhilippe Houdoin public:
65*bc597290SPhilippe Houdoin 								LeafView();
66*bc597290SPhilippe Houdoin 	virtual	void				Draw(BRect updateRect);
67*bc597290SPhilippe Houdoin };
68*bc597290SPhilippe Houdoin 
69*bc597290SPhilippe Houdoin 
70*bc597290SPhilippe Houdoin LeafView::LeafView()
71*bc597290SPhilippe Houdoin 	:
72*bc597290SPhilippe Houdoin 	BView("leafview", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE)
73*bc597290SPhilippe Houdoin {
74*bc597290SPhilippe Houdoin 	SetViewColor(255, 255, 255);
75*bc597290SPhilippe Houdoin }
76*bc597290SPhilippe Houdoin 
77*bc597290SPhilippe Houdoin 
78*bc597290SPhilippe Houdoin void
79*bc597290SPhilippe Houdoin LeafView::Draw(BRect updateRect)
80*bc597290SPhilippe Houdoin {
81*bc597290SPhilippe Houdoin 	float scale = Bounds().Width() / kLeafWidth;
82*bc597290SPhilippe Houdoin 	BAffineTransform transform;
83*bc597290SPhilippe Houdoin 	transform.ScaleBy(scale);
84*bc597290SPhilippe Houdoin 
85*bc597290SPhilippe Houdoin 	// BGradientRadial gradient(BPoint(kLeafWidth * 0.75, kLeafHeight * 1.5),
86*bc597290SPhilippe Houdoin 	//	kLeafWidth * 2);
87*bc597290SPhilippe Houdoin 	BGradientLinear gradient(B_ORIGIN,
88*bc597290SPhilippe Houdoin 		transform.Apply(BPoint(kLeafWidth, kLeafHeight)));
89*bc597290SPhilippe Houdoin 	rgb_color lightBlue = make_color(6, 169, 255);
90*bc597290SPhilippe Houdoin 	rgb_color darkBlue = make_color(0, 50, 126);
91*bc597290SPhilippe Houdoin 	gradient.AddColor(darkBlue, 0.0);
92*bc597290SPhilippe Houdoin 	gradient.AddColor(lightBlue, 255.0);
93*bc597290SPhilippe Houdoin 
94*bc597290SPhilippe Houdoin 	// build leaf shape
95*bc597290SPhilippe Houdoin 	BShape leafShape;
96*bc597290SPhilippe Houdoin 	leafShape.MoveTo(transform.Apply(kLeafBegin));
97*bc597290SPhilippe Houdoin 	for (int i = 0; i < kNumLeafCurves; ++i) {
98*bc597290SPhilippe Houdoin 		BPoint controlPoints[3];
99*bc597290SPhilippe Houdoin 		for (int j = 0; j < 3; ++j)
100*bc597290SPhilippe Houdoin 			controlPoints[j] = transform.Apply(kLeafCurves[i][j]);
101*bc597290SPhilippe Houdoin 		leafShape.BezierTo(controlPoints);
102*bc597290SPhilippe Houdoin 	}
103*bc597290SPhilippe Houdoin 	leafShape.Close();
104*bc597290SPhilippe Houdoin 
105*bc597290SPhilippe Houdoin 	PushState();
106*bc597290SPhilippe Houdoin 	SetDrawingMode(B_OP_ALPHA);
107*bc597290SPhilippe Houdoin 	SetHighColor(0, 0, 0, 50);
108*bc597290SPhilippe Houdoin 	for (int i = 2; i >= 0; --i) {
109*bc597290SPhilippe Houdoin 		SetOrigin(i * 0.1, i * 0.3);
110*bc597290SPhilippe Houdoin 		SetPenSize(i * 2);
111*bc597290SPhilippe Houdoin 		StrokeShape(&leafShape);
112*bc597290SPhilippe Houdoin 	}
113*bc597290SPhilippe Houdoin 	PopState();
114*bc597290SPhilippe Houdoin 
115*bc597290SPhilippe Houdoin 	FillShape(&leafShape, gradient);
116*bc597290SPhilippe Houdoin }
117*bc597290SPhilippe Houdoin 
118*bc597290SPhilippe Houdoin 
119*bc597290SPhilippe Houdoin // #pragma mark -
120*bc597290SPhilippe Houdoin 
121*bc597290SPhilippe Houdoin 
122*bc597290SPhilippe Houdoin class RadialLinesView : public BView {
123*bc597290SPhilippe Houdoin public:
124*bc597290SPhilippe Houdoin 								RadialLinesView();
125*bc597290SPhilippe Houdoin 
126*bc597290SPhilippe Houdoin 	virtual	void				Draw(BRect updateRect);
127*bc597290SPhilippe Houdoin 
128*bc597290SPhilippe Houdoin 	virtual bool				HasHeightForWidth() { return true; }
129*bc597290SPhilippe Houdoin 	virtual void				GetHeightForWidth(float width, float* min,
130*bc597290SPhilippe Houdoin 									float* max, float* preferred);
131*bc597290SPhilippe Houdoin };
132*bc597290SPhilippe Houdoin 
133*bc597290SPhilippe Houdoin 
134*bc597290SPhilippe Houdoin RadialLinesView::RadialLinesView()
135*bc597290SPhilippe Houdoin 	: BView("radiallinesview", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE)
136*bc597290SPhilippe Houdoin {
137*bc597290SPhilippe Houdoin 	SetViewColor(255, 255, 255);
138*bc597290SPhilippe Houdoin }
139*bc597290SPhilippe Houdoin 
140*bc597290SPhilippe Houdoin 
141*bc597290SPhilippe Houdoin void
142*bc597290SPhilippe Houdoin RadialLinesView::GetHeightForWidth(float width,
143*bc597290SPhilippe Houdoin 	float* min, float* max, float* preferred)
144*bc597290SPhilippe Houdoin {
145*bc597290SPhilippe Houdoin 	// Enforce a width/height ratio of 1
146*bc597290SPhilippe Houdoin 
147*bc597290SPhilippe Houdoin 	if (min)
148*bc597290SPhilippe Houdoin 		*min = width;
149*bc597290SPhilippe Houdoin 
150*bc597290SPhilippe Houdoin 	if (max)
151*bc597290SPhilippe Houdoin 		*max = width;
152*bc597290SPhilippe Houdoin 
153*bc597290SPhilippe Houdoin 	if (preferred)
154*bc597290SPhilippe Houdoin 		*preferred = width;
155*bc597290SPhilippe Houdoin }
156*bc597290SPhilippe Houdoin 
157*bc597290SPhilippe Houdoin 
158*bc597290SPhilippe Houdoin void
159*bc597290SPhilippe Houdoin RadialLinesView::Draw(BRect updateRect)
160*bc597290SPhilippe Houdoin {
161*bc597290SPhilippe Houdoin 	const rgb_color black = { 0, 0, 0, 255 };
162*bc597290SPhilippe Houdoin 	const int angleStep = 4;
163*bc597290SPhilippe Houdoin 
164*bc597290SPhilippe Houdoin 	BRect rect(Bounds());
165*bc597290SPhilippe Houdoin 	float size = rect.Width();
166*bc597290SPhilippe Houdoin 	if (size > rect.Height())
167*bc597290SPhilippe Houdoin 		size = rect.Height();
168*bc597290SPhilippe Houdoin 	size *= 0.45; // leave 10% of margin
169*bc597290SPhilippe Houdoin 
170*bc597290SPhilippe Houdoin 	BPoint center(rect.Width() / 2, rect.Height() / 2);
171*bc597290SPhilippe Houdoin 
172*bc597290SPhilippe Houdoin 	BeginLineArray(360 / angleStep);
173*bc597290SPhilippe Houdoin 	for (int i = 0; i < 360; i += angleStep) {
174*bc597290SPhilippe Houdoin 		double angle = i * M_PI / 180;
175*bc597290SPhilippe Houdoin 		BPoint pt(size * cos(angle), size * sin(angle));
176*bc597290SPhilippe Houdoin 		AddLine(center, center + pt, black);
177*bc597290SPhilippe Houdoin 	}
178*bc597290SPhilippe Houdoin 	EndLineArray();
179*bc597290SPhilippe Houdoin }
180*bc597290SPhilippe Houdoin 
181*bc597290SPhilippe Houdoin 
182*bc597290SPhilippe Houdoin // #pragma mark -
183*bc597290SPhilippe Houdoin 
184*bc597290SPhilippe Houdoin 
185*bc597290SPhilippe Houdoin static const struct {
186*bc597290SPhilippe Houdoin 	const char* name;
187*bc597290SPhilippe Houdoin 	rgb_color	color;
188*bc597290SPhilippe Houdoin } kColorGradients[] = {
189*bc597290SPhilippe Houdoin 	{ B_TRANSLATE_MARK("Red"), 		{255, 0, 0, 255} },
190*bc597290SPhilippe Houdoin 	{ B_TRANSLATE_MARK("Green"), 	{0, 255, 0, 255} },
191*bc597290SPhilippe Houdoin 	{ B_TRANSLATE_MARK("Blue"), 	{0, 0, 255, 255} },
192*bc597290SPhilippe Houdoin 	{ B_TRANSLATE_MARK("Yellow"), 	{255, 255, 0, 255} },
193*bc597290SPhilippe Houdoin 	{ B_TRANSLATE_MARK("Magenta"), 	{255, 0, 255, 255} },
194*bc597290SPhilippe Houdoin 	{ B_TRANSLATE_MARK("Cyan"), 	{0, 255, 255, 255} },
195*bc597290SPhilippe Houdoin 	{ B_TRANSLATE_MARK("Black"), 	{0, 0, 0, 255} }
196*bc597290SPhilippe Houdoin };
197*bc597290SPhilippe Houdoin static const int kNumColorGradients = sizeof(kColorGradients)
198*bc597290SPhilippe Houdoin 	/ sizeof(kColorGradients[0]);
199*bc597290SPhilippe Houdoin 
200*bc597290SPhilippe Houdoin 
201*bc597290SPhilippe Houdoin class ColorGradientView : public BView {
202*bc597290SPhilippe Houdoin public:
203*bc597290SPhilippe Houdoin 								ColorGradientView(rgb_color color);
204*bc597290SPhilippe Houdoin 	virtual	void				Draw(BRect updateRect);
205*bc597290SPhilippe Houdoin 
206*bc597290SPhilippe Houdoin private:
207*bc597290SPhilippe Houdoin 			rgb_color			fColor;
208*bc597290SPhilippe Houdoin };
209*bc597290SPhilippe Houdoin 
210*bc597290SPhilippe Houdoin 
211*bc597290SPhilippe Houdoin ColorGradientView::ColorGradientView(rgb_color color)
212*bc597290SPhilippe Houdoin 	:
213*bc597290SPhilippe Houdoin 	BView("colorgradientview", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
214*bc597290SPhilippe Houdoin 	fColor(color)
215260f2d09SPhilippe Houdoin {
216260f2d09SPhilippe Houdoin }
217260f2d09SPhilippe Houdoin 
218260f2d09SPhilippe Houdoin 
219260f2d09SPhilippe Houdoin void
220*bc597290SPhilippe Houdoin ColorGradientView::Draw(BRect updateRect)
221260f2d09SPhilippe Houdoin {
222*bc597290SPhilippe Houdoin 	BRect rect(Bounds());
223260f2d09SPhilippe Houdoin 
224*bc597290SPhilippe Houdoin 	BGradientLinear gradient(rect.LeftTop(), rect.RightBottom());
225*bc597290SPhilippe Houdoin 	rgb_color white = make_color(255, 255, 255);
226*bc597290SPhilippe Houdoin 	gradient.AddColor(white, 0.0);
227*bc597290SPhilippe Houdoin 	gradient.AddColor(fColor, 255.0);
228*bc597290SPhilippe Houdoin 
229*bc597290SPhilippe Houdoin 	FillRect(rect, gradient);
230*bc597290SPhilippe Houdoin 	StrokeRect(rect);
231*bc597290SPhilippe Houdoin }
232*bc597290SPhilippe Houdoin 
233*bc597290SPhilippe Houdoin 
234*bc597290SPhilippe Houdoin // #pragma mark -
235*bc597290SPhilippe Houdoin 
236*bc597290SPhilippe Houdoin 
237*bc597290SPhilippe Houdoin TestPageView::TestPageView(BRect frame, PrinterItem* printer)
238*bc597290SPhilippe Houdoin 	: BView(frame, "testpage", /* B_FOLLOW_NONE */ B_FOLLOW_ALL,
239*bc597290SPhilippe Houdoin 		B_WILL_DRAW | B_DRAW_ON_CHILDREN | B_FULL_UPDATE_ON_RESIZE),
240*bc597290SPhilippe Houdoin 	fPrinter(printer)
241*bc597290SPhilippe Houdoin {
242*bc597290SPhilippe Houdoin 	SetViewColor(255, 255, 255);
243*bc597290SPhilippe Houdoin }
244*bc597290SPhilippe Houdoin 
245*bc597290SPhilippe Houdoin 
246*bc597290SPhilippe Houdoin void
247*bc597290SPhilippe Houdoin TestPageView::AttachedToWindow()
248*bc597290SPhilippe Houdoin {
249*bc597290SPhilippe Houdoin 	BTextView* statusView = new BTextView("statusView",
250*bc597290SPhilippe Houdoin 		be_plain_font, NULL, B_WILL_DRAW);
251*bc597290SPhilippe Houdoin 
252*bc597290SPhilippe Houdoin 	statusView->SetInsets(10, 10, 10, 10);
253*bc597290SPhilippe Houdoin 	statusView->MakeEditable(false);
254*bc597290SPhilippe Houdoin 	statusView->MakeSelectable(false);
255*bc597290SPhilippe Houdoin 
256*bc597290SPhilippe Houdoin 	const char* title = B_TRANSLATE("Test Page");
257*bc597290SPhilippe Houdoin 	BString text;
258*bc597290SPhilippe Houdoin 	text << title << "\n\n";
259*bc597290SPhilippe Houdoin 	text << B_TRANSLATE(
260*bc597290SPhilippe Houdoin 		"Printer: %printer_name%\n"
261*bc597290SPhilippe Houdoin 		"Driver:  %driver%\n");
262*bc597290SPhilippe Houdoin 
263*bc597290SPhilippe Houdoin 	text.ReplaceFirst("%printer_name%", fPrinter->Name());
264*bc597290SPhilippe Houdoin 	text.ReplaceFirst("%driver%", fPrinter->Driver());
265*bc597290SPhilippe Houdoin 	if (strlen(fPrinter->Transport()) > 0) {
266*bc597290SPhilippe Houdoin 		text << B_TRANSLATE("Transport: %transport% %transport_address%");
267*bc597290SPhilippe Houdoin 
268*bc597290SPhilippe Houdoin 		text.ReplaceFirst("%transport%", fPrinter->Transport());
269*bc597290SPhilippe Houdoin 		text.ReplaceFirst("%transport_address%", fPrinter->TransportAddress());
270*bc597290SPhilippe Houdoin 	}
271*bc597290SPhilippe Houdoin 
272*bc597290SPhilippe Houdoin 	statusView->SetText(text.String());
273*bc597290SPhilippe Houdoin 	BFont font;
274*bc597290SPhilippe Houdoin 	statusView->SetStylable(true);
275*bc597290SPhilippe Houdoin 	statusView->GetFont(&font);
276*bc597290SPhilippe Houdoin 	font.SetFace(B_BOLD_FACE);
277*bc597290SPhilippe Houdoin 	font.SetSize(font.Size() * 1.7);
278*bc597290SPhilippe Houdoin 	statusView->SetFontAndColor(0, strlen(title), &font);
279*bc597290SPhilippe Houdoin 
280*bc597290SPhilippe Houdoin 	BGridLayoutBuilder gradiants(2.0);
281*bc597290SPhilippe Houdoin 	gradiants.View()->SetViewColor(B_TRANSPARENT_COLOR);
282*bc597290SPhilippe Houdoin 
283*bc597290SPhilippe Houdoin 	for (int i = 0; i < kNumColorGradients; ++i) {
284*bc597290SPhilippe Houdoin 		BStringView* label = new BStringView(kColorGradients[i].name,
285*bc597290SPhilippe Houdoin 			kColorGradients[i].name);
286*bc597290SPhilippe Houdoin 		// label->SetAlignment(B_ALIGN_RIGHT);
287*bc597290SPhilippe Houdoin 		gradiants.Add(label, 0, i);
288*bc597290SPhilippe Houdoin 		gradiants.Add(new ColorGradientView(kColorGradients[i].color), 1, i);
289*bc597290SPhilippe Houdoin 	}
290*bc597290SPhilippe Houdoin 
291*bc597290SPhilippe Houdoin 	SetLayout(new BGroupLayout(B_HORIZONTAL));
292*bc597290SPhilippe Houdoin 	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
293*bc597290SPhilippe Houdoin 		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
294*bc597290SPhilippe Houdoin 			.Add(statusView)
295*bc597290SPhilippe Houdoin 			.Add(new LeafView())
296*bc597290SPhilippe Houdoin 		)
297*bc597290SPhilippe Houdoin 		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
298*bc597290SPhilippe Houdoin 			.Add(gradiants, 0.60)
299*bc597290SPhilippe Houdoin 			.Add(new RadialLinesView(), 0.40)
300*bc597290SPhilippe Houdoin 		)
301*bc597290SPhilippe Houdoin 		.AddGlue()
302*bc597290SPhilippe Houdoin 		.End()
303*bc597290SPhilippe Houdoin 	);
304*bc597290SPhilippe Houdoin 
305*bc597290SPhilippe Houdoin 	// set layout background color to transparent instead
306*bc597290SPhilippe Houdoin 	// of default UI panel color
307*bc597290SPhilippe Houdoin 	ChildAt(0)->SetViewColor(B_TRANSPARENT_COLOR);
308*bc597290SPhilippe Houdoin }
309*bc597290SPhilippe Houdoin 
310*bc597290SPhilippe Houdoin 
311*bc597290SPhilippe Houdoin void
312*bc597290SPhilippe Houdoin TestPageView::DrawAfterChildren(BRect updateRect)
313*bc597290SPhilippe Houdoin {
314*bc597290SPhilippe Houdoin 	// Draw corners marks
315260f2d09SPhilippe Houdoin 
316260f2d09SPhilippe Houdoin 	float width = Bounds().Width();
317260f2d09SPhilippe Houdoin 	float height = Bounds().Height();
318260f2d09SPhilippe Houdoin 	float minDimension = MIN(width, height);
319260f2d09SPhilippe Houdoin 
320*bc597290SPhilippe Houdoin 	float size = minDimension * 0.05;
321260f2d09SPhilippe Houdoin 
322260f2d09SPhilippe Houdoin 	BPoint pt = Bounds().LeftTop();
323260f2d09SPhilippe Houdoin 	StrokeLine(pt, BPoint(pt.x + size, pt.y));
324260f2d09SPhilippe Houdoin 	StrokeLine(pt, BPoint(pt.x, pt.y + size));
325260f2d09SPhilippe Houdoin 
326260f2d09SPhilippe Houdoin 	pt = Bounds().RightTop();
327260f2d09SPhilippe Houdoin 	StrokeLine(pt, BPoint(pt.x - size, pt.y));
328260f2d09SPhilippe Houdoin 	StrokeLine(pt, BPoint(pt.x, pt.y + size));
329260f2d09SPhilippe Houdoin 
330260f2d09SPhilippe Houdoin 	pt = Bounds().RightBottom();
331260f2d09SPhilippe Houdoin 	StrokeLine(pt, BPoint(pt.x - size, pt.y));
332260f2d09SPhilippe Houdoin 	StrokeLine(pt, BPoint(pt.x, pt.y - size));
333260f2d09SPhilippe Houdoin 
334260f2d09SPhilippe Houdoin 	pt = Bounds().LeftBottom();
335260f2d09SPhilippe Houdoin 	StrokeLine(pt, BPoint(pt.x + size, pt.y));
336260f2d09SPhilippe Houdoin 	StrokeLine(pt, BPoint(pt.x, pt.y - size));
337260f2d09SPhilippe Houdoin }
338