diff options
| author | Matthias Melcher <github@matthiasm.com> | 2024-04-26 12:42:11 +0200 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2024-04-26 12:42:11 +0200 |
| commit | 281ec24c8f4b7daf7cc4e7c30b640cbe0b33d037 (patch) | |
| tree | 254e20596d544cb25d32ab2067d9e18afc4ac097 /src/fl_round_box.cxx | |
| parent | 9a0d1f16d7b78a7e789c30728df79166b95da115 (diff) | |
Box types can now defined and draw their own focus frame, STR 2145, #659
Diffstat (limited to 'src/fl_round_box.cxx')
| -rw-r--r-- | src/fl_round_box.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/fl_round_box.cxx b/src/fl_round_box.cxx index 54c8ebb07..88cbcfc25 100644 --- a/src/fl_round_box.cxx +++ b/src/fl_round_box.cxx @@ -108,9 +108,20 @@ void fl_round_up_box(int x, int y, int w, int h, Fl_Color bgcolor) { draw(CLOSED, x, y, w, h, 0, (Fl_Color)g[(int)'A']); } -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*); +void fl_round_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_Color bg) { + x += Fl::box_dx(bt); + y += Fl::box_dy(bt); + w -= Fl::box_dw(bt); + h -= Fl::box_dh(bt); + Fl_Color savecolor = fl_color(); + fl_line_style(FL_DOT); + draw(CLOSED, x, y, w, h, 0, fl_contrast(fg, bg)); + fl_line_style(FL_SOLID); +} + +extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); Fl_Boxtype fl_define_FL_ROUND_UP_BOX() { - fl_internal_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box); - fl_internal_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box); + fl_internal_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box, fl_round_focus); + fl_internal_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box, fl_round_focus); return _FL_ROUND_UP_BOX; } |
