mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 05:35:29 +08:00
Improved clip handling/fix box()
This commit is contained in:
+9
-8
@@ -3474,6 +3474,7 @@ void Fl_Terminal::init_(int X,int Y,int W,int H,const char*L,int rows,int cols,i
|
|||||||
hscrollbar_style_ = SCROLLBAR_AUTO;
|
hscrollbar_style_ = SCROLLBAR_AUTO;
|
||||||
|
|
||||||
resizable(0);
|
resizable(0);
|
||||||
|
clip_children(1); // clips scrollbars within box()
|
||||||
Fl_Group::color(FL_BLACK); // black bg by default
|
Fl_Group::color(FL_BLACK); // black bg by default
|
||||||
update_screen(true); // update internal vars after setting screen size/font
|
update_screen(true); // update internal vars after setting screen size/font
|
||||||
clear_screen_home(); // clear screen, home cursor
|
clear_screen_home(); // clear screen, home cursor
|
||||||
@@ -3723,12 +3724,6 @@ void Fl_Terminal::draw_buff(int Y) const {
|
|||||||
followed by the terminal's screen contents.
|
followed by the terminal's screen contents.
|
||||||
*/
|
*/
|
||||||
void Fl_Terminal::draw(void) {
|
void Fl_Terminal::draw(void) {
|
||||||
int cx = x() + Fl::box_dx(box());
|
|
||||||
int cy = y() + Fl::box_dy(box());
|
|
||||||
int cw = w() - Fl::box_dw(box());
|
|
||||||
int ch = h() - Fl::box_dh(box());
|
|
||||||
fl_push_clip(cx,cy,cw,ch);
|
|
||||||
{
|
|
||||||
// First time shown? Force deferred font size calculations here (issue 837)
|
// First time shown? Force deferred font size calculations here (issue 837)
|
||||||
if (fontsize_defer_) {
|
if (fontsize_defer_) {
|
||||||
fontsize_defer_ = false; // clear flag
|
fontsize_defer_ = false; // clear flag
|
||||||
@@ -3745,9 +3740,17 @@ void Fl_Terminal::draw(void) {
|
|||||||
Fl_Group::draw();
|
Fl_Group::draw();
|
||||||
// Draw that little square between the scrollbars:
|
// Draw that little square between the scrollbars:
|
||||||
if (scrollbar->visible() && hscrollbar->visible()) {
|
if (scrollbar->visible() && hscrollbar->visible()) {
|
||||||
|
int cx = x() + Fl::box_dx(box());
|
||||||
|
int cy = y() + Fl::box_dy(box());
|
||||||
|
int cw = w() - Fl::box_dw(box());
|
||||||
|
int ch = h() - Fl::box_dh(box());
|
||||||
|
fl_push_clip(cx,cy,cw,ch);
|
||||||
|
{
|
||||||
fl_color(parent()->color());
|
fl_color(parent()->color());
|
||||||
fl_rectf(scrollbar->x(), hscrollbar->y(), scrollbar_actual_size(), scrollbar_actual_size());
|
fl_rectf(scrollbar->x(), hscrollbar->y(), scrollbar_actual_size(), scrollbar_actual_size());
|
||||||
}
|
}
|
||||||
|
fl_pop_clip();
|
||||||
|
}
|
||||||
if (is_frame(box())) {
|
if (is_frame(box())) {
|
||||||
// Is box() a frame? Fill area inside frame with rectf().
|
// Is box() a frame? Fill area inside frame with rectf().
|
||||||
// FL_XXX_FRAME types allow Fl_Terminal to have a /flat/ background.
|
// FL_XXX_FRAME types allow Fl_Terminal to have a /flat/ background.
|
||||||
@@ -3757,8 +3760,6 @@ void Fl_Terminal::draw(void) {
|
|||||||
// Draw flat field (inside border drawn by Fl_Group::draw() above)
|
// Draw flat field (inside border drawn by Fl_Group::draw() above)
|
||||||
fl_rectf(scrn_.x(), scrn_.y(), scrn_.w(), scrn_.h());
|
fl_rectf(scrn_.x(), scrn_.y(), scrn_.w(), scrn_.h());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fl_pop_clip();
|
|
||||||
|
|
||||||
//DEBUG fl_color(0x80000000); // dark red box inside margins
|
//DEBUG fl_color(0x80000000); // dark red box inside margins
|
||||||
//DEBUG fl_rect(scrn_);
|
//DEBUG fl_rect(scrn_);
|
||||||
|
|||||||
Reference in New Issue
Block a user