some improvements
improved resizing performance removed frame widget refactoring
This commit is contained in:
parent
bbc39906c0
commit
e89ee5d18b
@ -62,7 +62,6 @@ library nana {
|
||||
gui/widgets/date_chooser.cpp
|
||||
gui/widgets/float_listbox.cpp
|
||||
gui/widgets/form.cpp
|
||||
gui/widgets/frame.cpp
|
||||
gui/widgets/label.cpp
|
||||
gui/widgets/listbox.cpp
|
||||
gui/widgets/menubar.cpp
|
||||
|
@ -88,7 +88,6 @@
|
||||
<Unit filename="../../source/gui/widgets/date_chooser.cpp" />
|
||||
<Unit filename="../../source/gui/widgets/float_listbox.cpp" />
|
||||
<Unit filename="../../source/gui/widgets/form.cpp" />
|
||||
<Unit filename="../../source/gui/widgets/frame.cpp" />
|
||||
<Unit filename="../../source/gui/widgets/group.cpp" />
|
||||
<Unit filename="../../source/gui/widgets/label.cpp" />
|
||||
<Unit filename="../../source/gui/widgets/listbox.cpp" />
|
||||
|
@ -224,7 +224,6 @@
|
||||
<ClCompile Include="..\..\source\gui\widgets\date_chooser.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\float_listbox.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\form.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\frame.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\group.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\label.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\listbox.cpp" />
|
||||
@ -325,7 +324,6 @@
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\detail\tree_cont.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\float_listbox.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\form.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\frame.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\group.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\label.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\listbox.hpp" />
|
||||
|
@ -147,9 +147,6 @@
|
||||
<ClCompile Include="..\..\source\gui\widgets\form.cpp">
|
||||
<Filter>Source Files\nana\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\gui\widgets\frame.cpp">
|
||||
<Filter>Source Files\nana\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\gui\widgets\label.cpp">
|
||||
<Filter>Source Files\nana\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
@ -364,9 +361,6 @@
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\form.hpp">
|
||||
<Filter>Header Files\gui\widgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\frame.hpp">
|
||||
<Filter>Header Files\gui\widgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\label.hpp">
|
||||
<Filter>Header Files\gui\widgets</Filter>
|
||||
</ClInclude>
|
||||
|
@ -218,7 +218,6 @@
|
||||
<ClCompile Include="..\..\source\gui\widgets\date_chooser.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\float_listbox.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\form.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\frame.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\group.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\label.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\listbox.cpp" />
|
||||
|
@ -141,9 +141,6 @@
|
||||
<ClCompile Include="..\..\source\gui\widgets\form.cpp">
|
||||
<Filter>Source Files\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\gui\widgets\frame.cpp">
|
||||
<Filter>Source Files\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\gui\widgets\group.cpp">
|
||||
<Filter>Source Files\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<ProjectGuid>{42D0520F-EFA5-4831-84FE-2B9085301C5D}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>nana</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@ -201,7 +201,6 @@
|
||||
<ClCompile Include="..\..\source\gui\widgets\date_chooser.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\float_listbox.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\form.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\frame.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\group.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\label.cpp" />
|
||||
<ClCompile Include="..\..\source\gui\widgets\listbox.cpp" />
|
||||
@ -271,7 +270,6 @@
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\date_chooser.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\float_listbox.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\form.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\frame.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\group.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\label.hpp" />
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\listbox.hpp" />
|
||||
|
@ -151,9 +151,6 @@
|
||||
<ClCompile Include="..\..\source\gui\widgets\form.cpp">
|
||||
<Filter>Sources\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\gui\widgets\frame.cpp">
|
||||
<Filter>Sources\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\gui\widgets\group.cpp">
|
||||
<Filter>Sources\gui\widgets</Filter>
|
||||
</ClCompile>
|
||||
@ -366,9 +363,6 @@
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\form.hpp">
|
||||
<Filter>Include\gui\widgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\nana\gui\widgets\frame.hpp">
|
||||
<Filter>Include\gui\widgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\nana\gui\animation.hpp">
|
||||
<Filter>Include\gui</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Nana Configuration
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -25,10 +25,6 @@
|
||||
|
||||
#include "c++defines.hpp"
|
||||
|
||||
//This marco is defined since 1.4 and until 1.5 for deprecating frame widget.
|
||||
//This marco and class frame will be removed in version 1.5
|
||||
#define WIDGET_FRAME_DEPRECATED
|
||||
|
||||
//The following basic configurations are ignored when NANA_IGNORE_CONF is defined.
|
||||
//The NANA_IGNORE_CONF may be specified by CMake generated makefile.
|
||||
#ifndef NANA_IGNORE_CONF
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Basis Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -80,17 +80,11 @@ namespace nana
|
||||
widget = 0x1,
|
||||
lite_widget = 0x3,
|
||||
root = 0x5
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
,frame = 0x9
|
||||
#endif
|
||||
};
|
||||
//wait for constexpr
|
||||
struct widget_tag{ static const flags value = flags::widget; };
|
||||
struct lite_widget_tag : public widget_tag{ static const flags value = flags::lite_widget; };
|
||||
struct root_tag : public widget_tag{ static const flags value = flags::root; };
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
struct frame_tag : public widget_tag{ static const flags value = flags::frame; };
|
||||
#endif
|
||||
}// end namespace category
|
||||
|
||||
using native_window_type = detail::native_window_handle_impl*;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* A Basic Window Widget Definition
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -116,10 +116,6 @@ namespace detail
|
||||
/// bind a native window and baisc_window
|
||||
void bind_native_window(native_window_type, unsigned width, unsigned height, unsigned extra_width, unsigned extra_height, paint::graphics&);
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
void frame_window(native_window_type);
|
||||
#endif
|
||||
|
||||
bool is_ancestor_of(const basic_window* wd) const;
|
||||
bool visible_parents() const;
|
||||
bool displayed() const;
|
||||
@ -180,7 +176,8 @@ namespace detail
|
||||
bool ignore_mouse_focus : 1; ///< A flag indicates whether the widget accepts focus when clicking on it
|
||||
bool space_click_enabled : 1; ///< A flag indicates whether enable mouse_down/click/mouse_up when pressing and releasing whitespace key.
|
||||
bool draggable : 1;
|
||||
unsigned Reserved :17;
|
||||
bool ignore_child_mapping : 1;
|
||||
unsigned Reserved :16;
|
||||
unsigned char tab; ///< indicate a window that can receive the keyboard TAB
|
||||
mouse_action action;
|
||||
mouse_action action_before;
|
||||
@ -206,19 +203,8 @@ namespace detail
|
||||
|
||||
struct other_tag
|
||||
{
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
struct attr_frame_tag
|
||||
{
|
||||
native_window_type container{nullptr};
|
||||
std::vector<native_window_type> attach;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct attr_root_tag
|
||||
{
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
container frames; ///< initialization is null, it will be created while creating a frame widget. Refer to WindowManager::create_frame
|
||||
#endif
|
||||
container tabstop;
|
||||
std::vector<edge_nimbus_action> effects_edge_nimbus;
|
||||
basic_window* focus{nullptr};
|
||||
@ -237,12 +223,11 @@ namespace detail
|
||||
update_state upd_state;
|
||||
dragdrop_status dnd_state{ dragdrop_status::not_ready };
|
||||
|
||||
container mapping_requester; ///< Children which are ignored to mapping
|
||||
|
||||
union
|
||||
{
|
||||
attr_root_tag * root;
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
attr_frame_tag * frame;
|
||||
#endif
|
||||
}attribute;
|
||||
|
||||
other_tag(category::flags);
|
||||
|
@ -1,38 +0,0 @@
|
||||
#ifndef NANA_DETAIL_BEDROCK_PI_DATA_HPP
|
||||
#define NANA_DETAIL_BEDROCK_PI_DATA_HPP
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
|
||||
#include <nana/gui/detail/bedrock.hpp>
|
||||
#include "color_schemes.hpp"
|
||||
#include "events_operation.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include <set>
|
||||
|
||||
namespace nana
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
struct bedrock::pi_data
|
||||
{
|
||||
color_schemes scheme;
|
||||
events_operation evt_operation;
|
||||
window_manager wd_manager;
|
||||
std::set<core_window_t*> auto_form_set;
|
||||
bool shortkey_occurred{ false };
|
||||
|
||||
struct menu_rep
|
||||
{
|
||||
core_window_t* taken_window{ nullptr };
|
||||
bool delay_restore{ false };
|
||||
native_window_type window{ nullptr };
|
||||
native_window_type owner{ nullptr };
|
||||
bool has_keyboard{ false };
|
||||
}menu;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#include <nana/pop_ignore_diagnostic>
|
||||
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Window Manager Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -83,12 +83,6 @@ namespace detail
|
||||
|
||||
core_window_t* create_root(core_window_t*, bool nested, rectangle, const appearance&, widget*);
|
||||
core_window_t* create_widget(core_window_t*, const rectangle&, bool is_lite, widget*);
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
core_window_t* create_frame(core_window_t*, const rectangle&, widget*);
|
||||
|
||||
bool insert_frame(core_window_t* frame, native_window);
|
||||
bool insert_frame(core_window_t* frame, core_window_t*);
|
||||
#endif
|
||||
void close(core_window_t*);
|
||||
|
||||
//destroy
|
||||
@ -122,6 +116,7 @@ namespace detail
|
||||
void refresh_tree(core_window_t*);
|
||||
|
||||
void do_lazy_refresh(core_window_t*, bool force_copy_to_screen, bool refresh_tree = false);
|
||||
void map_requester(core_window_t*);
|
||||
|
||||
bool get_graphics(core_window_t*, nana::paint::graphics&);
|
||||
bool get_visual_rectangle(core_window_t*, nana::rectangle&);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Nana GUI Programming Interface Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -95,9 +95,7 @@ namespace API
|
||||
window create_window(window, bool nested, const rectangle&, const appearance&, widget* attached);
|
||||
window create_widget(window, const rectangle&, widget* attached);
|
||||
window create_lite_widget(window, const rectangle&, widget* attached);
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
window create_frame(window, const rectangle&, widget* attached);
|
||||
#endif
|
||||
|
||||
paint::graphics* window_graphics(window);
|
||||
|
||||
void delay_restore(bool);
|
||||
@ -234,11 +232,6 @@ namespace API
|
||||
void fullscreen(window, bool);
|
||||
bool enabled_double_click(window, bool);
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
bool insert_frame(window frame, native_window_type);
|
||||
native_window_type frame_container(window frame);
|
||||
native_window_type frame_element(window frame, unsigned index);
|
||||
#endif
|
||||
void close_window(window);
|
||||
void show_window(window, bool show); ///< Sets a window visible state.
|
||||
void restore_window(window);
|
||||
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* A Frame Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2015 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/widgets/frame.hpp
|
||||
*
|
||||
* @brief A frame provides a way to contain the platform window in a stdex GUI Window
|
||||
*/
|
||||
|
||||
#ifndef NANA_GUI_WIDGET_FRAME_HPP
|
||||
#define NANA_GUI_WIDGET_FRAME_HPP
|
||||
|
||||
#include "widget.hpp"
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
namespace nana
|
||||
{
|
||||
/**
|
||||
\brief Container for system native windows. Provides an approach to
|
||||
display a control that is not written with Nana.GUI in a Nana.GUI window.
|
||||
|
||||
Notes:
|
||||
|
||||
1. nana::native_window_type is a type of system handle of windows.
|
||||
2. all the children windows of a nana::frame is topmost to Nana.GUI windows.
|
||||
3. a simple example. Displaying a Windows Edit Control.
|
||||
|
||||
nana::frame frame(parent, 0, 0 200, 100);
|
||||
HWND frame_handle = reinterpret_cast<HWND>(frame.container());
|
||||
HWND edit = ::CreateWindowExW(WS_EX_CLIENTEDGE, L"EDIT", L"Test",
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER, 0, 0, 200, 100,
|
||||
frame_handle, 0, ::GetModuleHandle(0), 0);
|
||||
if(edit)
|
||||
frame.insert(edit);
|
||||
|
||||
*/
|
||||
class frame: public widget_object<category::frame_tag, int, nana::general_events>
|
||||
{
|
||||
typedef widget_object<category::frame_tag, int> base_type;
|
||||
public:
|
||||
frame();
|
||||
frame(window, bool visible);
|
||||
frame(window, const rectangle& = rectangle(), bool visible = true);
|
||||
bool insert(native_window_type); ///< Inserts a platform native window.
|
||||
native_window_type element(unsigned index); ///< Returns the child window through index.
|
||||
|
||||
native_window_type container() const; ///< Returns the frame container native window handle.
|
||||
};
|
||||
}//end namespace nana
|
||||
#endif
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* The fundamental widget class implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -499,72 +499,6 @@ namespace nana
|
||||
std::unique_ptr<scheme_type> scheme_;
|
||||
};//end class widget_object<root_tag>
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
/// Base class of all the classes defined as a frame window. \see nana::frame
|
||||
template<typename Drawer, typename Events, typename Scheme>
|
||||
class widget_object<category::frame_tag, Drawer, Events, Scheme>: public widget{};
|
||||
|
||||
/// Especialization. Base class of all the classes defined as a frame window. \see nana::frame
|
||||
template<typename Events, typename Scheme>
|
||||
class widget_object<category::frame_tag, int, Events, Scheme>: public detail::widget_base
|
||||
{
|
||||
protected:
|
||||
typedef int drawer_trigger_t;
|
||||
public:
|
||||
using scheme_type = Scheme;
|
||||
using event_type = Events;
|
||||
|
||||
widget_object()
|
||||
: events_{ std::make_shared<Events>() }, scheme_{ API::dev::make_scheme<scheme_type>() }
|
||||
{}
|
||||
|
||||
~widget_object()
|
||||
{
|
||||
API::close_window(handle());
|
||||
}
|
||||
|
||||
event_type& events() const
|
||||
{
|
||||
return *events_;
|
||||
}
|
||||
|
||||
bool create(window parent_wd, bool visible) ///< Creates a no-size (zero-size) widget. in a widget/root window specified by parent_wd.
|
||||
{
|
||||
return create(parent_wd, rectangle(), visible);
|
||||
}
|
||||
/// Creates in a widget/root window specified by parent_wd.
|
||||
bool create(window parent_wd, const rectangle& r = rectangle(), bool visible = true)
|
||||
{
|
||||
if(parent_wd && this->empty())
|
||||
{
|
||||
handle_ = API::dev::create_frame(parent_wd, r, this);
|
||||
API::dev::set_events(handle_, events_);
|
||||
API::dev::set_scheme(handle_, scheme_.get());
|
||||
API::show_window(handle_, visible);
|
||||
this->_m_complete_creation();
|
||||
}
|
||||
return (this->empty() == false);
|
||||
}
|
||||
|
||||
scheme_type& scheme() const
|
||||
{
|
||||
return *scheme_;
|
||||
}
|
||||
private:
|
||||
virtual drawer_trigger* get_drawer_trigger()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
general_events& _m_get_general_events() const override
|
||||
{
|
||||
return *events_;
|
||||
}
|
||||
private:
|
||||
std::shared_ptr<Events> events_;
|
||||
std::unique_ptr<scheme_type> scheme_;
|
||||
};//end class widget_object<category::frame_tag>
|
||||
#endif
|
||||
}//end namespace nana
|
||||
|
||||
#include <nana/pop_ignore_diagnostic>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A Basic Window Widget Definition
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -216,40 +216,14 @@ namespace nana
|
||||
basic_window::other_tag::other_tag(category::flags categ)
|
||||
: category(categ), active_window(nullptr), upd_state(update_state::none)
|
||||
{
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
switch(categ)
|
||||
{
|
||||
case category::flags::root:
|
||||
attribute.root = new attr_root_tag;
|
||||
break;
|
||||
case category::flags::frame:
|
||||
attribute.frame = new attr_frame_tag;
|
||||
break;
|
||||
default:
|
||||
attribute.root = nullptr;
|
||||
}
|
||||
#else
|
||||
if (category::flags::root == categ)
|
||||
attribute.root = new attr_root_tag;
|
||||
else
|
||||
attribute.root = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
basic_window::other_tag::~other_tag()
|
||||
{
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
switch(category)
|
||||
{
|
||||
case category::flags::root:
|
||||
delete attribute.root;
|
||||
break;
|
||||
case category::flags::frame:
|
||||
delete attribute.frame;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
#endif
|
||||
if (category::flags::root == category)
|
||||
delete attribute.root;
|
||||
}
|
||||
@ -290,14 +264,6 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
void basic_window::frame_window(native_window_type wd)
|
||||
{
|
||||
if(category::flags::frame == this->other.category)
|
||||
other.attribute.frame->container = wd;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool basic_window::is_ancestor_of(const basic_window* wd) const
|
||||
{
|
||||
while (wd)
|
||||
@ -424,6 +390,7 @@ namespace nana
|
||||
flags.ignore_menubar_focus = false;
|
||||
flags.ignore_mouse_focus = false;
|
||||
flags.space_click_enabled = false;
|
||||
flags.ignore_child_mapping = false;
|
||||
|
||||
visible = false;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A Bedrock Platform-Independent Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "../../detail/platform_spec_selector.hpp"
|
||||
#include <nana/gui/detail/bedrock_pi_data.hpp>
|
||||
#include "bedrock_types.hpp"
|
||||
#include <nana/gui/detail/event_code.hpp>
|
||||
#include <nana/system/platform.hpp>
|
||||
#include <sstream>
|
||||
@ -94,6 +94,12 @@ namespace nana
|
||||
|
||||
};
|
||||
|
||||
bedrock::core_window_t* bedrock::focus()
|
||||
{
|
||||
auto wd = wd_manager().root(native_interface::get_focus_window());
|
||||
return (wd ? wd->other.attribute.root->focus : nullptr);
|
||||
}
|
||||
|
||||
events_operation& bedrock::evt_operation()
|
||||
{
|
||||
return pi_data_->evt_operation;
|
||||
@ -164,17 +170,10 @@ namespace nana
|
||||
caret_wd->annex.caret_ptr->visible(false);
|
||||
}
|
||||
|
||||
if (!exposed)
|
||||
if ((!exposed) && (category::flags::root != wd->other.category))
|
||||
{
|
||||
if (category::flags::root != wd->other.category)
|
||||
{
|
||||
//find an ancestor until it is not a lite_widget
|
||||
wd = wd->seek_non_lite_widget_ancestor();
|
||||
}
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
else if (category::flags::frame == wd->other.category)
|
||||
wd = wd_manager().find_window(wd->root, wd->pos_root.x, wd->pos_root.y);
|
||||
#endif
|
||||
//find an ancestor until it is not a lite_widget
|
||||
wd = wd->seek_non_lite_widget_ancestor();
|
||||
}
|
||||
|
||||
wd_manager().refresh_tree(wd);
|
||||
@ -609,5 +608,93 @@ namespace nana
|
||||
throw std::runtime_error("Invalid event code");
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::thread_context_destroy(core_window_t * wd)
|
||||
{
|
||||
auto ctx = get_thread_context(0);
|
||||
if(ctx && ctx->event_window == wd)
|
||||
ctx->event_window = nullptr;
|
||||
}
|
||||
|
||||
void bedrock::thread_context_lazy_refresh()
|
||||
{
|
||||
auto ctx = get_thread_context(0);
|
||||
if(ctx && ctx->event_window)
|
||||
ctx->event_window->other.upd_state = core_window_t::update_state::refreshed;
|
||||
}
|
||||
|
||||
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd, const bool bForce__EmitInternal)
|
||||
{
|
||||
if(wd_manager().available(wd) == false)
|
||||
return false;
|
||||
|
||||
core_window_t * prev_wd = nullptr;
|
||||
if(thrd)
|
||||
{
|
||||
prev_wd = thrd->event_window;
|
||||
thrd->event_window = wd;
|
||||
_m_event_filter(evt_code, wd, thrd);
|
||||
}
|
||||
|
||||
using update_state = basic_window::update_state;
|
||||
|
||||
if (update_state::none == wd->other.upd_state)
|
||||
wd->other.upd_state = update_state::lazy;
|
||||
|
||||
auto ignore_mapping_value = wd->flags.ignore_child_mapping;
|
||||
wd->flags.ignore_child_mapping = true;
|
||||
|
||||
_m_emit_core(evt_code, wd, false, arg, bForce__EmitInternal);
|
||||
|
||||
wd->flags.ignore_child_mapping = ignore_mapping_value;
|
||||
|
||||
bool good_wd = false;
|
||||
if(wd_manager().available(wd))
|
||||
{
|
||||
//A child of wd may not be drawn if it was out of wd's range before wd resized,
|
||||
//so refresh all children of wd when a resized occurs.
|
||||
if(ask_update || (event_code::resized == evt_code) || (update_state::refreshed == wd->other.upd_state))
|
||||
{
|
||||
wd_manager().do_lazy_refresh(wd, false, (event_code::resized == evt_code));
|
||||
}
|
||||
else
|
||||
{
|
||||
wd_manager().map_requester(wd);
|
||||
wd->other.upd_state = update_state::none;
|
||||
}
|
||||
|
||||
good_wd = true;
|
||||
}
|
||||
|
||||
|
||||
if(thrd) thrd->event_window = prev_wd;
|
||||
return good_wd;
|
||||
}
|
||||
|
||||
void bedrock::_m_event_filter(event_code event_id, core_window_t * wd, thread_context * thrd)
|
||||
{
|
||||
auto not_state_cur = (wd->root_widget->other.attribute.root->state_cursor == nana::cursor::arrow);
|
||||
|
||||
switch(event_id)
|
||||
{
|
||||
case event_code::mouse_enter:
|
||||
if (not_state_cur)
|
||||
set_cursor(wd, wd->predef_cursor, thrd);
|
||||
break;
|
||||
case event_code::mouse_leave:
|
||||
if (not_state_cur && (wd->predef_cursor != cursor::arrow))
|
||||
set_cursor(wd, nana::cursor::arrow, thrd);
|
||||
break;
|
||||
case event_code::destroy:
|
||||
if (wd->root_widget->other.attribute.root->state_cursor_window == wd)
|
||||
undefine_state_cursor(wd, thrd);
|
||||
|
||||
if(wd == thrd->cursor.window)
|
||||
set_cursor(wd, cursor::arrow, thrd);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}//end namespace detail
|
||||
}//end namespace nana
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A Bedrock Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -12,7 +12,6 @@
|
||||
|
||||
#include "../../detail/platform_spec_selector.hpp"
|
||||
#if defined(NANA_POSIX) && defined(NANA_X11)
|
||||
#include <nana/gui/detail/bedrock_pi_data.hpp>
|
||||
#include <nana/gui/detail/event_code.hpp>
|
||||
#include <nana/system/platform.hpp>
|
||||
#include <nana/gui/detail/native_window_interface.hpp>
|
||||
@ -22,6 +21,8 @@
|
||||
#include <errno.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "bedrock_types.hpp"
|
||||
|
||||
namespace nana
|
||||
{
|
||||
namespace detail
|
||||
@ -52,6 +53,7 @@ namespace detail
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
#if 0 //deprecated
|
||||
struct bedrock::thread_context
|
||||
{
|
||||
unsigned event_pump_ref_count{0};
|
||||
@ -83,6 +85,7 @@ namespace detail
|
||||
cursor.handle = 0;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
struct bedrock::private_impl
|
||||
{
|
||||
@ -247,11 +250,13 @@ namespace detail
|
||||
return bedrock_object;
|
||||
}
|
||||
|
||||
#if 0 //deprecated
|
||||
bedrock::core_window_t* bedrock::focus()
|
||||
{
|
||||
core_window_t* wd = wd_manager().root(native_interface::get_focus_window());
|
||||
return (wd ? wd->other.attribute.root->focus : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void bedrock::get_key_state(arg_keyboard& arg)
|
||||
{
|
||||
@ -289,6 +294,7 @@ namespace detail
|
||||
//No implementation for Linux
|
||||
}
|
||||
|
||||
#if 0 //deprecated
|
||||
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd, const bool bForce__EmitInternal)
|
||||
{
|
||||
if(wd_manager().available(wd) == false)
|
||||
@ -304,11 +310,16 @@ namespace detail
|
||||
|
||||
using update_state = basic_window::update_state;
|
||||
|
||||
if(wd->other.upd_state == update_state::none)
|
||||
if (update_state::none == wd->other.upd_state)
|
||||
wd->other.upd_state = update_state::lazy;
|
||||
|
||||
auto ignore_mapping_value = wd->flags.ignore_child_mapping;
|
||||
wd->flags.ignore_child_mapping = true;
|
||||
|
||||
_m_emit_core(evt_code, wd, false, arg, bForce__EmitInternal);
|
||||
|
||||
wd->flags.ignore_child_mapping = ignore_mapping_value;
|
||||
|
||||
bool good_wd = false;
|
||||
if(wd_manager().available(wd))
|
||||
{
|
||||
@ -319,7 +330,10 @@ namespace detail
|
||||
wd_manager().do_lazy_refresh(wd, false, (event_code::resized == evt_code));
|
||||
}
|
||||
else
|
||||
{
|
||||
wd_manager().map_requester(wd);
|
||||
wd->other.upd_state = update_state::none;
|
||||
}
|
||||
|
||||
good_wd = true;
|
||||
}
|
||||
@ -328,6 +342,7 @@ namespace detail
|
||||
if(thrd) thrd->event_window = prev_wd;
|
||||
return good_wd;
|
||||
}
|
||||
#endif
|
||||
|
||||
void assign_arg(arg_mouse& arg, basic_window* wd, unsigned msg, const XEvent& evt)
|
||||
{
|
||||
@ -1346,6 +1361,7 @@ namespace detail
|
||||
|
||||
}//end bedrock::event_loop
|
||||
|
||||
#if 0 //deprecated
|
||||
void bedrock::thread_context_destroy(core_window_t * wd)
|
||||
{
|
||||
bedrock::thread_context * thr = get_thread_context(0);
|
||||
@ -1359,6 +1375,7 @@ namespace detail
|
||||
if(thrd && thrd->event_window)
|
||||
thrd->event_window->other.upd_state = core_window_t::update_state::refreshed;
|
||||
}
|
||||
#endif
|
||||
|
||||
//Dynamically set a cursor for a window
|
||||
void bedrock::set_cursor(core_window_t* wd, nana::cursor cur, thread_context* thrd)
|
||||
@ -1430,6 +1447,7 @@ namespace detail
|
||||
set_cursor(rev_wd, rev_wd->predef_cursor, thrd);
|
||||
}
|
||||
|
||||
#if 0 //deprecated
|
||||
void bedrock::_m_event_filter(event_code event_id, core_window_t * wd, thread_context * thrd)
|
||||
{
|
||||
auto not_state_cur = (wd->root_widget->other.attribute.root->state_cursor == nana::cursor::arrow);
|
||||
@ -1455,6 +1473,7 @@ namespace detail
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}//end namespace detail
|
||||
}//end namespace nana
|
||||
#endif //NANA_POSIX && NANA_X11
|
||||
|
101
source/gui/detail/bedrock_types.hpp
Normal file
101
source/gui/detail/bedrock_types.hpp
Normal file
@ -0,0 +1,101 @@
|
||||
#ifndef NANA_GUI_DETAIL_BEDROCK_TYPES_INCLUDED
|
||||
#define NANA_GUI_DETAIL_BEDROCK_TYPES_INCLUDED
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
|
||||
#include <nana/gui/detail/bedrock.hpp>
|
||||
#include <nana/gui/detail/color_schemes.hpp>
|
||||
#include <nana/gui/detail/events_operation.hpp>
|
||||
#include <nana/gui/detail/window_manager.hpp>
|
||||
#include <set>
|
||||
|
||||
namespace nana
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
struct bedrock::pi_data
|
||||
{
|
||||
color_schemes scheme;
|
||||
events_operation evt_operation;
|
||||
window_manager wd_manager;
|
||||
std::set<core_window_t*> auto_form_set;
|
||||
bool shortkey_occurred{ false };
|
||||
|
||||
struct menu_rep
|
||||
{
|
||||
core_window_t* taken_window{ nullptr };
|
||||
bool delay_restore{ false };
|
||||
native_window_type window{ nullptr };
|
||||
native_window_type owner{ nullptr };
|
||||
bool has_keyboard{ false };
|
||||
}menu;
|
||||
};
|
||||
|
||||
|
||||
#ifdef NANA_WINDOWS
|
||||
struct bedrock::thread_context
|
||||
{
|
||||
unsigned event_pump_ref_count{0};
|
||||
int window_count{0}; //The number of windows
|
||||
core_window_t* event_window{nullptr};
|
||||
|
||||
struct platform_detail_tag
|
||||
{
|
||||
wchar_t keychar;
|
||||
}platform;
|
||||
|
||||
struct cursor_tag
|
||||
{
|
||||
core_window_t * window;
|
||||
native_window_type native_handle;
|
||||
nana::cursor predef_cursor;
|
||||
HCURSOR handle;
|
||||
}cursor;
|
||||
|
||||
thread_context()
|
||||
{
|
||||
cursor.window = nullptr;
|
||||
cursor.native_handle = nullptr;
|
||||
cursor.predef_cursor = nana::cursor::arrow;
|
||||
cursor.handle = nullptr;
|
||||
}
|
||||
};
|
||||
#else
|
||||
struct bedrock::thread_context
|
||||
{
|
||||
unsigned event_pump_ref_count{0};
|
||||
|
||||
int window_count{0}; //The number of windows
|
||||
core_window_t* event_window{nullptr};
|
||||
bool is_alt_pressed{false};
|
||||
bool is_ctrl_pressed{false};
|
||||
|
||||
struct platform_detail_tag
|
||||
{
|
||||
native_window_type motion_window;
|
||||
nana::point motion_pointer_pos;
|
||||
}platform;
|
||||
|
||||
struct cursor_tag
|
||||
{
|
||||
core_window_t * window;
|
||||
native_window_type native_handle;
|
||||
nana::cursor predef_cursor;
|
||||
Cursor handle;
|
||||
}cursor;
|
||||
|
||||
thread_context()
|
||||
{
|
||||
cursor.window = nullptr;
|
||||
cursor.native_handle = nullptr;
|
||||
cursor.predef_cursor = nana::cursor::arrow;
|
||||
cursor.handle = 0;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#include <nana/pop_ignore_diagnostic>
|
||||
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* A Bedrock Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -14,8 +14,8 @@
|
||||
|
||||
#include "../../detail/platform_spec_selector.hpp"
|
||||
#if defined(NANA_WINDOWS)
|
||||
#include <nana/gui/detail/bedrock.hpp>
|
||||
#include <nana/gui/detail/bedrock_pi_data.hpp>
|
||||
//#include <nana/gui/detail/bedrock.hpp> //deprecated
|
||||
#include "bedrock_types.hpp"
|
||||
#include <nana/gui/detail/event_code.hpp>
|
||||
#include <nana/system/platform.hpp>
|
||||
#include <nana/system/timepiece.hpp>
|
||||
@ -36,6 +36,8 @@
|
||||
#define WM_MOUSEHWHEEL 0x020E
|
||||
#endif
|
||||
|
||||
#include "bedrock_types.hpp"
|
||||
|
||||
typedef void (CALLBACK *win_event_proc_t)(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime);
|
||||
|
||||
namespace nana
|
||||
@ -135,6 +137,7 @@ namespace detail
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
#if 0 //deprecated
|
||||
struct bedrock::thread_context
|
||||
{
|
||||
unsigned event_pump_ref_count{0};
|
||||
@ -162,6 +165,7 @@ namespace detail
|
||||
cursor.handle = nullptr;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
struct bedrock::private_impl
|
||||
{
|
||||
@ -1594,11 +1598,13 @@ namespace detail
|
||||
return ::DefWindowProc(root_window, message, wParam, lParam);
|
||||
}
|
||||
|
||||
#if 0 //deprecated
|
||||
auto bedrock::focus() ->core_window_t*
|
||||
{
|
||||
core_window_t* wd = wd_manager().root(native_interface::get_focus_window());
|
||||
return (wd ? wd->other.attribute.root->focus : nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
void bedrock::get_key_state(arg_keyboard& kb)
|
||||
{
|
||||
@ -1677,6 +1683,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 //deprecated
|
||||
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd, const bool bForce__EmitInternal)
|
||||
{
|
||||
if (wd_manager().available(wd) == false)
|
||||
@ -1695,16 +1702,27 @@ namespace detail
|
||||
if (update_state::none == wd->other.upd_state)
|
||||
wd->other.upd_state = update_state::lazy;
|
||||
|
||||
auto ignore_mapping_value = wd->flags.ignore_child_mapping;
|
||||
wd->flags.ignore_child_mapping = true;
|
||||
|
||||
_m_emit_core(evt_code, wd, false, arg, bForce__EmitInternal);
|
||||
|
||||
wd->flags.ignore_child_mapping = ignore_mapping_value;
|
||||
|
||||
bool good_wd = false;
|
||||
if (wd_manager().available(wd))
|
||||
{
|
||||
//Ignore ask_update if update state is refreshed.
|
||||
if (ask_update || (update_state::refreshed == wd->other.upd_state))
|
||||
wd_manager().do_lazy_refresh(wd, false);
|
||||
//A child of wd may not be drawn if it was out of wd's range before wd resized,
|
||||
//so refresh all children of wd when a resized occurs.
|
||||
if(ask_update || (event_code::resized == evt_code) || (update_state::refreshed == wd->other.upd_state))
|
||||
{
|
||||
wd_manager().do_lazy_refresh(wd, false, (event_code::resized == evt_code));
|
||||
}
|
||||
else
|
||||
{
|
||||
wd_manager().map_requester(wd);
|
||||
wd->other.upd_state = update_state::none;
|
||||
}
|
||||
|
||||
good_wd = true;
|
||||
}
|
||||
@ -1712,6 +1730,7 @@ namespace detail
|
||||
if (thrd) thrd->event_window = prev_event_wd;
|
||||
return good_wd;
|
||||
}
|
||||
#endif
|
||||
|
||||
const wchar_t* translate(cursor id)
|
||||
{
|
||||
@ -1740,7 +1759,7 @@ namespace detail
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
#if 0 //deprecated
|
||||
void bedrock::thread_context_destroy(core_window_t * wd)
|
||||
{
|
||||
auto * thr = get_thread_context(0);
|
||||
@ -1754,7 +1773,7 @@ namespace detail
|
||||
if (thrd && thrd->event_window)
|
||||
thrd->event_window->other.upd_state = core_window_t::update_state::refreshed;
|
||||
}
|
||||
|
||||
#endif
|
||||
//Dynamically set a cursor for a window
|
||||
void bedrock::set_cursor(core_window_t* wd, nana::cursor cur, thread_context* thrd)
|
||||
{
|
||||
@ -1847,7 +1866,7 @@ namespace detail
|
||||
::ShowCursor(FALSE);
|
||||
::SetCursor(rev_handle);
|
||||
}
|
||||
|
||||
#if 0 //deprecated
|
||||
void bedrock::_m_event_filter(event_code event_id, core_window_t * wd, thread_context * thrd)
|
||||
{
|
||||
auto not_state_cur = (wd->root_widget->other.attribute.root->state_cursor == nana::cursor::arrow);
|
||||
@ -1873,6 +1892,7 @@ namespace detail
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}//end namespace detail
|
||||
}//end namespace nana
|
||||
#endif //NANA_WINDOWS
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Window Layout Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -66,20 +66,9 @@ namespace nana
|
||||
nana::point p_src;
|
||||
for (auto & el : blocks)
|
||||
{
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
if (category::flags::frame == el.window->other.category)
|
||||
{
|
||||
native_window_type container = el.window->other.attribute.frame->container;
|
||||
native_interface::refresh_window(container);
|
||||
graph.bitblt(el.r, container);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
p_src.x = el.r.x - el.window->pos_root.x;
|
||||
p_src.y = el.r.y - el.window->pos_root.y;
|
||||
graph.bitblt(el.r, (el.window->drawer.graphics), p_src);
|
||||
}
|
||||
p_src.x = el.r.x - el.window->pos_root.x;
|
||||
p_src.y = el.r.y - el.window->pos_root.y;
|
||||
graph.bitblt(el.r, (el.window->drawer.graphics), p_src);
|
||||
|
||||
_m_paste_children(el.window, false, req_refresh_children, el.r, graph, nana::point{});
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Window Manager Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -513,12 +513,7 @@ namespace detail
|
||||
if (owner->flags.destroying)
|
||||
throw std::runtime_error("the specified owner is destoryed");
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
native = (category::flags::frame == owner->other.category ?
|
||||
owner->other.attribute.frame->container : owner->root_widget->root);
|
||||
#else
|
||||
native = owner->root_widget->root;
|
||||
#endif
|
||||
r.x += owner->pos_root.x;
|
||||
r.y += owner->pos_root.y;
|
||||
}
|
||||
@ -550,11 +545,6 @@ namespace detail
|
||||
wd->bind_native_window(result.native_handle, result.width, result.height, result.extra_width, result.extra_height, value->root_graph);
|
||||
impl_->wd_register.insert(wd);
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
if (owner && (category::flags::frame == owner->other.category))
|
||||
insert_frame(owner, wd);
|
||||
#endif
|
||||
|
||||
bedrock::inc_window(wd->thread_id);
|
||||
this->icon(wd, impl_->default_icon_small, impl_->default_icon_big);
|
||||
return wd;
|
||||
@ -562,56 +552,6 @@ namespace detail
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
window_manager::core_window_t* window_manager::create_frame(core_window_t* parent, const rectangle& r, widget* wdg)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
|
||||
if (impl_->wd_register.available(parent) == false) return nullptr;
|
||||
|
||||
core_window_t * wd = new core_window_t(parent, widget_notifier_interface::get_notifier(wdg), r, (category::frame_tag**)nullptr);
|
||||
wd->frame_window(native_interface::create_child_window(parent->root, rectangle(wd->pos_root.x, wd->pos_root.y, r.width, r.height)));
|
||||
impl_->wd_register.insert(wd, wd->thread_id);
|
||||
|
||||
//Insert the frame_widget into its root frames container.
|
||||
wd->root_widget->other.attribute.root->frames.push_back(wd);
|
||||
return (wd);
|
||||
}
|
||||
|
||||
|
||||
bool window_manager::insert_frame(core_window_t* frame, native_window wd)
|
||||
{
|
||||
if(frame)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
if(category::flags::frame == frame->other.category)
|
||||
frame->other.attribute.frame->attach.push_back(wd);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool window_manager::insert_frame(core_window_t* frame, core_window_t* wd)
|
||||
{
|
||||
if(frame)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
if(category::flags::frame == frame->other.category)
|
||||
{
|
||||
if (impl_->wd_register.available(wd) && (category::flags::root == wd->other.category) && wd->root != frame->root)
|
||||
{
|
||||
frame->other.attribute.frame->attach.push_back(wd->root);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
window_manager::core_window_t* window_manager::create_widget(core_window_t* parent, const rectangle& r, bool is_lite, widget* wdg)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
@ -706,11 +646,7 @@ namespace detail
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
if (impl_->wd_register.available(wd) == false) return;
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
if((category::flags::root == wd->other.category) || (category::flags::frame != wd->other.category))
|
||||
#else
|
||||
if (category::flags::root == wd->other.category)
|
||||
#endif
|
||||
{
|
||||
impl_->misc_register.erase(wd->root);
|
||||
impl_->wd_register.remove(wd);
|
||||
@ -749,20 +685,7 @@ namespace detail
|
||||
|
||||
if(visible != wd->visible)
|
||||
{
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
native_window_type nv = nullptr;
|
||||
switch(wd->other.category)
|
||||
{
|
||||
case category::flags::root:
|
||||
nv = wd->root; break;
|
||||
case category::flags::frame:
|
||||
nv = wd->other.attribute.frame->container; break;
|
||||
default: //category::widget_tag, category::lite_widget_tag
|
||||
break;
|
||||
}
|
||||
#else
|
||||
auto nv = (category::flags::root == wd->other.category ? wd->root : nullptr);
|
||||
#endif
|
||||
|
||||
if(visible && wd->effect.bground)
|
||||
window_layer::make_bground(wd);
|
||||
@ -1012,22 +935,11 @@ namespace detail
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
else if(category::flags::frame == wd->other.category)
|
||||
{
|
||||
native_interface::window_size(wd->other.attribute.frame->container, sz);
|
||||
for(auto natwd : wd->other.attribute.frame->attach)
|
||||
native_interface::window_size(natwd, sz);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
else if(wd->effect.bground && wd->parent)
|
||||
{
|
||||
//update the bground buffer of glass window.
|
||||
if(wd->effect.bground && wd->parent)
|
||||
{
|
||||
wd->other.glass_buffer.make(sz);
|
||||
window_layer::make_bground(wd);
|
||||
}
|
||||
wd->other.glass_buffer.make(sz);
|
||||
window_layer::make_bground(wd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1072,8 +984,19 @@ namespace detail
|
||||
auto parent = wd->parent;
|
||||
while (parent)
|
||||
{
|
||||
if (parent->flags.refreshing)
|
||||
if(parent->flags.ignore_child_mapping || parent->flags.refreshing)
|
||||
{
|
||||
auto top = parent;
|
||||
while(parent->parent)
|
||||
{
|
||||
parent = parent->parent;
|
||||
if(parent->flags.ignore_child_mapping || parent->flags.refreshing)
|
||||
top = parent;
|
||||
}
|
||||
|
||||
top->other.mapping_requester.push_back(wd);
|
||||
return;
|
||||
}
|
||||
parent = parent->parent;
|
||||
}
|
||||
|
||||
@ -1168,7 +1091,24 @@ namespace detail
|
||||
window_layer::paint(wd, paint_operation::try_refresh, refresh_tree); //only refreshing if it has an invisible parent
|
||||
}
|
||||
wd->other.upd_state = core_window_t::update_state::none;
|
||||
return;
|
||||
wd->other.mapping_requester.clear();
|
||||
}
|
||||
|
||||
void window_manager::map_requester(core_window_t* wd)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
|
||||
if (false == impl_->wd_register.available(wd))
|
||||
return;
|
||||
|
||||
if (wd->visible_parents())
|
||||
{
|
||||
for(auto requestor : wd->other.mapping_requester)
|
||||
this->map(requestor, true);
|
||||
}
|
||||
|
||||
wd->other.mapping_requester.clear();
|
||||
}
|
||||
|
||||
//get_graphics
|
||||
@ -1758,17 +1698,6 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
if (category::flags::frame == wd->other.category)
|
||||
{
|
||||
//remove the frame handle from the WM frames manager.
|
||||
utl::erase(root_attr->frames, wd);
|
||||
|
||||
if (established)
|
||||
pa_root_attr->frames.push_back(wd);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (established)
|
||||
{
|
||||
wd->parent = for_new;
|
||||
@ -1857,18 +1786,6 @@ namespace detail
|
||||
wd->drawer.detached();
|
||||
wd->widget_notifier->destroy();
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
if(category::flags::frame == wd->other.category)
|
||||
{
|
||||
//The frame widget does not have an owner, and close their element windows without activating owner.
|
||||
//close the frame container window, it's a native window.
|
||||
for(auto i : wd->other.attribute.frame->attach)
|
||||
native_interface::close_window(i);
|
||||
|
||||
native_interface::close_window(wd->other.attribute.frame->container);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(wd->other.category != category::flags::root) //Not a root window
|
||||
impl_->wd_register.remove(wd);
|
||||
|
||||
@ -1881,18 +1798,9 @@ namespace detail
|
||||
if(category::flags::root != wd->other.category) //A root widget always starts at (0, 0) and its childs are not to be changed
|
||||
{
|
||||
wd->pos_root += delta;
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
if (category::flags::frame != wd->other.category)
|
||||
{
|
||||
if (wd->annex.caret_ptr && wd->annex.caret_ptr->visible())
|
||||
wd->annex.caret_ptr->update();
|
||||
}
|
||||
else
|
||||
native_interface::move_window(wd->other.attribute.frame->container, wd->pos_root.x, wd->pos_root.y);
|
||||
#else
|
||||
|
||||
if (wd->annex.caret_ptr && wd->annex.caret_ptr->visible())
|
||||
wd->annex.caret_ptr->update();
|
||||
#endif
|
||||
|
||||
if (wd->displayed() && wd->effect.bground)
|
||||
window_layer::make_bground(wd);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Nana GUI Programming Interface Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -303,13 +303,6 @@ namespace API
|
||||
return reinterpret_cast<window>(restrict::wd_manager().create_widget(reinterpret_cast<basic_window*>(parent), r, true, wdg));
|
||||
}
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
window create_frame(window parent, const rectangle& r, widget* wdg)
|
||||
{
|
||||
return reinterpret_cast<window>(restrict::wd_manager().create_frame(reinterpret_cast<basic_window*>(parent), r, wdg));
|
||||
}
|
||||
#endif
|
||||
|
||||
paint::graphics* window_graphics(window wd)
|
||||
{
|
||||
internal_scope_guard isg;
|
||||
@ -600,34 +593,6 @@ namespace API
|
||||
reinterpret_cast<basic_window*>(wd)->flags.fullscreen = v;
|
||||
}
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
bool insert_frame(window frame, native_window_type native_window)
|
||||
{
|
||||
return restrict::wd_manager().insert_frame(reinterpret_cast<basic_window*>(frame), native_window);
|
||||
}
|
||||
|
||||
native_window_type frame_container(window frame)
|
||||
{
|
||||
auto frm = reinterpret_cast<basic_window*>(frame);
|
||||
internal_scope_guard lock;
|
||||
if (restrict::wd_manager().available(frm) && (frm->other.category == category::flags::frame))
|
||||
return frm->other.attribute.frame->container;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
native_window_type frame_element(window frame, unsigned index)
|
||||
{
|
||||
auto frm = reinterpret_cast<basic_window*>(frame);
|
||||
internal_scope_guard lock;
|
||||
if (restrict::wd_manager().available(frm) && (frm->other.category == category::flags::frame))
|
||||
{
|
||||
if (index < frm->other.attribute.frame->attach.size())
|
||||
return frm->other.attribute.frame->attach.at(index);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void close_window(window wd)
|
||||
{
|
||||
restrict::wd_manager().close(reinterpret_cast<basic_window*>(wd));
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* A Frame Implementation
|
||||
* Copyright(C) 2003-2013 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/widgets/frame.cpp
|
||||
*
|
||||
* A frame provides a way to contain the platform window in a stdex GUI Window
|
||||
*/
|
||||
|
||||
#include <nana/gui/widgets/frame.hpp>
|
||||
|
||||
#ifndef WIDGET_FRAME_DEPRECATED
|
||||
|
||||
namespace nana
|
||||
{
|
||||
//class frame:: public widget_object<category::frame_tag>
|
||||
frame::frame(){}
|
||||
|
||||
frame::frame(window wd, bool visible)
|
||||
{
|
||||
create(wd, rectangle(), visible);
|
||||
}
|
||||
|
||||
frame::frame(window wd, const nana::rectangle& r, bool visible)
|
||||
{
|
||||
create(wd, r, visible);
|
||||
}
|
||||
|
||||
bool frame::insert(native_window_type wd)
|
||||
{
|
||||
return API::insert_frame(handle(), wd);
|
||||
}
|
||||
|
||||
native_window_type frame::element(unsigned index)
|
||||
{
|
||||
return API::frame_element(handle(), index);
|
||||
}
|
||||
|
||||
native_window_type frame::container() const
|
||||
{
|
||||
return API::frame_container(handle());
|
||||
}
|
||||
//end class frame
|
||||
}//end namespace nana
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user