Color Schemes
textbox.scheme().selection = color(colors::red); Set the text selection background color
This commit is contained in:
@@ -49,9 +49,7 @@ namespace nana
|
||||
void caret_descriptor::effective_range(nana::rectangle rect)
|
||||
{
|
||||
//Chech rect
|
||||
if( (rect.width && rect.height) &&
|
||||
(rect.x + rect.width > 0) &&
|
||||
(rect.y + rect.height > 0))
|
||||
if (rect.width && rect.height && rect.right() > 0 && rect.bottom() > 0)
|
||||
{
|
||||
if(rect.x < 0)
|
||||
{
|
||||
@@ -151,9 +149,9 @@ namespace nana
|
||||
size.width -= (rect.x - pos.x);
|
||||
pos.x = rect.x;
|
||||
}
|
||||
else if(pos.x + size.width > rect.x + rect.width)
|
||||
else if(pos.x + size.width > rect.right())
|
||||
{
|
||||
size.width -= pos.x + size.width - (rect.x + rect.width);
|
||||
size.width -= pos.x + size.width - rect.right();
|
||||
}
|
||||
|
||||
if(pos.y < rect.y)
|
||||
@@ -161,8 +159,8 @@ namespace nana
|
||||
size.width -= (rect.y - pos.y);
|
||||
pos.y = rect.y;
|
||||
}
|
||||
else if(pos.y + size.height > rect.y + rect.height)
|
||||
size.height -= pos.y + size.height - (rect.y + rect.height);
|
||||
else if(pos.y + size.height > rect.bottom())
|
||||
size.height -= pos.y + size.height - rect.bottom();
|
||||
|
||||
if(out_of_range_)
|
||||
{
|
||||
@@ -228,7 +226,7 @@ namespace nana
|
||||
: widget_ptr(wdg), other(category::root_tag::value)
|
||||
{
|
||||
drawer.bind(this);
|
||||
_m_init_pos_and_size(0, rectangle());
|
||||
_m_init_pos_and_size(nullptr, rectangle());
|
||||
this->_m_initialize(owner);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <nana/config.hpp>
|
||||
#include PLATFORM_SPEC_HPP
|
||||
#include GUI_BEDROCK_HPP
|
||||
#include <nana/gui/detail/bedrock_pi_data.hpp>
|
||||
#include <nana/gui/detail/event_code.hpp>
|
||||
#include <nana/system/platform.hpp>
|
||||
#include <sstream>
|
||||
@@ -120,6 +120,16 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
widget_colors& bedrock::get_scheme_template(scheme_factory_base&& factory)
|
||||
{
|
||||
return pi_data_->scheme.scheme_template(std::move(factory));
|
||||
}
|
||||
|
||||
std::unique_ptr<widget_colors> bedrock::make_scheme(scheme_factory_base&& factory)
|
||||
{
|
||||
return pi_data_->scheme.create(std::move(factory));
|
||||
}
|
||||
|
||||
void bedrock::_m_emit_core(event_code evt_code, core_window_t* wd, bool draw_only, const ::nana::detail::event_arg_interface& event_arg)
|
||||
{
|
||||
switch (evt_code)
|
||||
|
||||
78
source/gui/detail/color_schemes.cpp
Normal file
78
source/gui/detail/color_schemes.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include <nana/gui/detail/color_schemes.hpp>
|
||||
#include <map>
|
||||
|
||||
namespace nana
|
||||
{
|
||||
//class color_proxy
|
||||
color_proxy::color_proxy(const color_proxy& other)
|
||||
: color_(other.color_)
|
||||
{}
|
||||
|
||||
color_proxy::color_proxy(color_rgb clr)
|
||||
: color_(std::make_shared<color>(clr))
|
||||
{}
|
||||
|
||||
color_proxy::color_proxy(colors clr)
|
||||
: color_(std::make_shared<color>(clr))
|
||||
{}
|
||||
|
||||
color_proxy& color_proxy::operator=(const color_proxy& other)
|
||||
{
|
||||
if (this != &other)
|
||||
color_ = other.color_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
color_proxy& color_proxy::operator=(const ::nana::color& clr)
|
||||
{
|
||||
color_ = std::make_shared<::nana::color>(clr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
color color_proxy::get_color() const
|
||||
{
|
||||
return *color_;
|
||||
}
|
||||
|
||||
color_proxy::operator color() const
|
||||
{
|
||||
return *color_;
|
||||
}
|
||||
//end class color_proxy
|
||||
|
||||
namespace detail
|
||||
{
|
||||
//class color_schemes
|
||||
struct color_schemes::implement
|
||||
{
|
||||
std::map<scheme_factory_base::factory_identifier*, std::unique_ptr<scheme>> scheme_template;
|
||||
};
|
||||
|
||||
color_schemes::color_schemes()
|
||||
: impl_(new implement)
|
||||
{
|
||||
}
|
||||
|
||||
color_schemes::~color_schemes()
|
||||
{
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
auto color_schemes::scheme_template(scheme_factory_base&& factory) -> scheme&
|
||||
{
|
||||
auto & tmpl_scheme = impl_->scheme_template[factory.get_id()];
|
||||
|
||||
//Creates a scheme template if no template
|
||||
if (!tmpl_scheme)
|
||||
factory.create().swap(tmpl_scheme);
|
||||
|
||||
return *tmpl_scheme.get();
|
||||
}
|
||||
|
||||
std::unique_ptr<widget_colors> color_schemes::create(scheme_factory_base&& factory)
|
||||
{
|
||||
return factory.create(scheme_template(std::move(factory)));
|
||||
}
|
||||
//end class color_system
|
||||
}//end namespace detail
|
||||
}//end namespace nana
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <nana/config.hpp>
|
||||
#include GUI_BEDROCK_HPP
|
||||
#include <nana/gui/detail/bedrock.hpp>
|
||||
#include <nana/gui/detail/drawer.hpp>
|
||||
#include <nana/gui/detail/dynamic_drawing_object.hpp>
|
||||
#include <nana/gui/detail/effects_renderer.hpp>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <nana/config.hpp>
|
||||
#include PLATFORM_SPEC_HPP
|
||||
#include GUI_BEDROCK_HPP
|
||||
#include <nana/gui/detail/bedrock_pi_data.hpp>
|
||||
#include <nana/gui/detail/event_code.hpp>
|
||||
#include <nana/system/platform.hpp>
|
||||
#include <nana/gui/detail/inner_fwd_implement.hpp>
|
||||
@@ -165,13 +165,14 @@ namespace detail
|
||||
}
|
||||
|
||||
bedrock::bedrock()
|
||||
: impl_(new private_impl)
|
||||
: pi_data_(new pi_data), impl_(new private_impl)
|
||||
{
|
||||
nana::detail::platform_spec::instance().msg_set(timer_proc, window_proc_dispatcher);
|
||||
}
|
||||
|
||||
bedrock::~bedrock()
|
||||
{
|
||||
delete pi_data_;
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <nana/paint/detail/image_ico.hpp>
|
||||
#elif defined(NANA_X11)
|
||||
#include <nana/system/platform.hpp>
|
||||
#include GUI_BEDROCK_HPP
|
||||
#include <nana/gui/detail/bedrock.hpp>
|
||||
#endif
|
||||
|
||||
namespace nana{
|
||||
|
||||
@@ -13,16 +13,18 @@
|
||||
#include <nana/config.hpp>
|
||||
|
||||
#include PLATFORM_SPEC_HPP
|
||||
#include GUI_BEDROCK_HPP
|
||||
#include <nana/gui/detail/bedrock.hpp>
|
||||
#include <nana/gui/detail/bedrock_pi_data.hpp>
|
||||
#include <nana/gui/detail/event_code.hpp>
|
||||
#include <nana/system/platform.hpp>
|
||||
#include <sstream>
|
||||
#include <nana/system/timepiece.hpp>
|
||||
#include <nana/gui/wvl.hpp>
|
||||
#include <nana/gui.hpp>
|
||||
#include <nana/gui/detail/inner_fwd_implement.hpp>
|
||||
#include <nana/gui/detail/native_window_interface.hpp>
|
||||
#include <nana/gui/layout_utility.hpp>
|
||||
#include <nana/gui/detail/element_store.hpp>
|
||||
#include <nana/gui/detail/color_schemes.hpp>
|
||||
|
||||
#ifndef WM_MOUSEWHEEL
|
||||
#define WM_MOUSEWHEEL 0x020A
|
||||
@@ -175,7 +177,8 @@ namespace detail
|
||||
std::recursive_mutex mutex;
|
||||
thr_context_container thr_contexts;
|
||||
|
||||
element_store estore;
|
||||
color_schemes schemes;
|
||||
element_store estore;
|
||||
|
||||
struct cache_type
|
||||
{
|
||||
@@ -213,7 +216,8 @@ namespace detail
|
||||
static LRESULT WINAPI Bedrock_WIN32_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
bedrock::bedrock()
|
||||
:impl_(new private_impl)
|
||||
: pi_data_(new pi_data),
|
||||
impl_(new private_impl)
|
||||
{
|
||||
nana::detail::platform_spec::instance(); //to guaranty the platform_spec object is initialized before using.
|
||||
|
||||
@@ -269,6 +273,7 @@ namespace detail
|
||||
::MessageBoxA(0, ss.str().c_str(), ("Nana C++ Library"), MB_OK);
|
||||
}
|
||||
delete impl_;
|
||||
delete pi_data_;
|
||||
}
|
||||
|
||||
//inc_window
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <nana/config.hpp>
|
||||
#include GUI_BEDROCK_HPP
|
||||
#include <nana/gui/detail/bedrock.hpp>
|
||||
#include <nana/gui/detail/handle_manager.hpp>
|
||||
#include <nana/gui/detail/window_manager.hpp>
|
||||
#include <nana/gui/detail/native_window_interface.hpp>
|
||||
|
||||
Reference in New Issue
Block a user