add new method for place.splitter renderer
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include <nana/deploy.hpp>
|
||||
@@ -582,6 +583,9 @@ namespace nana
|
||||
std::map<std::string, field_dock*> docks;
|
||||
std::map<std::string, field_dock*> dock_factoris;
|
||||
|
||||
std::function<void(window, paint::graphics&, nana::mouse_action)> split_renderer;
|
||||
std::set<div_splitter*> splitters;
|
||||
|
||||
//A temporary pointer used to refer to a specified div object which
|
||||
//will be deleted in modification process.
|
||||
std::unique_ptr<division> tmp_replaced;
|
||||
@@ -1601,9 +1605,24 @@ namespace nana
|
||||
impl_(impl),
|
||||
init_weight_(init_weight)
|
||||
{
|
||||
impl->splitters.insert(this);
|
||||
this->splitter_.set_renderer(impl_->split_renderer);
|
||||
|
||||
this->weight.assign(splitter_px);
|
||||
}
|
||||
|
||||
~div_splitter()
|
||||
{
|
||||
impl_->splitters.erase(this);
|
||||
}
|
||||
|
||||
void set_renderer(const std::function<void(window, paint::graphics&, mouse_action)> & fn, bool update)
|
||||
{
|
||||
this->splitter_.set_renderer(fn);
|
||||
if (update && this->splitter_.handle())
|
||||
API::refresh_window(this->splitter_);
|
||||
}
|
||||
|
||||
void direction(bool horizontal) noexcept
|
||||
{
|
||||
splitter_cursor_ = (horizontal ? cursor::size_we : cursor::size_ns);
|
||||
@@ -1943,7 +1962,7 @@ namespace nana
|
||||
private:
|
||||
implement* const impl_;
|
||||
nana::cursor splitter_cursor_{nana::cursor::arrow};
|
||||
place_parts::splitter<true> splitter_;
|
||||
place_parts::splitter splitter_;
|
||||
nana::point begin_point_;
|
||||
int left_pos_, right_pos_;
|
||||
unsigned left_pixels_, right_pixels_;
|
||||
@@ -2510,8 +2529,7 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
for (auto & el : field.second->elements)
|
||||
API::show_window(el.handle, is_show);
|
||||
field.second->visible(is_show);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3009,6 +3027,14 @@ namespace nana
|
||||
return impl_->window_handle;
|
||||
}
|
||||
|
||||
void place::splitter_renderer(std::function<void(window, paint::graphics&, mouse_action)> fn)
|
||||
{
|
||||
impl_->split_renderer.swap(fn);
|
||||
|
||||
for (auto sp : impl_->splitters)
|
||||
sp->set_renderer(impl_->split_renderer, true);
|
||||
}
|
||||
|
||||
void place::div(const char* s)
|
||||
{
|
||||
place_parts::tokenizer tknizer(s);
|
||||
|
||||
Reference in New Issue
Block a user