add scheme to slider
rename widget_colors to widget_geometrics
This commit is contained in:
parent
c775ef9f24
commit
50b982eca7
@ -16,7 +16,7 @@
|
|||||||
#include <nana/push_ignore_diagnostic>
|
#include <nana/push_ignore_diagnostic>
|
||||||
#include "drawer.hpp"
|
#include "drawer.hpp"
|
||||||
#include "events_holder.hpp"
|
#include "events_holder.hpp"
|
||||||
#include "widget_colors.hpp"
|
#include "widget_geometrics.hpp"
|
||||||
#include "widget_notifier_interface.hpp"
|
#include "widget_notifier_interface.hpp"
|
||||||
#include <nana/basic_types.hpp>
|
#include <nana/basic_types.hpp>
|
||||||
#include <nana/system/platform.hpp>
|
#include <nana/system/platform.hpp>
|
||||||
@ -180,7 +180,7 @@ namespace detail
|
|||||||
std::shared_ptr<general_events> events_ptr;
|
std::shared_ptr<general_events> events_ptr;
|
||||||
}together;
|
}together;
|
||||||
|
|
||||||
widget_colors* scheme{ nullptr };
|
widget_geometrics* scheme{ nullptr };
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -82,8 +82,8 @@ namespace detail
|
|||||||
void define_state_cursor(core_window_t*, nana::cursor, thread_context*);
|
void define_state_cursor(core_window_t*, nana::cursor, thread_context*);
|
||||||
void undefine_state_cursor(core_window_t*, thread_context*);
|
void undefine_state_cursor(core_window_t*, thread_context*);
|
||||||
|
|
||||||
widget_colors& get_scheme_template(scheme_factory_interface&&);
|
widget_geometrics& get_scheme_template(scheme_factory_interface&&);
|
||||||
widget_colors* make_scheme(scheme_factory_interface&&);
|
widget_geometrics* make_scheme(scheme_factory_interface&&);
|
||||||
|
|
||||||
events_operation& evt_operation();
|
events_operation& evt_operation();
|
||||||
window_manager& wd_manager();
|
window_manager& wd_manager();
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#ifndef NANA_DETAIL_COLOR_SCHEMES_HPP
|
#ifndef NANA_DETAIL_COLOR_SCHEMES_HPP
|
||||||
#define NANA_DETAIL_COLOR_SCHEMES_HPP
|
#define NANA_DETAIL_COLOR_SCHEMES_HPP
|
||||||
|
|
||||||
#include "widget_colors.hpp"
|
#include "widget_geometrics.hpp"
|
||||||
|
|
||||||
namespace nana
|
namespace nana
|
||||||
{
|
{
|
||||||
@ -26,8 +26,8 @@ namespace nana
|
|||||||
virtual ~scheme_factory_interface() = default;
|
virtual ~scheme_factory_interface() = default;
|
||||||
|
|
||||||
virtual factory_identifier* get_id() const = 0;
|
virtual factory_identifier* get_id() const = 0;
|
||||||
virtual widget_colors* create() = 0;
|
virtual widget_geometrics* create() = 0;
|
||||||
virtual widget_colors* create(widget_colors&) = 0;
|
virtual widget_geometrics* create(widget_geometrics&) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -41,12 +41,12 @@ namespace nana
|
|||||||
return &fid_;
|
return &fid_;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget_colors* create() override
|
widget_geometrics* create() override
|
||||||
{
|
{
|
||||||
return (new Scheme);
|
return (new Scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget_colors* create(widget_colors& other) override
|
widget_geometrics* create(widget_geometrics& other) override
|
||||||
{
|
{
|
||||||
return (new Scheme(static_cast<Scheme&>(other)));
|
return (new Scheme(static_cast<Scheme&>(other)));
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ namespace nana
|
|||||||
color_schemes& operator=(const color_schemes&) = delete;
|
color_schemes& operator=(const color_schemes&) = delete;
|
||||||
color_schemes& operator=(color_schemes&&) = delete;
|
color_schemes& operator=(color_schemes&&) = delete;
|
||||||
public:
|
public:
|
||||||
using scheme = widget_colors;
|
using scheme = widget_geometrics;
|
||||||
|
|
||||||
color_schemes();
|
color_schemes();
|
||||||
~color_schemes();
|
~color_schemes();
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Color Schemes
|
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
|
||||||
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
|
|
||||||
*
|
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*
|
|
||||||
* @file: nana/gui/widget_colors.hpp
|
|
||||||
* @description:
|
|
||||||
*/
|
|
||||||
#ifndef NANA_DETAIL_WIDGET_COLORS_HPP
|
|
||||||
#define NANA_DETAIL_WIDGET_COLORS_HPP
|
|
||||||
|
|
||||||
#include <nana/gui/basis.hpp>
|
|
||||||
#include <memory>
|
|
||||||
namespace nana
|
|
||||||
{
|
|
||||||
class color_proxy
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
color_proxy(const color_proxy&);
|
|
||||||
color_proxy(color_rgb);
|
|
||||||
color_proxy(colors);
|
|
||||||
color_proxy& operator=(const color_proxy&);
|
|
||||||
color_proxy& operator=(const ::nana::color&);
|
|
||||||
color_proxy& operator=(color_rgb);
|
|
||||||
color_proxy& operator=(colors);
|
|
||||||
color get_color() const;
|
|
||||||
operator color() const;
|
|
||||||
private:
|
|
||||||
std::shared_ptr<color> color_;
|
|
||||||
};//end namespace color_proxy
|
|
||||||
|
|
||||||
struct widget_colors
|
|
||||||
{
|
|
||||||
virtual ~widget_colors() = default;
|
|
||||||
|
|
||||||
color_proxy activated{ static_cast<color_rgb>(0x60C8FD) };
|
|
||||||
color_proxy background{colors::button_face};
|
|
||||||
color_proxy foreground{colors::black};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -38,7 +38,7 @@ namespace nana
|
|||||||
struct widget_traits<widget>
|
struct widget_traits<widget>
|
||||||
{
|
{
|
||||||
using event_type = ::nana::general_events;
|
using event_type = ::nana::general_events;
|
||||||
using scheme_type = ::nana::widget_colors;
|
using scheme_type = ::nana::widget_geometrics;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ namespace API
|
|||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
::nana::widget_colors* make_scheme(::nana::detail::scheme_factory_interface&&);
|
::nana::widget_geometrics* make_scheme(::nana::detail::scheme_factory_interface&&);
|
||||||
}
|
}
|
||||||
|
|
||||||
void effects_edge_nimbus(window, effects::edge_nimbus);
|
void effects_edge_nimbus(window, effects::edge_nimbus);
|
||||||
@ -70,8 +70,8 @@ namespace API
|
|||||||
return std::unique_ptr<Scheme>{static_cast<Scheme*>(API::detail::make_scheme(::nana::detail::scheme_factory<Scheme>()))};
|
return std::unique_ptr<Scheme>{static_cast<Scheme*>(API::detail::make_scheme(::nana::detail::scheme_factory<Scheme>()))};
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_scheme(window, widget_colors*);
|
void set_scheme(window, widget_geometrics*);
|
||||||
widget_colors* get_scheme(window);
|
widget_geometrics* get_scheme(window);
|
||||||
|
|
||||||
void attach_drawer(widget&, drawer_trigger&);
|
void attach_drawer(widget&, drawer_trigger&);
|
||||||
::nana::detail::native_string_type window_caption(window) throw();
|
::nana::detail::native_string_type window_caption(window) throw();
|
||||||
@ -250,7 +250,7 @@ namespace API
|
|||||||
if (nullptr == wdg_colors)
|
if (nullptr == wdg_colors)
|
||||||
throw std::invalid_argument("API::scheme(): bad parameter window handle, no events object or invalid window handle.");
|
throw std::invalid_argument("API::scheme(): bad parameter window handle, no events object or invalid window handle.");
|
||||||
|
|
||||||
if (std::is_same<::nana::widget_colors, scheme_type>::value)
|
if (std::is_same<::nana::widget_geometrics, scheme_type>::value)
|
||||||
return *static_cast<scheme_type*>(wdg_colors);
|
return *static_cast<scheme_type*>(wdg_colors);
|
||||||
|
|
||||||
auto * comp_wdg_colors = dynamic_cast<scheme_type*>(wdg_colors);
|
auto * comp_wdg_colors = dynamic_cast<scheme_type*>(wdg_colors);
|
||||||
|
@ -520,7 +520,7 @@ namespace nana
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct scheme
|
struct scheme
|
||||||
: public widget_colors
|
: public widget_geometrics
|
||||||
{
|
{
|
||||||
color_proxy header_bgcolor{static_cast<color_rgb>(0xf1f2f4)};
|
color_proxy header_bgcolor{static_cast<color_rgb>(0xf1f2f4)};
|
||||||
color_proxy header_grabbed{ static_cast<color_rgb>(0x8BD6F6)};
|
color_proxy header_grabbed{ static_cast<color_rgb>(0x8BD6F6)};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#ifndef NANA_WIDGETS_SKELETONS_TEXT_EDITOR_SCHEME_HPP
|
#ifndef NANA_WIDGETS_SKELETONS_TEXT_EDITOR_SCHEME_HPP
|
||||||
#define NANA_WIDGETS_SKELETONS_TEXT_EDITOR_SCHEME_HPP
|
#define NANA_WIDGETS_SKELETONS_TEXT_EDITOR_SCHEME_HPP
|
||||||
|
|
||||||
#include "../../detail/widget_colors.hpp"
|
#include "../../detail/widget_geometrics.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace nana
|
namespace nana
|
||||||
@ -24,7 +24,7 @@ namespace nana
|
|||||||
class text_editor;
|
class text_editor;
|
||||||
|
|
||||||
struct text_editor_scheme
|
struct text_editor_scheme
|
||||||
: public ::nana::widget_colors
|
: public ::nana::widget_geometrics
|
||||||
{
|
{
|
||||||
color_proxy selection{static_cast<color_rgb>(0x3399FF)};
|
color_proxy selection{static_cast<color_rgb>(0x3399FF)};
|
||||||
color_proxy selection_text{colors::white};
|
color_proxy selection_text{colors::white};
|
||||||
|
@ -33,6 +33,23 @@ namespace nana
|
|||||||
{
|
{
|
||||||
namespace slider
|
namespace slider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct scheme_impl
|
||||||
|
: public widget_geometrics
|
||||||
|
{
|
||||||
|
/// Colors
|
||||||
|
color_proxy color_adorn{ static_cast<color_rgb>(0x3da3ce) };
|
||||||
|
color_proxy color_bar{ static_cast<color_rgb>(0x878787) };
|
||||||
|
color_proxy color_slider{ static_cast<color_rgb>(0x606060) };
|
||||||
|
color_proxy color_slider_highlighted{ static_cast<color_rgb>(0x2d93be) };
|
||||||
|
color_proxy color_vernier{ colors::red };
|
||||||
|
color_proxy color_vernier_text{ colors::white };
|
||||||
|
|
||||||
|
/// Geometrical parameters
|
||||||
|
unsigned vernier_text_margin{ 8 };
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
struct slider_events
|
struct slider_events
|
||||||
: public general_events
|
: public general_events
|
||||||
{
|
{
|
||||||
@ -49,6 +66,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using graph_reference = ::nana::paint::graphics&;
|
using graph_reference = ::nana::paint::graphics&;
|
||||||
|
using scheme = scheme_impl;
|
||||||
|
|
||||||
struct data_bar
|
struct data_bar
|
||||||
{
|
{
|
||||||
@ -86,11 +104,11 @@ namespace nana
|
|||||||
|
|
||||||
virtual ~renderer_interface() = default;
|
virtual ~renderer_interface() = default;
|
||||||
|
|
||||||
virtual void background(window, graph_reference, bool isglass) = 0;
|
virtual void background(window, graph_reference, bool transparent, const scheme&) = 0;
|
||||||
virtual void adorn(window, graph_reference, const data_adorn&) = 0;
|
virtual void adorn(window, graph_reference, const data_adorn&, const scheme&) = 0;
|
||||||
virtual void vernier(window, graph_reference, const data_vernier&) = 0;
|
virtual void vernier(window, graph_reference, const data_vernier&, const scheme&) = 0;
|
||||||
virtual void bar(window, graph_reference, const data_bar&) = 0;
|
virtual void bar(window, graph_reference, const data_bar&, const scheme&) = 0;
|
||||||
virtual void slider(window, graph_reference, mouse_action, const data_slider&) = 0;
|
virtual void slider(window, graph_reference, mouse_action, const data_slider&, const scheme&) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class trigger
|
class trigger
|
||||||
@ -118,7 +136,7 @@ namespace nana
|
|||||||
|
|
||||||
/// A slider widget wich the user can drag for tracking \todo add scheme ?
|
/// A slider widget wich the user can drag for tracking \todo add scheme ?
|
||||||
class slider
|
class slider
|
||||||
: public widget_object<category::widget_tag, drawerbase::slider::trigger, drawerbase::slider::slider_events>
|
: public widget_object<category::widget_tag, drawerbase::slider::trigger, drawerbase::slider::slider_events, drawerbase::slider::scheme_impl>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using renderer_interface = drawerbase::slider::renderer_interface; ///< The interface for customized renderer.
|
using renderer_interface = drawerbase::slider::renderer_interface; ///< The interface for customized renderer.
|
||||||
|
@ -160,7 +160,7 @@ namespace nana
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Base class of all the classes defined as a widget window. Defaultly a widget_tag
|
/// Base class of all the classes defined as a widget window. Defaultly a widget_tag
|
||||||
template<typename Category, typename DrawerTrigger, typename Events = ::nana::general_events, typename Scheme = ::nana::widget_colors>
|
template<typename Category, typename DrawerTrigger, typename Events = ::nana::general_events, typename Scheme = ::nana::widget_geometrics>
|
||||||
class widget_object: public detail::widget_base
|
class widget_object: public detail::widget_base
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -353,12 +353,12 @@ namespace nana
|
|||||||
return pi_data_->shortkey_occurred;
|
return pi_data_->shortkey_occurred;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget_colors& bedrock::get_scheme_template(scheme_factory_interface&& factory)
|
widget_geometrics& bedrock::get_scheme_template(scheme_factory_interface&& factory)
|
||||||
{
|
{
|
||||||
return pi_data_->scheme.scheme_template(std::move(factory));
|
return pi_data_->scheme.scheme_template(std::move(factory));
|
||||||
}
|
}
|
||||||
|
|
||||||
widget_colors* bedrock::make_scheme(scheme_factory_interface&& factory)
|
widget_geometrics* bedrock::make_scheme(scheme_factory_interface&& factory)
|
||||||
{
|
{
|
||||||
return pi_data_->scheme.create(std::move(factory));
|
return pi_data_->scheme.create(std::move(factory));
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ namespace nana
|
|||||||
return *tmpl_scheme.get();
|
return *tmpl_scheme.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
widget_colors* color_schemes::create(scheme_factory_interface&& factory)
|
widget_geometrics* color_schemes::create(scheme_factory_interface&& factory)
|
||||||
{
|
{
|
||||||
return factory.create(scheme_template(std::move(factory)));
|
return factory.create(scheme_template(std::move(factory)));
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ namespace API
|
|||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
::nana::widget_colors* make_scheme(::nana::detail::scheme_factory_interface&& factory)
|
::nana::widget_geometrics* make_scheme(::nana::detail::scheme_factory_interface&& factory)
|
||||||
{
|
{
|
||||||
return restrict::bedrock.make_scheme(static_cast<::nana::detail::scheme_factory_interface&&>(factory));
|
return restrict::bedrock.make_scheme(static_cast<::nana::detail::scheme_factory_interface&&>(factory));
|
||||||
}
|
}
|
||||||
@ -195,15 +195,15 @@ namespace API
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_scheme(window wd, widget_colors* wdg_colors)
|
void set_scheme(window wd, widget_geometrics* wdg_geom)
|
||||||
{
|
{
|
||||||
auto iwd = reinterpret_cast<basic_window*>(wd);
|
auto iwd = reinterpret_cast<basic_window*>(wd);
|
||||||
internal_scope_guard lock;
|
internal_scope_guard lock;
|
||||||
if (restrict::wd_manager().available(iwd))
|
if (restrict::wd_manager().available(iwd))
|
||||||
iwd->scheme = wdg_colors;
|
iwd->scheme = wdg_geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget_colors* get_scheme(window wd)
|
widget_geometrics* get_scheme(window wd)
|
||||||
{
|
{
|
||||||
auto iwd = reinterpret_cast<basic_window*>(wd);
|
auto iwd = reinterpret_cast<basic_window*>(wd);
|
||||||
internal_scope_guard lock;
|
internal_scope_guard lock;
|
||||||
|
@ -17,13 +17,13 @@ namespace nana
|
|||||||
: public renderer_interface
|
: public renderer_interface
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void background(window wd, graph_reference graph, bool isglass) override
|
void background(window wd, graph_reference graph, bool transparent, const scheme& schm) override
|
||||||
{
|
{
|
||||||
if(!isglass)
|
if (!transparent)
|
||||||
graph.rectangle(true, API::bgcolor(wd));
|
graph.rectangle(true, schm.background);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bar(window, graph_reference graph, const data_bar& data) override
|
void bar(window, graph_reference graph, const data_bar& data, const scheme& schm) override
|
||||||
{
|
{
|
||||||
auto area = data.area;
|
auto area = data.area;
|
||||||
|
|
||||||
@ -38,10 +38,10 @@ namespace nana
|
|||||||
area.height = 4;
|
area.height = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
graph.rectangle(area, false, static_cast<color_rgb>(0x878787));
|
graph.rectangle(area, false, schm.color_bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void adorn(window, graph_reference graph, const data_adorn& data) override
|
void adorn(window, graph_reference graph, const data_adorn& data, const scheme& schm) override
|
||||||
{
|
{
|
||||||
rectangle area{
|
rectangle area{
|
||||||
data.bound.x, data.fixedpos + static_cast<int>(data.block / 2) - 1,
|
data.bound.x, data.fixedpos + static_cast<int>(data.block / 2) - 1,
|
||||||
@ -51,19 +51,19 @@ namespace nana
|
|||||||
if (data.vert)
|
if (data.vert)
|
||||||
area.shift();
|
area.shift();
|
||||||
|
|
||||||
graph.rectangle(area, true, static_cast<color_rgb>(0x3DA3CE));
|
graph.rectangle(area, true, schm.color_adorn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void vernier(window, graph_reference graph, const data_vernier& data) override
|
void vernier(window, graph_reference graph, const data_vernier& data, const scheme& schm) override
|
||||||
{
|
{
|
||||||
if (data.vert)
|
if (data.vert)
|
||||||
_m_draw_vernier_vert(graph, data);
|
_m_draw_vernier_vert(graph, data, schm);
|
||||||
else
|
else
|
||||||
_m_draw_vernier_horz(graph, data);
|
_m_draw_vernier_horz(graph, data, schm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void slider(window, graph_reference graph, mouse_action mouse_act, const data_slider& data) override
|
void slider(window, graph_reference graph, mouse_action mouse_act, const data_slider& data, const scheme& schm) override
|
||||||
{
|
{
|
||||||
nana::rectangle area{ graph.size() };
|
nana::rectangle area{ graph.size() };
|
||||||
|
|
||||||
@ -78,9 +78,9 @@ namespace nana
|
|||||||
area.width = data.weight;
|
area.width = data.weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
color rgb{ static_cast<color_rgb>(0x606060) };
|
color rgb = schm.color_slider;
|
||||||
if (mouse_action::normal != mouse_act)
|
if (mouse_action::normal != mouse_act)
|
||||||
rgb = static_cast<color_rgb>(0x2d93be);
|
rgb = schm.color_slider_highlighted;
|
||||||
|
|
||||||
graph.frame_rectangle(area, rgb + static_cast<color_rgb>(0x0d0d0d), 1);
|
graph.frame_rectangle(area, rgb + static_cast<color_rgb>(0x0d0d0d), 1);
|
||||||
graph.rectangle(area.pare_off(1), true, rgb);
|
graph.rectangle(area.pare_off(1), true, rgb);
|
||||||
@ -89,7 +89,7 @@ namespace nana
|
|||||||
graph.rectangle(area, true, rgb + static_cast<color_rgb>(0x101010));
|
graph.rectangle(area, true, rgb + static_cast<color_rgb>(0x101010));
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void _m_draw_vernier_horz(graph_reference graph, const data_vernier& data)
|
void _m_draw_vernier_horz(graph_reference graph, const data_vernier& data, const scheme& schm)
|
||||||
{
|
{
|
||||||
const unsigned arrow_weight = 5;
|
const unsigned arrow_weight = 5;
|
||||||
|
|
||||||
@ -107,12 +107,10 @@ namespace nana
|
|||||||
|
|
||||||
const size arrow_size{ arrow_weight, 9 };
|
const size arrow_size{ arrow_weight, 9 };
|
||||||
|
|
||||||
|
const auto label_size = graph.text_extent_size(data.text) + size{ schm.vernier_text_margin * 2, 0 };
|
||||||
const unsigned text_margin = 8;
|
|
||||||
const auto label_size = graph.text_extent_size(data.text) + size{ text_margin * 2, 0 };
|
|
||||||
|
|
||||||
paint::graphics graph_vern{ label_size };
|
paint::graphics graph_vern{ label_size };
|
||||||
graph_vern.rectangle(true, colors::red);
|
graph_vern.rectangle(true, schm.color_vernier);
|
||||||
|
|
||||||
int arrow_pos;
|
int arrow_pos;
|
||||||
|
|
||||||
@ -132,10 +130,11 @@ namespace nana
|
|||||||
graph_vern.blend(rectangle{ label_size }, graph, label_pos, 0.5);
|
graph_vern.blend(rectangle{ label_size }, graph, label_pos, 0.5);
|
||||||
|
|
||||||
|
|
||||||
|
unsigned arrow_color = 0x7F | schm.color_vernier.get_color().argb().value;
|
||||||
for (auto & color : arrow_pxbuf)
|
for (auto & color : arrow_pxbuf)
|
||||||
{
|
{
|
||||||
if (color == 0x7F)
|
if (color == 0x7F)
|
||||||
color = 0x7FFF0000;
|
color = arrow_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (label_pos.x > data.position)
|
if (label_pos.x > data.position)
|
||||||
@ -155,12 +154,11 @@ namespace nana
|
|||||||
|
|
||||||
pxbuf.paste(rectangle{ arrow_size }, graph.handle(), { arrow_pos, label_pos.y + static_cast<int>(label_size.height - arrow_size.height) / 2 });
|
pxbuf.paste(rectangle{ arrow_size }, graph.handle(), { arrow_pos, label_pos.y + static_cast<int>(label_size.height - arrow_size.height) / 2 });
|
||||||
|
|
||||||
label_pos.x += text_margin;
|
label_pos.x += static_cast<int>(schm.vernier_text_margin);
|
||||||
graph.palette(true, colors::white);
|
graph.string(label_pos, data.text, schm.color_vernier_text);
|
||||||
graph.string(label_pos, data.text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _m_draw_vernier_vert(graph_reference graph, const data_vernier& data)
|
void _m_draw_vernier_vert(graph_reference graph, const data_vernier& data, const scheme& schm)
|
||||||
{
|
{
|
||||||
const unsigned arrow_weight = 5;
|
const unsigned arrow_weight = 5;
|
||||||
|
|
||||||
@ -174,15 +172,13 @@ namespace nana
|
|||||||
|
|
||||||
const size arrow_size{ 9, arrow_weight};
|
const size arrow_size{ 9, arrow_weight};
|
||||||
|
|
||||||
|
const size label_size = (graph.text_extent_size(data.text) + size{ schm.vernier_text_margin * 2, 0 }).shift();
|
||||||
const unsigned text_margin = 8;
|
|
||||||
const size label_size = (graph.text_extent_size(data.text) + size{ text_margin * 2, 0 }).shift();
|
|
||||||
|
|
||||||
paint::graphics graph_vern{ label_size };
|
paint::graphics graph_vern{ label_size };
|
||||||
|
|
||||||
paint::graphics graph_horz{ size(label_size).shift() };
|
paint::graphics graph_horz{ size(label_size).shift() };
|
||||||
graph_horz.rectangle(true, colors::red);
|
graph_horz.rectangle(true, schm.color_vernier);
|
||||||
graph_horz.string({static_cast<int>(text_margin), static_cast<int>(graph_horz.height() - label_size.width) / 2}, data.text, colors::white);
|
graph_horz.string({ static_cast<int>(schm.vernier_text_margin), static_cast<int>(graph_horz.height() - label_size.width) / 2 }, data.text, schm.color_vernier_text);
|
||||||
|
|
||||||
paint::pixel_buffer{ graph_horz.handle(), 0, graph_horz.height() }.rotate(90, colors::white).paste(graph_vern.handle(), {});
|
paint::pixel_buffer{ graph_horz.handle(), 0, graph_horz.height() }.rotate(90, colors::white).paste(graph_vern.handle(), {});
|
||||||
|
|
||||||
@ -216,14 +212,13 @@ namespace nana
|
|||||||
graph_vern.blend(rectangle{ label_size }, graph, label_pos, 0.5);
|
graph_vern.blend(rectangle{ label_size }, graph, label_pos, 0.5);
|
||||||
|
|
||||||
|
|
||||||
|
unsigned arrow_color = 0x7F | schm.color_vernier.get_color().argb().value;
|
||||||
for (auto & color : arrow_pxbuf)
|
for (auto & color : arrow_pxbuf)
|
||||||
{
|
{
|
||||||
if (color == 0x7F)
|
if (color == 0x7F)
|
||||||
color = 0x7FFF0000;
|
color = arrow_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
paint::pixel_buffer pxbuf{ arrow_size.width, arrow_size.height };
|
paint::pixel_buffer pxbuf{ arrow_size.width, arrow_size.height };
|
||||||
pxbuf.alpha_channel(true);
|
pxbuf.alpha_channel(true);
|
||||||
@ -231,11 +226,7 @@ namespace nana
|
|||||||
|
|
||||||
pxbuf.paste(rectangle{ arrow_size }, graph.handle(), { label_pos.x + static_cast<int>(label_size.width - arrow_size.width) / 2, arrow_pos });
|
pxbuf.paste(rectangle{ arrow_size }, graph.handle(), { label_pos.x + static_cast<int>(label_size.width - arrow_size.width) / 2, arrow_pos });
|
||||||
|
|
||||||
label_pos.y += text_margin;
|
label_pos.y += static_cast<int>(schm.vernier_text_margin);
|
||||||
/*
|
|
||||||
graph.palette(true, colors::white);
|
|
||||||
graph.string(label_pos, data.text);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -308,7 +299,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
if(!graph.size().empty())
|
if(!graph.size().empty())
|
||||||
{
|
{
|
||||||
proto_.renderer->background(other_.wd, graph, (bground_mode::basic == API::effects_bground_mode(other_.wd)));
|
proto_.renderer->background(other_.wd, graph, (bground_mode::basic == API::effects_bground_mode(other_.wd)), other_.widget->scheme());
|
||||||
_m_draw_elements(graph);
|
_m_draw_elements(graph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -634,6 +625,8 @@ namespace nana
|
|||||||
|
|
||||||
void _m_draw_elements(graph_reference graph)
|
void _m_draw_elements(graph_reference graph)
|
||||||
{
|
{
|
||||||
|
auto & scheme = other_.widget->scheme();
|
||||||
|
|
||||||
renderer_interface::data_bar bar;
|
renderer_interface::data_bar bar;
|
||||||
|
|
||||||
bar.vert = attr_.slider.vert;
|
bar.vert = attr_.slider.vert;
|
||||||
@ -643,7 +636,7 @@ namespace nana
|
|||||||
if (bar.area.empty())
|
if (bar.area.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
proto_.renderer->bar(other_.wd, graph, bar);
|
proto_.renderer->bar(other_.wd, graph, bar, scheme);
|
||||||
|
|
||||||
//adorn
|
//adorn
|
||||||
renderer_interface::data_adorn adorn;
|
renderer_interface::data_adorn adorn;
|
||||||
@ -664,10 +657,10 @@ namespace nana
|
|||||||
adorn.block = (bar.vert ? bar.area.width : bar.area.height) - attr_.slider.border_weight * 2;
|
adorn.block = (bar.vert ? bar.area.width : bar.area.height) - attr_.slider.border_weight * 2;
|
||||||
adorn.fixedpos = static_cast<int>((bar.vert ? bar.area.x : bar.area.y) + attr_.slider.border_weight);
|
adorn.fixedpos = static_cast<int>((bar.vert ? bar.area.x : bar.area.y) + attr_.slider.border_weight);
|
||||||
|
|
||||||
proto_.renderer->adorn(other_.wd, graph, adorn);
|
proto_.renderer->adorn(other_.wd, graph, adorn, scheme);
|
||||||
|
|
||||||
//Draw slider
|
//Draw slider
|
||||||
proto_.renderer->slider(other_.wd, graph, slider_state_.mouse_state, attr_.slider);
|
proto_.renderer->slider(other_.wd, graph, slider_state_.mouse_state, attr_.slider, scheme);
|
||||||
|
|
||||||
//adorn textbox
|
//adorn textbox
|
||||||
if (proto_.vernier && attr_.is_draw_adorn)
|
if (proto_.vernier && attr_.is_draw_adorn)
|
||||||
@ -685,7 +678,7 @@ namespace nana
|
|||||||
vern.position += static_cast<int>(attr_.adorn_pos);
|
vern.position += static_cast<int>(attr_.adorn_pos);
|
||||||
|
|
||||||
vern.end_position = adorn.bound.y;
|
vern.end_position = adorn.bound.y;
|
||||||
proto_.renderer->vernier(other_.wd, graph, vern);
|
proto_.renderer->vernier(other_.wd, graph, vern, scheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user