doxygen, comments
This commit is contained in:
parent
a117b4f0b7
commit
6e12488185
6 changed files with 62 additions and 36 deletions
|
@ -12,6 +12,9 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
//! @file widgets/scrollarea.cpp
|
||||
//!
|
||||
|
||||
#include "global.hpp"
|
||||
|
||||
#include "widgets/scrollarea.hpp"
|
||||
|
@ -160,5 +163,5 @@ void scrollarea::handle_event(const SDL_Event& event)
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // end namespace gui
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
//! @file widgets/scrollarea.hpp
|
||||
//!
|
||||
|
||||
#ifndef SCROLLAREA_HPP_INCLUDED
|
||||
#define SCROLLAREA_HPP_INCLUDED
|
||||
|
||||
|
@ -25,9 +28,10 @@ namespace gui {
|
|||
class scrollarea : public widget
|
||||
{
|
||||
public:
|
||||
/// Create a zone with automatic handling of scrollbar.
|
||||
/// \param d the display object
|
||||
/// \param pane the widget where wheel events take place
|
||||
//! Create a zone with automatic handling of scrollbar.
|
||||
//! @todo FIXME: parameterlist ??
|
||||
//- \param d the display object
|
||||
//- \param pane the widget where wheel events take place
|
||||
scrollarea(CVideo &video, bool auto_join=true);
|
||||
|
||||
virtual void hide(bool value = true);
|
||||
|
@ -63,6 +67,6 @@ private:
|
|||
void test_scrollbar();
|
||||
};
|
||||
|
||||
}
|
||||
} // end namespace gui
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
//! @file widgets/scrollbar.cpp
|
||||
//!
|
||||
|
||||
#include "global.hpp"
|
||||
|
||||
#include "widgets/scrollbar.hpp"
|
||||
|
@ -228,9 +231,9 @@ void scrollbar::draw_contents()
|
|||
SDL_Rect grip = grip_area();
|
||||
int mid_height = grip.h - top_img->h - bottom_img->h;
|
||||
if (mid_height <= 0) {
|
||||
// for now, minimum size of the middle piece is 1. This should
|
||||
// never really be encountered, and if it is, it's a symptom
|
||||
// of a larger problem, I think.
|
||||
// For now, minimum size of the middle piece is 1.
|
||||
// This should never really be encountered, and if it is,
|
||||
// it's a symptom of a larger problem, I think.
|
||||
mid_height = 1;
|
||||
}
|
||||
|
||||
|
@ -260,12 +263,12 @@ void scrollbar::draw_contents()
|
|||
|
||||
surface const screen = video().getSurface();
|
||||
|
||||
// draw scrollbar "groove"
|
||||
// Draw scrollbar "groove"
|
||||
video().blit_surface(groove.x, groove.y, top_grv);
|
||||
video().blit_surface(groove.x, groove.y + top_grv->h, groove_scaled_);
|
||||
video().blit_surface(groove.x, groove.y + top_grv->h + groove_height, bottom_grv);
|
||||
|
||||
// draw scrollbar "grip"
|
||||
// Draw scrollbar "grip"
|
||||
video().blit_surface(grip.x, grip.y, top_img);
|
||||
video().blit_surface(grip.x, grip.y + top_img->h, mid_scaled_);
|
||||
video().blit_surface(grip.x, grip.y + top_img->h + mid_height, bottom_img);
|
||||
|
@ -338,4 +341,5 @@ void scrollbar::handle_event(const SDL_Event& event)
|
|||
state_ = new_state;
|
||||
}
|
||||
|
||||
}
|
||||
} // end namespace gui
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
//! @file widgets/scrollbar.hpp
|
||||
//!
|
||||
|
||||
#ifndef SCROLLBAR_HPP_INCLUDED
|
||||
#define SCROLLBAR_HPP_INCLUDED
|
||||
|
||||
|
@ -25,49 +28,54 @@ namespace gui {
|
|||
|
||||
class scrollarea;
|
||||
|
||||
//! Scrollbar
|
||||
class scrollbar : public widget
|
||||
{
|
||||
public:
|
||||
/// Create a scrollbar.
|
||||
/// \param d the display object
|
||||
/// \param pane the widget where wheel events take place
|
||||
/// \param callback a callback interface for warning that the grip has been moved
|
||||
//! Create a scrollbar.
|
||||
//! @todo FIXME: parameterlist ??
|
||||
//- @param d the display object
|
||||
//- @param pane the widget where wheel events take place
|
||||
//- @param callback a callback interface for warning that the grip has been moved
|
||||
scrollbar(CVideo &video);
|
||||
|
||||
virtual void hide(bool value = true);
|
||||
|
||||
/// This function is used to determine where the scrollbar is.
|
||||
/// \return the position. For example, will return 0 if the scrollbar
|
||||
/// is at the top, and (full_size - shown_size) if it is at the bottom.
|
||||
//! Determine where the scrollbar is.
|
||||
//!
|
||||
//! @return the position.
|
||||
//! @retval returns 0 if the scrollbar is at the top,
|
||||
//! @retval returns (full_size - shown_size) if it is at the bottom.
|
||||
//!
|
||||
unsigned get_position() const;
|
||||
|
||||
unsigned get_max_position() const;
|
||||
|
||||
/// Used to manually update the scrollbar.
|
||||
//! Manually update the scrollbar.
|
||||
void set_position(unsigned pos);
|
||||
|
||||
/// Ensure the viewport contains the position.
|
||||
//! Ensure the viewport contains the position.
|
||||
void adjust_position(unsigned pos);
|
||||
|
||||
///Move the scrollbar.
|
||||
//! Move the scrollbar.
|
||||
void move_position(int dep);
|
||||
|
||||
/// Set the relative size of the grip.
|
||||
//! Set the relative size of the grip.
|
||||
void set_shown_size(unsigned h);
|
||||
|
||||
/// Set the relative size of the scrollbar.
|
||||
//! Set the relative size of the scrollbar.
|
||||
void set_full_size(unsigned h);
|
||||
|
||||
/// Set scroll rate.
|
||||
//! Set scroll rate.
|
||||
void set_scroll_rate(unsigned r);
|
||||
|
||||
/// Return true if the scrollbar has a valid size.
|
||||
//! Return true if the scrollbar has a valid size.
|
||||
bool is_valid_height(int height) const;
|
||||
|
||||
/// Scrolls down one step
|
||||
//! Scrolls down one step
|
||||
void scroll_down();
|
||||
|
||||
/// Scrolls up one step
|
||||
//! Scrolls up one step
|
||||
void scroll_up();
|
||||
|
||||
protected:
|
||||
|
@ -94,6 +102,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
}
|
||||
} // end namespace gui
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
//! @file widgets/scrollpane.cpp
|
||||
|
||||
#include "global.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -179,4 +181,5 @@ void scrollpane::update_content_size()
|
|||
set_dirty();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gui
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
//! @file widgets/scrollpane.hpp
|
||||
|
||||
#ifndef SCROLLPANE_HPP_INCLUDED
|
||||
#define SCROLLPANE_HPP_INCLUDED
|
||||
|
||||
|
@ -24,6 +26,7 @@
|
|||
|
||||
namespace gui {
|
||||
|
||||
//! Scrollpane.
|
||||
class scrollpane : public scrollarea
|
||||
{
|
||||
public:
|
||||
|
@ -37,16 +40,17 @@ public:
|
|||
int z_order;
|
||||
};
|
||||
|
||||
/// Create a scrollpane.
|
||||
/// \param d the display object
|
||||
/// \param pane the widget where wheel events take place
|
||||
/// \param callback a callback interface for warning that the grip has been moved
|
||||
//! Create a scrollpane.
|
||||
//! @todo FIXME: parameterlist ??
|
||||
//- @param d the display object
|
||||
//- @param pane the widget where wheel events take place
|
||||
//- @param callback a callback interface for warning that the grip has been moved
|
||||
scrollpane(CVideo &video);
|
||||
|
||||
virtual void set_location(SDL_Rect const &rect);
|
||||
|
||||
//VC++ doesn't like a 'using scrollarea::set_location' directive here, so we declare
|
||||
//an inline forwarding function instead
|
||||
// VC++ doesn't like a 'using scrollarea::set_location' directive here,
|
||||
// so we declare an inline forwarding function instead.
|
||||
void set_location(int x, int y) { widget::set_location(x,y); }
|
||||
|
||||
virtual void hide(bool value=true);
|
||||
|
@ -74,6 +78,6 @@ private:
|
|||
SDL_Rect content_pos_;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gui
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue