Merge remote-tracking branch 'nana_jh/develop' into tests
This commit is contained in:
commit
939cc04c67
@ -86,7 +86,7 @@
|
||||
#define NANA_LINUX
|
||||
#define NANA_X11
|
||||
#else
|
||||
# static_assert(false, "Only Windows and Unix are supported now (Mac OS is experimental)");
|
||||
static_assert(false, "Only Windows and Unix are supported now (Mac OS is experimental)");
|
||||
#endif
|
||||
|
||||
//Define a symbol for POSIX operating system.
|
||||
|
@ -284,6 +284,18 @@ that return a corresponding nana::appearance with predefined values.
|
||||
virtual void visible(bool visibility) = 0;
|
||||
virtual bool visible() const = 0;
|
||||
};//end class caret_interface
|
||||
|
||||
namespace parameters
|
||||
{
|
||||
/// The system-wide parameters for mouse wheel
|
||||
struct mouse_wheel
|
||||
{
|
||||
unsigned lines; ///< The number of lines to scroll when the vertical mouse wheel is moved.
|
||||
unsigned characters; ///< The number of characters to scroll when the horizontal mouse wheel is moved.
|
||||
|
||||
mouse_wheel();
|
||||
};
|
||||
}
|
||||
}//end namespace nana
|
||||
|
||||
#include <nana/pop_ignore_diagnostic>
|
||||
|
@ -575,8 +575,6 @@ namespace nana
|
||||
color_proxy header_floated{ static_cast<color_rgb>(0xBABBBC)};
|
||||
color_proxy item_selected{ static_cast<color_rgb>(0xD5EFFC) };
|
||||
|
||||
/// \todo how to implement some geometrical parameters ??
|
||||
|
||||
/// The max column width which is generated by fit_content is allowed. It is ignored when it is 0, or a max value is passed to fit_content.
|
||||
unsigned max_fit_content{ 0 };
|
||||
|
||||
@ -591,8 +589,7 @@ namespace nana
|
||||
unsigned header_splitter_area_before{ 2 }; ///< def=2. But 4 is better... IMO
|
||||
unsigned header_splitter_area_after { 3 }; ///< def=3. But 4 is better...
|
||||
|
||||
//void debug_print(const std::string &msg);
|
||||
|
||||
::nana::parameters::mouse_wheel mouse_wheel{}; ///< The number of lines/characters to scroll when vertical/horizontal mouse wheel is moved.
|
||||
};
|
||||
}
|
||||
}//end namespace drawerbase
|
||||
|
@ -28,6 +28,8 @@ namespace nana
|
||||
{
|
||||
color_proxy selection{static_cast<color_rgb>(0x3399FF)};
|
||||
color_proxy selection_text{colors::white};
|
||||
|
||||
parameters::mouse_wheel mouse_wheel; ///< The number of lines/characters to scroll when the vertical/horizontal mouse wheel is moved.
|
||||
};
|
||||
|
||||
class text_editor_event_interface
|
||||
|
@ -14,21 +14,33 @@
|
||||
|
||||
#include <nana/gui/basis.hpp>
|
||||
|
||||
namespace nana
|
||||
using namespace nana;
|
||||
using namespace nana::parameters;
|
||||
|
||||
//struct appearance
|
||||
appearance::appearance()
|
||||
:taskbar(true), floating(false), no_activate(false),
|
||||
minimize(true), maximize(true), sizable(true),
|
||||
decoration(true)
|
||||
{}
|
||||
|
||||
appearance::appearance(bool has_decorate, bool taskbar, bool is_float, bool no_activate, bool min, bool max, bool sizable)
|
||||
: taskbar(taskbar), floating(is_float), no_activate(no_activate),
|
||||
minimize(min), maximize(max), sizable(sizable),
|
||||
decoration(has_decorate)
|
||||
{}
|
||||
//end struct appearance
|
||||
|
||||
#if defined(NANA_WINDOWS)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
mouse_wheel::mouse_wheel()
|
||||
: lines(3), characters(3)
|
||||
{
|
||||
//struct appearance
|
||||
//@brief: Window appearance structure
|
||||
appearance::appearance()
|
||||
:taskbar(true), floating(false), no_activate(false),
|
||||
minimize(true), maximize(true), sizable(true),
|
||||
decoration(true)
|
||||
{}
|
||||
|
||||
appearance::appearance(bool has_decorate, bool taskbar, bool is_float, bool no_activate, bool min, bool max, bool sizable)
|
||||
: taskbar(taskbar), floating(is_float), no_activate(no_activate),
|
||||
minimize(min), maximize(max), sizable(sizable),
|
||||
decoration(has_decorate)
|
||||
{}
|
||||
//end struct appearance
|
||||
}//end namespace nana
|
||||
#if defined(NANA_WINDOWS)
|
||||
::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &lines, 0);
|
||||
::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &characters, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2147,8 +2147,17 @@ namespace nana
|
||||
}
|
||||
|
||||
/// directly set a tested relative display pos
|
||||
void set_scroll_y_dpl(const index_pair& pos_dpl)
|
||||
void set_scroll_y_dpl(index_pair pos_dpl)
|
||||
{
|
||||
if (lister.first() != pos_dpl)
|
||||
{
|
||||
//check the pos_dpl to make sure the last item is at bottom of listbox
|
||||
const auto numbers = this->number_of_lister_items(false);
|
||||
const auto distance = lister.distance(pos_dpl, lister.last());
|
||||
if (numbers > 1 && distance < numbers)
|
||||
lister.backward(lister.last(), numbers - 1, pos_dpl);
|
||||
}
|
||||
|
||||
scroll.offset_y_dpl = pos_dpl;
|
||||
if (pos_dpl.is_category())
|
||||
scroll.offset_y_abs = pos_dpl;
|
||||
@ -2161,7 +2170,7 @@ namespace nana
|
||||
|
||||
|
||||
//number_of_lister_item
|
||||
/// @brief Returns the number of items that are contained in pixels
|
||||
/// @brief Returns the number of items that are contained on screen.
|
||||
/// @param with_rest: Means whether including extra one item that is not completely contained in reset pixels.
|
||||
size_type number_of_lister_items(bool with_rest) const
|
||||
{
|
||||
@ -2509,11 +2518,11 @@ namespace nana
|
||||
if(scroll.v.empty() || !scroll.v.scrollable(upwards))
|
||||
return false;
|
||||
|
||||
index_pair target;
|
||||
if(upwards == false)
|
||||
lister.forward(scroll.offset_y_dpl, 1, target);
|
||||
index_pair target; //index for display
|
||||
if (upwards == false)
|
||||
lister.forward(scroll.offset_y_dpl, this->scheme_ptr->mouse_wheel.lines, target);
|
||||
else
|
||||
lister.backward(scroll.offset_y_dpl, 1, target);
|
||||
lister.backward(scroll.offset_y_dpl, this->scheme_ptr->mouse_wheel.lines, target);
|
||||
|
||||
if (target == scroll.offset_y_dpl)
|
||||
return false;
|
||||
|
@ -2584,7 +2584,7 @@ namespace nana{ namespace widgets
|
||||
{
|
||||
if(vert && attributes_.vscroll)
|
||||
{
|
||||
attributes_.vscroll->make_step(!upwards);
|
||||
attributes_.vscroll->make_step(!upwards, this->scheme_->mouse_wheel.lines);
|
||||
if(_m_scroll_text(true))
|
||||
{
|
||||
render(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user