MCPcopy Create free account
hub / github.com/davisking/dlib / draw_button

Method draw_button

dlib/gui_widgets/style.cpp:288–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286// ----------------------------------------------------------------------------------------
287
288 void button_style_arrow::
289 draw_button (
290 const canvas& c,
291 const rectangle& rect,
292 const bool enabled,
293 const font& ,
294 const long ,
295 const long ,
296 const ustring& ,
297 const bool is_depressed
298 ) const
299 {
300 rectangle area = rect.intersect(c);
301 if (area.is_empty())
302 return;
303
304 fill_rect(c,rect,rgb_pixel(212,208,200));
305
306 const long height = rect.height();
307 const long width = rect.width();
308
309 const long smallest = (width < height) ? width : height;
310
311 const long rows = (smallest+3)/4;
312 const long start = rows + rows/2-1;
313 long dep;
314
315 long tip_x = 0;
316 long tip_y = 0;
317 long wy = 0;
318 long hy = 0;
319 long wx = 0;
320 long hx = 0;
321
322 if (is_depressed)
323 {
324 dep = 0;
325
326 // draw the button's border
327 draw_button_down(c,rect);
328 }
329 else
330 {
331 dep = -1;
332
333 // draw the button's border
334 draw_button_up(c,rect);
335 }
336
337
338 switch (dir)
339 {
340 case UP:
341 tip_x = width/2 + rect.left() + dep;
342 tip_y = (height - start)/2 + rect.top() + dep + 1;
343 wy = 0;
344 hy = 1;
345 wx = 1;

Callers

nothing calls this directly

Calls 14

rgb_pixelClass · 0.85
draw_button_downFunction · 0.85
draw_button_upFunction · 0.85
fill_rectFunction · 0.70
draw_lineFunction · 0.70
pointClass · 0.70
intersectMethod · 0.45
is_emptyMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45
leftMethod · 0.45
topMethod · 0.45

Tested by

no test coverage detected