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

Method initialize

dlib/gui_widgets/base_widgets.h:1638–1661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1636 class menu_item_text : public menu_item
1637 {
1638 void initialize (
1639 const any_function<void()>& event_handler_,
1640 unichar hk
1641 )
1642 {
1643 dlib::ustring &str = text;
1644 action = event_handler_;
1645
1646 if (hk != 0)
1647 {
1648 std::string::size_type pos = str.find_first_of(hk);
1649 if (pos != std::string::npos)
1650 {
1651 // now compute the location of the underline bar
1652 rectangle r1 = f->compute_cursor_rect( rectangle(100000,100000), str, pos);
1653 rectangle r2 = f->compute_cursor_rect( rectangle(100000,100000), str, pos+1);
1654
1655 underline_p1.x() = r1.left()+1;
1656 underline_p2.x() = r2.left()-1;
1657 underline_p1.y() = r1.bottom()-f->height()+f->ascender()+2;
1658 underline_p2.y() = r2.bottom()-f->height()+f->ascender()+2;
1659 }
1660 }
1661 }
1662
1663 public:
1664 template <typename T>

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