// Table resized: recalc internal data // Call this whenever the window is resized. // Recalculates the scrollbar sizes. // Makes no assumptions about any pre-initialized data. // void Fl_Table_Copy::table_resized() { table_h = row_scroll_position(rows()); table_w = col_scroll_position(cols()); recalc_dimensions(); // Recalc scrollbar sizes // Clamp scrollbar value() after a resize. // Resize scrollbars to enforce a constant trough width after a window resize. // { // Vertical scrollbar float vscrolltab = ( table_h == 0 || tih > table_h ) ? 1 : (float)tih / table_h; float hscrolltab = ( table_w == 0 || tiw > table_w ) ? 1 : (float)tiw / table_w; #if FLTK_ABI_VERSION >= 10301 // NEW int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size(); #else // OLD int scrollsize = Fl::scrollbar_size(); #endif //if( _showVScrollbar ) { vscrollbar->bounds(0, table_h-tih); vscrollbar->precision(10); vscrollbar->slider_size(vscrolltab); vscrollbar->resize(wix+wiw-scrollsize, wiy, scrollsize, wih - ((hscrollbar->visible())?scrollsize:0)); vscrollbar->Fl_Valuator::value(vscrollbar->clamp(vscrollbar->value())); /*} else { vscrollbar->bounds(0, 0); vscrollbar->resize(wix+wiw, wiy, 0, 0 ); }*/ // Horizontal scrollbar hscrollbar->bounds(0, table_w-tiw); hscrollbar->precision(10); hscrollbar->slider_size(hscrolltab); hscrollbar->resize(wix, wiy+wih-scrollsize, wiw - ((vscrollbar->visible())?scrollsize:0), scrollsize); hscrollbar->Fl_Valuator::value(hscrollbar->clamp(hscrollbar->value())); } // Tell FLTK child widgets were resized Fl_Group::init_sizes(); // Recalc top/bot/left/right table_scrolled(); // DO *NOT* REDRAW -- LEAVE THIS UP TO THE CALLER // redraw(); }
void dialog::handle_init() { // N.B. The ordering here is important. Technically I could use a std::pair<BackgroundSections,graphics::texture> // but that seems overkill. bg_.emplace_back(gui::section::get("panel_beige_tl_corner")); bg_.emplace_back(gui::section::get("panel_beige_tr_corner")); bg_.emplace_back(gui::section::get("panel_beige_bl_corner")); bg_.emplace_back(gui::section::get("panel_beige_br_corner")); bg_.emplace_back(gui::section::get("panel_beige_left_border")); bg_.emplace_back(gui::section::get("panel_beige_right_border")); bg_.emplace_back(gui::section::get("panel_beige_top_border")); bg_.emplace_back(gui::section::get("panel_beige_bottom_border")); bg_.emplace_back(gui::section::get("panel_beige_center")); recalc_dimensions(); }
// Table resized: recalc internal data // Call this whenever the window is resized. // Recalculates the scrollbar sizes. // Makes no assumptions about any pre-initialized data. // void Fl_Table::table_resized() { table_h = row_scroll_position(rows()); table_w = col_scroll_position(cols()); recalc_dimensions(); // Recalc scrollbar sizes // Clamp scrollbar value() after a resize. // Resize scrollbars to enforce a constant trough width after a window resize. // { float vscrolltab = ( table_h == 0 || tih > table_h ) ? 1 : (float)tih / table_h; float hscrolltab = ( table_w == 0 || tiw > table_w ) ? 1 : (float)tiw / table_w; vscrollbar->bounds(0, table_h-tih); vscrollbar->precision(10); vscrollbar->slider_size(vscrolltab); vscrollbar->resize(wix+wiw-SCROLLBAR_SIZE, wiy, SCROLLBAR_SIZE, wih - ((hscrollbar->visible())?SCROLLBAR_SIZE:0)); vscrollbar->Fl_Valuator::value(vscrollbar->clamp(vscrollbar->value())); hscrollbar->bounds(0, table_w-tiw); hscrollbar->precision(10); hscrollbar->slider_size(hscrolltab); hscrollbar->resize(wix, wiy+wih-SCROLLBAR_SIZE, wiw - ((vscrollbar->visible())?SCROLLBAR_SIZE:0), SCROLLBAR_SIZE); hscrollbar->Fl_Valuator::value(hscrollbar->clamp(hscrollbar->value())); } // Tell FLTK child widgets were resized Fl_Group::init_sizes(); // Recalc top/bot/left/right table_scrolled(); // DO *NOT* REDRAW -- LEAVE THIS UP TO THE CALLER // redraw(); }