void tscrollbar_container::set_vertical_scrollbar_item_position( const unsigned position) { assert(vertical_scrollbar_); vertical_scrollbar_->set_item_position(position); scrollbar_moved(); }
void tscrollbar_container::scroll_horizontal_scrollbar( const tscrollbar_::tscroll scroll) { assert(horizontal_scrollbar_); horizontal_scrollbar_->scroll(scroll); scrollbar_moved(); }
void tscrollbar_container::scroll_vertical_scrollbar( const tscrollbar_::tscroll scroll) { assert(vertical_scrollbar_); vertical_scrollbar_->scroll(scroll); scrollbar_moved(); }
void tscrollbar_container::handle_key_end(SDLMod /*modifier*/, bool& handled) { assert(vertical_scrollbar_); vertical_scrollbar_->scroll(tscrollbar_::END); scrollbar_moved(); handled = true; }
void tscrollbar_container::handle_key_right_arrow(SDLMod /*modifier*/, bool& handled) { assert(horizontal_scrollbar_); horizontal_scrollbar_->scroll(tscrollbar_::ITEM_FORWARD); scrollbar_moved(); handled = true; }
void tscrollbar_container::handle_key_down_arrow(SDLMod /*modifier*/, bool& handled) { assert(vertical_scrollbar_); vertical_scrollbar_->scroll(tscrollbar_::ITEM_FORWARD); scrollbar_moved(); handled = true; }
void tscrollbar_container::handle_key_page_up(SDLMod /*modifier*/, bool& handled) { assert(vertical_scrollbar_); vertical_scrollbar_->scroll(tscrollbar_::JUMP_BACKWARDS); scrollbar_moved(); handled = true; }
void tscrollbar_container::handle_key_home(SDLMod /*modifier*/, bool& handled) { assert(vertical_scrollbar_ && horizontal_scrollbar_); vertical_scrollbar_->scroll(tscrollbar_::BEGIN); horizontal_scrollbar_->scroll(tscrollbar_::BEGIN); scrollbar_moved(); handled = true; }
void tscrollbar_container::signal_handler_sdl_wheel_down(const event::tevent event, bool& handled) { DBG_GUI_E << LOG_HEADER << event << ".\n"; assert(vertical_scrollbar_grid_ && vertical_scrollbar_); if(vertical_scrollbar_grid_->get_visible() == twidget::tvisible::visible) { vertical_scrollbar_->scroll(tscrollbar_::HALF_JUMP_FORWARD); scrollbar_moved(); handled = true; } }
void tscrollbar_container::show_content_rect(const SDL_Rect& rect) { assert(content_); assert(horizontal_scrollbar_ && vertical_scrollbar_); // Set the bottom right location first if it doesn't fit the top left // will look good. First calculate the left and top position depending on // the current position. const int left_position = horizontal_scrollbar_->get_item_position() + (rect.x - content_->get_x()); const int top_position = vertical_scrollbar_->get_item_position() + (rect.y - content_->get_y()); // bottom. const int wanted_bottom = rect.y + rect.h; const int current_bottom = content_->get_y() + content_->get_height(); int distance = wanted_bottom - current_bottom; if(distance > 0) { vertical_scrollbar_->set_item_position( vertical_scrollbar_->get_item_position() - distance); } // right. const int wanted_right = rect.x + rect.w; const int current_right = content_->get_x() + content_->get_width(); distance = wanted_right - current_right; if(distance > 0) { horizontal_scrollbar_->set_item_position( horizontal_scrollbar_->get_item_position() - distance); } // top. if(top_position < static_cast<int>(vertical_scrollbar_->get_item_position())) { vertical_scrollbar_->set_item_position(top_position); } // left. if(left_position < static_cast<int>(horizontal_scrollbar_->get_item_position())) { horizontal_scrollbar_->set_item_position(left_position); } // Update. scrollbar_moved(); }
void tscrollbar_container::signal_handler_sdl_wheel_left(const event::tevent event, bool& handled) { DBG_GUI_E << LOG_HEADER << event << ".\n"; assert(horizontal_scrollbar_grid_ && horizontal_scrollbar_); if(horizontal_scrollbar_grid_->get_visible() == twidget::tvisible::visible) { horizontal_scrollbar_->scroll(tscrollbar_::HALF_JUMP_BACKWARDS); scrollbar_moved(); handled = true; } }
bool tscrollbar_container::content_resize_request(const int width_modification, const int height_modification, const int width_modification_pos, const int height_modification_pos) { DBG_GUI_L << LOG_HEADER << " wanted width modification " << width_modification << " wanted height modification " << height_modification << ".\n"; if(get_size() == tpoint()) { DBG_GUI_L << LOG_HEADER << " initial setup not done, bailing out.\n"; return false; } twindow* window = get_window(); assert(window); if(window->get_need_layout()) { DBG_GUI_L << LOG_HEADER << " window already needs a layout phase, bailing out.\n"; return false; } assert(content_ && content_grid_); const bool result = content_resize_width(width_modification, width_modification_pos) && content_resize_height(height_modification, height_modification_pos); scrollbar_moved(); if(result) { /* * The subroutines set the new size of the scrollbar but don't * update the button status. */ set_scrollbar_button_status(); } DBG_GUI_L << LOG_HEADER << " result " << result << ".\n"; return result; }
void horizontal_scrollbar_moved() { scrollbar_moved(); }
/** * Callback when the scrollbar moves (NOTE maybe only one callback needed). * Maybe also make protected or private and add a friend. */ void vertical_scrollbar_moved() { scrollbar_moved(); }