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

Method initialize

dlib/gui_widgets/base_widgets.h:1487–1507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1485 class menu_item_submenu : public menu_item
1486 {
1487 void initialize (
1488 unichar hk
1489 )
1490 {
1491 const dlib::ustring &str = text;
1492 if (hk != 0)
1493 {
1494 std::string::size_type pos = str.find_first_of(hk);
1495 if (pos != std::string::npos)
1496 {
1497 // now compute the location of the underline bar
1498 rectangle r1 = f->compute_cursor_rect( rectangle(100000,100000), str, pos);
1499 rectangle r2 = f->compute_cursor_rect( rectangle(100000,100000), str, pos+1);
1500
1501 underline_p1.x() = r1.left()+1;
1502 underline_p2.x() = r2.left()-1;
1503 underline_p1.y() = r1.bottom()-f->height()+f->ascender()+2;
1504 underline_p2.y() = r2.bottom()-f->height()+f->ascender()+2;
1505 }
1506 }
1507 }
1508 public:
1509 menu_item_submenu (
1510 const std::string& str,

Callers

nothing calls this directly

Calls 6

compute_cursor_rectMethod · 0.80
rectangleClass · 0.50
leftMethod · 0.45
bottomMethod · 0.45
heightMethod · 0.45
ascenderMethod · 0.45

Tested by

no test coverage detected