no message
This commit is contained in:
parent
eadae2021d
commit
dca8b90bc0
@ -130,13 +130,14 @@
|
|||||||
<ProjectGuid>{8D9A6595-717A-41C8-B468-0011A72BE3D1}</ProjectGuid>
|
<ProjectGuid>{8D9A6595-717A-41C8-B468-0011A72BE3D1}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>base</RootNamespace>
|
<RootNamespace>base</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
@ -149,7 +150,7 @@
|
|||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
@ -204,7 +205,7 @@
|
|||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;NOMINMAX;WITH_ENCRYPT;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;NOMINMAX;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<TreatWarningAsError>false</TreatWarningAsError>
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
<AdditionalIncludeDirectories>.\;..\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.\;..\</AdditionalIncludeDirectories>
|
||||||
<DisableSpecificWarnings>4100;4127;4244;4245;4310;4355;4505;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4100;4127;4244;4245;4310;4355;4505;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
@ -250,7 +251,7 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;NOMINMAX;WITH_ENCRYPT;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;NOMINMAX;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<TreatWarningAsError>false</TreatWarningAsError>
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
<AdditionalIncludeDirectories>.\;..\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.\;..\</AdditionalIncludeDirectories>
|
||||||
<DisableSpecificWarnings>4100;4127;4189;4244;4245;4310;4355;4505;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4100;4127;4189;4244;4245;4310;4355;4505;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
@ -70,7 +70,7 @@ private:
|
|||||||
|
|
||||||
// The lock that protects access to target_message_loop_.
|
// The lock that protects access to target_message_loop_.
|
||||||
mutable NLock message_loop_lock_;
|
mutable NLock message_loop_lock_;
|
||||||
MessageLoop* target_message_loop_;
|
nbase::MessageLoop* target_message_loop_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This relay class remembers the MessageLoop that it was created on, and
|
// This relay class remembers the MessageLoop that it was created on, and
|
||||||
|
@ -14,33 +14,32 @@
|
|||||||
|
|
||||||
namespace nbase
|
namespace nbase
|
||||||
{
|
{
|
||||||
|
static const wchar_t kWndClass[] = L"NeteaseMessagePumpWindow";
|
||||||
|
static const unsigned int kMsgHaveWork = WM_USER + 1;
|
||||||
|
static const int kUserTimerMinmum = 10;
|
||||||
|
|
||||||
static const wchar_t kWndClass[] = L"NeteaseMessagePumpWindow";
|
WinUIMessagePump::WinUIMessagePump()
|
||||||
static const unsigned int kMsgHaveWork = WM_USER + 1;
|
{
|
||||||
static const int kUserTimerMinmum = 10;
|
|
||||||
|
|
||||||
WinUIMessagePump::WinUIMessagePump()
|
|
||||||
{
|
|
||||||
InitMessageWnd();
|
InitMessageWnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
WinUIMessagePump::~WinUIMessagePump()
|
WinUIMessagePump::~WinUIMessagePump()
|
||||||
{
|
{
|
||||||
::DestroyWindow(message_hwnd_);
|
::DestroyWindow(message_hwnd_);
|
||||||
::UnregisterClassW(kWndClass, ::GetModuleHandle(NULL));
|
::UnregisterClassW(kWndClass, ::GetModuleHandle(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::ScheduleWork()
|
void WinUIMessagePump::ScheduleWork()
|
||||||
{
|
{
|
||||||
if (::InterlockedExchange(&have_work_, 1))
|
if (::InterlockedExchange(&have_work_, 1))
|
||||||
return; // Pump已经开始
|
return; // Pump已经开始
|
||||||
|
|
||||||
// 通知MessagePump有新任务到达,如果MessagePump处于睡眠状态,这将唤醒它
|
// 通知MessagePump有新任务到达,如果MessagePump处于睡眠状态,这将唤醒它
|
||||||
::PostMessageW(message_hwnd_, kMsgHaveWork, reinterpret_cast<WPARAM>(this), 0);
|
::PostMessageW(message_hwnd_, kMsgHaveWork, reinterpret_cast<WPARAM>(this), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::ScheduleDelayedWork(const TimeTicks& delayed_work_time)
|
void WinUIMessagePump::ScheduleDelayedWork(const TimeTicks& delayed_work_time)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// We would *like* to provide high resolution timers. Windows timers using
|
// We would *like* to provide high resolution timers. Windows timers using
|
||||||
// SetTimer() have a 10ms granularity. We have to use WM_TIMER as a wakeup
|
// SetTimer() have a 10ms granularity. We have to use WM_TIMER as a wakeup
|
||||||
@ -74,14 +73,13 @@ void WinUIMessagePump::ScheduleDelayedWork(const TimeTicks& delayed_work_time)
|
|||||||
else
|
else
|
||||||
wait_time = static_cast<DWORD>(delay_msec);
|
wait_time = static_cast<DWORD>(delay_msec);
|
||||||
|
|
||||||
|
|
||||||
// Create a WM_TIMER event that will wake us up to check for any pending
|
// Create a WM_TIMER event that will wake us up to check for any pending
|
||||||
// timers (in case we are running within a nested, external sub-pump).
|
// timers (in case we are running within a nested, external sub-pump).
|
||||||
::SetTimer(message_hwnd_, reinterpret_cast<UINT_PTR>(this), wait_time, NULL);
|
::SetTimer(message_hwnd_, reinterpret_cast<UINT_PTR>(this), wait_time, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::PumpOutPendingPaintMessages()
|
void WinUIMessagePump::PumpOutPendingPaintMessages()
|
||||||
{
|
{
|
||||||
// If we are being called outside of the context of Run, then don't try to do
|
// If we are being called outside of the context of Run, then don't try to do
|
||||||
// any work.
|
// any work.
|
||||||
if (!state_)
|
if (!state_)
|
||||||
@ -102,13 +100,13 @@ void WinUIMessagePump::PumpOutPendingPaintMessages()
|
|||||||
if (state_->should_quit) // Handle WM_QUIT.
|
if (state_->should_quit) // Handle WM_QUIT.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::InitMessageWnd()
|
void WinUIMessagePump::InitMessageWnd()
|
||||||
{
|
{
|
||||||
HINSTANCE hinst = ::GetModuleHandle(NULL);
|
HINSTANCE hinst = ::GetModuleHandle(NULL);
|
||||||
|
|
||||||
WNDCLASSEXW wc = {0};
|
WNDCLASSEXW wc = { 0 };
|
||||||
wc.cbSize = sizeof(wc);
|
wc.cbSize = sizeof(wc);
|
||||||
wc.lpfnWndProc = WndProcThunk;
|
wc.lpfnWndProc = WndProcThunk;
|
||||||
wc.hInstance = hinst;
|
wc.hInstance = hinst;
|
||||||
@ -116,10 +114,10 @@ void WinUIMessagePump::InitMessageWnd()
|
|||||||
::RegisterClassExW(&wc);
|
::RegisterClassExW(&wc);
|
||||||
|
|
||||||
message_hwnd_ = ::CreateWindowW(kWndClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0);
|
message_hwnd_ = ::CreateWindowW(kWndClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK WinUIMessagePump::WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
|
LRESULT CALLBACK WinUIMessagePump::WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case kMsgHaveWork:
|
case kMsgHaveWork:
|
||||||
@ -130,10 +128,10 @@ LRESULT CALLBACK WinUIMessagePump::WndProcThunk(HWND hwnd, UINT message, WPARAM
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ::DefWindowProcW(hwnd, message, wparam, lparam);
|
return ::DefWindowProcW(hwnd, message, wparam, lparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::DoRunLoop()
|
void WinUIMessagePump::DoRunLoop()
|
||||||
{
|
{
|
||||||
// IF this was just a simple ::PeekMessageW() loop (servicing all possible work
|
// IF this was just a simple ::PeekMessageW() loop (servicing all possible work
|
||||||
// queues), then Windows would try to achieve the following order according
|
// queues), then Windows would try to achieve the following order according
|
||||||
// to MSDN documentation about ::PeekMessageW with no filter):
|
// to MSDN documentation about ::PeekMessageW with no filter):
|
||||||
@ -188,10 +186,10 @@ void WinUIMessagePump::DoRunLoop()
|
|||||||
|
|
||||||
WaitForWork(); // Wait (sleep) until we have work to do again.
|
WaitForWork(); // Wait (sleep) until we have work to do again.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::WaitForWork()
|
void WinUIMessagePump::WaitForWork()
|
||||||
{
|
{
|
||||||
// Wait until a message is available, up to the time needed by the timer
|
// Wait until a message is available, up to the time needed by the timer
|
||||||
// manager to fire the next set of timers.
|
// manager to fire the next set of timers.
|
||||||
int64_t delay = GetCurrentDelay();
|
int64_t delay = GetCurrentDelay();
|
||||||
@ -217,7 +215,7 @@ void WinUIMessagePump::WaitForWork()
|
|||||||
// causing us to enter a tight loop at times.
|
// causing us to enter a tight loop at times.
|
||||||
// The WaitMessage call below is a workaround to give the child window
|
// The WaitMessage call below is a workaround to give the child window
|
||||||
// sometime to process its input messages.
|
// sometime to process its input messages.
|
||||||
MSG msg = {0};
|
MSG msg = { 0 };
|
||||||
DWORD queue_status = ::GetQueueStatus(QS_MOUSE);
|
DWORD queue_status = ::GetQueueStatus(QS_MOUSE);
|
||||||
if (HIWORD(queue_status) & QS_MOUSE && !::PeekMessageW(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE))
|
if (HIWORD(queue_status) & QS_MOUSE && !::PeekMessageW(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE))
|
||||||
{
|
{
|
||||||
@ -225,10 +223,10 @@ void WinUIMessagePump::WaitForWork()
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::HandleWorkMessage()
|
void WinUIMessagePump::HandleWorkMessage()
|
||||||
{
|
{
|
||||||
// If we are being called outside of the context of Run, then don't try to do
|
// If we are being called outside of the context of Run, then don't try to do
|
||||||
// any work. This could correspond to a MessageBox call or something of that
|
// any work. This could correspond to a MessageBox call or something of that
|
||||||
// sort.
|
// sort.
|
||||||
@ -248,10 +246,10 @@ void WinUIMessagePump::HandleWorkMessage()
|
|||||||
// needs to do more work.
|
// needs to do more work.
|
||||||
if (state_->delegate->DoWork())
|
if (state_->delegate->DoWork())
|
||||||
ScheduleWork();
|
ScheduleWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::HandleTimerMessage()
|
void WinUIMessagePump::HandleTimerMessage()
|
||||||
{
|
{
|
||||||
::KillTimer(message_hwnd_, reinterpret_cast<UINT_PTR>(this));
|
::KillTimer(message_hwnd_, reinterpret_cast<UINT_PTR>(this));
|
||||||
|
|
||||||
// If we are being called outside of the context of Run, then don't do
|
// If we are being called outside of the context of Run, then don't do
|
||||||
@ -266,10 +264,10 @@ void WinUIMessagePump::HandleTimerMessage()
|
|||||||
// A bit gratuitous to set delayed_work_time_ again, but oh well.
|
// A bit gratuitous to set delayed_work_time_ again, but oh well.
|
||||||
ScheduleDelayedWork(delayed_work_time_);
|
ScheduleDelayedWork(delayed_work_time_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinUIMessagePump::ProcessNextWindowsMessage()
|
bool WinUIMessagePump::ProcessNextWindowsMessage()
|
||||||
{
|
{
|
||||||
// If there are sent messages in the queue then PeekMessage internally
|
// If there are sent messages in the queue then PeekMessage internally
|
||||||
// dispatches the message and returns false. We return true in this
|
// dispatches the message and returns false. We return true in this
|
||||||
// case to ensure that the message loop peeks again instead of calling
|
// case to ensure that the message loop peeks again instead of calling
|
||||||
@ -284,10 +282,10 @@ bool WinUIMessagePump::ProcessNextWindowsMessage()
|
|||||||
return ProcessMessageHelper(msg);
|
return ProcessMessageHelper(msg);
|
||||||
|
|
||||||
return sent_messages_in_queue;
|
return sent_messages_in_queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinUIMessagePump::ProcessMessageHelper(const MSG& msg)
|
bool WinUIMessagePump::ProcessMessageHelper(const MSG& msg)
|
||||||
{
|
{
|
||||||
if (WM_QUIT == msg.message)
|
if (WM_QUIT == msg.message)
|
||||||
{
|
{
|
||||||
// Repost the QUIT message so that it will be retrieved by the primary
|
// Repost the QUIT message so that it will be retrieved by the primary
|
||||||
@ -320,10 +318,10 @@ bool WinUIMessagePump::ProcessMessageHelper(const MSG& msg)
|
|||||||
PostProcessMessage(msg);
|
PostProcessMessage(msg);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinUIMessagePump::ProcessPumpReplacementMessage()
|
bool WinUIMessagePump::ProcessPumpReplacementMessage()
|
||||||
{
|
{
|
||||||
// When we encounter a kMsgHaveWork message, this method is called to peek
|
// When we encounter a kMsgHaveWork message, this method is called to peek
|
||||||
// and process a replacement message, such as a WM_PAINT or WM_TIMER. The
|
// and process a replacement message, such as a WM_PAINT or WM_TIMER. The
|
||||||
// goal is to make the kMsgHaveWork as non-intrusive as possible, even though
|
// goal is to make the kMsgHaveWork as non-intrusive as possible, even though
|
||||||
@ -363,20 +361,20 @@ bool WinUIMessagePump::ProcessPumpReplacementMessage()
|
|||||||
ScheduleWork();
|
ScheduleWork();
|
||||||
|
|
||||||
return ProcessMessageHelper(msg);
|
return ProcessMessageHelper(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::AddObserver(UIObserver *observer)
|
void WinUIMessagePump::AddObserver(UIObserver* observer)
|
||||||
{
|
{
|
||||||
observers_.AddObserver(observer);
|
observers_.AddObserver(observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::RemoveObserver(UIObserver *observer)
|
void WinUIMessagePump::RemoveObserver(UIObserver* observer)
|
||||||
{
|
{
|
||||||
observers_.RemoveObserver(observer);
|
observers_.RemoveObserver(observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::PreProcessMessage(const MSG& msg)
|
void WinUIMessagePump::PreProcessMessage(const MSG& msg)
|
||||||
{
|
{
|
||||||
AutoLazyEraser lazy_eraser(&observers_);
|
AutoLazyEraser lazy_eraser(&observers_);
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
UIObserver* observer;
|
UIObserver* observer;
|
||||||
@ -387,10 +385,10 @@ void WinUIMessagePump::PreProcessMessage(const MSG& msg)
|
|||||||
continue;
|
continue;
|
||||||
observer->PreProcessMessage(msg);
|
observer->PreProcessMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUIMessagePump::PostProcessMessage(const MSG& msg)
|
void WinUIMessagePump::PostProcessMessage(const MSG& msg)
|
||||||
{
|
{
|
||||||
AutoLazyEraser lazy_eraser(&observers_);
|
AutoLazyEraser lazy_eraser(&observers_);
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
UIObserver* observer;
|
UIObserver* observer;
|
||||||
@ -401,9 +399,7 @@ void WinUIMessagePump::PostProcessMessage(const MSG& msg)
|
|||||||
continue;
|
continue;
|
||||||
observer->PostProcessMessage(msg);
|
observer->PostProcessMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nbase
|
} // namespace nbase
|
||||||
|
|
||||||
#endif // OS_WIN
|
#endif // OS_WIN
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</HBox>
|
</HBox>
|
||||||
<Box>
|
<Box>
|
||||||
<VBox margin="0,0,0,0" valign="center" halign="center" width="auto" height="auto">
|
<VBox margin="0,0,0,0" valign="center" halign="center" width="auto" height="auto">
|
||||||
<Label name="tooltip" text="一个简单窗口,带有标题栏和常规按钮。"/>
|
<Label name="tooltip" text="dfasdfasd"/>
|
||||||
</VBox>
|
</VBox>
|
||||||
</Box>
|
</Box>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Window>
|
<Window caption="0,0,180,30" roundcorner="5,5" sizebox="10,10,10,10" mininfo="280,70" maxinfo="300,700">
|
||||||
<ListContainerElement class="listitem" height="auto">
|
<ListContainerElement class="listitem" height="auto">
|
||||||
<HBox height="auto" mouse="false" padding="10,5,10,5">
|
<HBox height="auto" mouse="false" padding="10,5,10,5">
|
||||||
<Control name="control_img" width="auto" height="auto" margin="0,0,10" mouse="false"/>
|
<Control name="control_img" width="auto" height="auto" margin="0,0,10" mouse="false"/>
|
||||||
|
@ -1,31 +1,30 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0"?>
|
||||||
<Window size="1200,800" caption="0,0,0,35">
|
<Window size="1200,800" caption="0,0,0,35">
|
||||||
<VBox bkcolor="bk_wnd_darkcolor">
|
<VBox bkcolor="bk_wnd_darkcolor">
|
||||||
<HBox width="stretch" height="35" bkcolor="bk_wnd_lightcolor">
|
<HBox width="stretch" height="35" bkcolor="bk_wnd_lightcolor">
|
||||||
<Label text="TileBox数据懒加载实现" font="system_14" valign="center" margin="8"/>
|
<Label text="TileBox数据懒加载实现" font="system_14" valign="center" margin="8" />
|
||||||
<Control />
|
<Control />
|
||||||
<Button class="btn_wnd_min" name="minbtn" margin="4,6,0,0"/>
|
<Button class="btn_wnd_min" name="minbtn" margin="4,6,0,0" />
|
||||||
<Box width="21" margin="4,6,0,0">
|
<Box width="21" margin="4,6,0,0">
|
||||||
<Button class="btn_wnd_max" name="maxbtn"/>
|
<Button class="btn_wnd_max" name="maxbtn" />
|
||||||
<Button class="btn_wnd_restore" name="restorebtn" visible="false"/>
|
<Button class="btn_wnd_restore" name="restorebtn" visible="false" />
|
||||||
</Box>
|
</Box>
|
||||||
<Button class="btn_wnd_close" name="closebtn" margin="4,6,8,0"/>
|
<Button class="btn_wnd_close" name="closebtn" margin="4,6,8,0" />
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox childmargin="5" bkcolor="white" padding="5,5,5,10">
|
<HBox childmargin="5" bkcolor="white" padding="5,5,5,10">
|
||||||
<VBox width="300" bordersize="1" bordercolor="splitline_level2" padding="5,10,5,10" childmargin="10">
|
<VBox width="300" bordersize="1" bordercolor="splitline_level2" padding="5,10,5,10" childmargin="10">
|
||||||
<HBox height="30" childmargin="10">
|
<HBox height="30" childmargin="10">
|
||||||
<Label font="system_bold_14" text="列设置:" width="auto" height="auto" valign="center" />
|
<Label font="system_bold_14" text="列设置:" width="auto" height="auto" valign="center" />
|
||||||
<Option class="circle_option_2" name="option_column_auto" group="option_group" text="自动计算" margin="0,5,0,10" selected="true"/>
|
<Option class="circle_option_2" name="option_column_auto" group="option_group" text="自动计算" margin="0,5,0,10" selected="true" />
|
||||||
<Option class="circle_option_2" name="option_column_fix" group="option_group" text="固定列数" margin="0,5,0,10">
|
<Option class="circle_option_2" name="option_column_fix" group="option_group" text="固定列数" margin="0,5,0,10">
|
||||||
<Event type="select" receiver="box_column_op" applyattribute="visible="true"" />
|
<Event type="select" receiver="box_column_op" applyattribute="visible="true"" />
|
||||||
<Event type="unselect" receiver="box_column_op" applyattribute="visible="false"" />
|
<Event type="unselect" receiver="box_column_op" applyattribute="visible="false"" />
|
||||||
</Option>
|
</Option>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|
||||||
<HBox name="box_column_op" height="30" childmargin="10" visible="false">
|
<HBox name="box_column_op" height="30" childmargin="10" visible="false">
|
||||||
<Control width="45" />
|
<Control width="45" />
|
||||||
<Box bordersize="1" bordercolor="splitline_level1" width="80" height="26">
|
<Box bordersize="1" bordercolor="splitline_level1" width="80" height="26">
|
||||||
<RichEdit name="edit_column" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" multiline="false" promptmode="true" prompttext="列数" align="vcenter,hcenter" text="3" promptcolor="splitline_level1" autohscroll="true" />
|
<RichEdit name="edit_column" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" promptmode="true" prompttext="列数" align="vcenter,hcenter" text="3" promptcolor="splitline_level1" autohscroll="true" />
|
||||||
</Box>
|
</Box>
|
||||||
<CheckBox class="checkbox_font12" name="checkbox_item_center" text="列表居中" margin="0,5,0,10" selected="true" />
|
<CheckBox class="checkbox_font12" name="checkbox_item_center" text="列表居中" margin="0,5,0,10" selected="true" />
|
||||||
</HBox>
|
</HBox>
|
||||||
@ -33,56 +32,44 @@
|
|||||||
<HBox height="30" childmargin="10">
|
<HBox height="30" childmargin="10">
|
||||||
<Label font="system_bold_14" text="子项间隙:" width="auto" height="auto" valign="center" />
|
<Label font="system_bold_14" text="子项间隙:" width="auto" height="auto" valign="center" />
|
||||||
<Box bordersize="1" bordercolor="splitline_level1" width="80" height="26">
|
<Box bordersize="1" bordercolor="splitline_level1" width="80" height="26">
|
||||||
<RichEdit name="edit_child_margin" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" multiline="false" promptmode="true" prompttext="子项间隙" align="vcenter,hcenter" text="" promptcolor="splitline_level1" autohscroll="true" />
|
<RichEdit name="edit_child_margin" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" promptmode="true" prompttext="子项间隙" align="vcenter,hcenter" text="" promptcolor="splitline_level1" autohscroll="true" />
|
||||||
</Box>
|
</Box>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox height="30" childmargin="10">
|
<HBox height="30" childmargin="10">
|
||||||
<Label font="system_bold_14" text="总数据:" width="auto" height="auto" valign="center" />
|
<Label font="system_bold_14" text="总数据:" width="auto" height="auto" valign="center" />
|
||||||
<Box bordersize="1" bordercolor="splitline_level1" width="180" >
|
<Box bordersize="1" bordercolor="splitline_level1" width="180">
|
||||||
<RichEdit name="edit_total" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" multiline="false" promptmode="true" prompttext="总数据" promptcolor="splitline_level1" autohscroll="true" />
|
<RichEdit name="edit_total" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" promptmode="true" prompttext="总数据" promptcolor="splitline_level1" autohscroll="true" />
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|
||||||
<Box height="30" childmargin="10" width="stretch">
|
<Box height="30" childmargin="10" width="stretch">
|
||||||
<Button class="btn_global_blue_80x30" halign="center" valign="center" name="btn_set_total" text="更改/设置" />
|
<Button class="btn_global_blue_80x30" halign="center" valign="center" name="btn_set_total" text="更改/设置" />
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Control height="1" bkcolor="splitline_level2" />
|
<Control height="1" bkcolor="splitline_level2" />
|
||||||
|
|
||||||
<HBox height="30" childmargin="10">
|
<HBox height="30" childmargin="10">
|
||||||
<Label font="system_bold_14" text="改变数据:" width="auto" height="auto" valign="center" />
|
<Label font="system_bold_14" text="改变数据:" width="auto" height="auto" valign="center" />
|
||||||
<Box bordersize="1" bordercolor="splitline_level1" height="26">
|
<Box bordersize="1" bordercolor="splitline_level1" height="26">
|
||||||
<RichEdit name="edit_update" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" multiline="false" promptmode="true" prompttext="序号(下标1)" promptcolor="splitline_level1" autohscroll="true" align="vcenter,hcenter" />
|
<RichEdit name="edit_update" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" promptmode="true" prompttext="序号(下标1)" promptcolor="splitline_level1" autohscroll="true" align="vcenter,hcenter" />
|
||||||
</Box>
|
</Box>
|
||||||
<Box bordersize="1" bordercolor="splitline_level1" height="26">
|
<Box bordersize="1" bordercolor="splitline_level1" height="26">
|
||||||
<RichEdit name="edit_task_name" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" multiline="false" promptmode="true" prompttext="新的任务名称" promptcolor="splitline_level1" autohscroll="true" />
|
<RichEdit name="edit_task_name" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" promptmode="true" prompttext="新的任务名称" promptcolor="splitline_level1" autohscroll="true" />
|
||||||
</Box>
|
</Box>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|
||||||
|
|
||||||
<Box height="30" childmargin="10" width="stretch">
|
<Box height="30" childmargin="10" width="stretch">
|
||||||
<Button class="btn_global_blue_80x30" halign="center" valign="center" name="btn_update" text="更新数据" />
|
<Button class="btn_global_blue_80x30" halign="center" valign="center" name="btn_update" text="更新数据" />
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Control height="1" bkcolor="splitline_level2" />
|
<Control height="1" bkcolor="splitline_level2" />
|
||||||
|
|
||||||
<HBox height="30" childmargin="10">
|
<HBox height="30" childmargin="10">
|
||||||
<Label font="system_bold_14" text="删除数据:" width="auto" height="auto" valign="center" />
|
<Label font="system_bold_14" text="删除数据:" width="auto" height="auto" valign="center" />
|
||||||
<Box bordersize="1" bordercolor="splitline_level1" >
|
<Box bordersize="1" bordercolor="splitline_level1">
|
||||||
<RichEdit name="edit_delete" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" multiline="false" promptmode="true" prompttext="序号(下标1)" promptcolor="splitline_level1" autohscroll="true" align="vcenter,hcenter" />
|
<RichEdit name="edit_delete" margin="10,0,10,0" font="system_14" width="stretch" height="auto" valign="center" normaltextcolor="black" promptmode="true" prompttext="序号(下标1)" promptcolor="splitline_level1" autohscroll="true" align="vcenter,hcenter" />
|
||||||
</Box>
|
</Box>
|
||||||
<Button class="btn_global_red_80x30" halign="center" valign="center" name="btn_delete" text="删除数据" />
|
<Button class="btn_global_red_80x30" halign="center" valign="center" name="btn_delete" text="删除数据" />
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|
||||||
|
|
||||||
</VBox>
|
</VBox>
|
||||||
<!--column="3" width="auto" halign="center" childmargin="10" -->
|
<!--column="3" width="auto" halign="center" childmargin="10" -->
|
||||||
<Box>
|
<Box>
|
||||||
<VirtualTileBox class="list" name="list" vscrollunit="70" itemsize="220,60" bordersize="1" bordercolor="splitline_level2" padding="1,1,1,1">
|
<VirtualTileBox class="list" name="list" vscrollunit="70" itemsize="220,60" bordersize="1" bordercolor="splitline_level2" padding="1,1,1,1" />
|
||||||
</VirtualTileBox>
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
</HBox>
|
</HBox>
|
||||||
</VBox>
|
</VBox>
|
||||||
</Window>
|
</Window>
|
@ -2,78 +2,74 @@
|
|||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
|
WindowImplBase::WindowImplBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
WindowImplBase::WindowImplBase()
|
WindowImplBase::~WindowImplBase()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
void WindowImplBase::OnFinalMessage(HWND hWnd)
|
||||||
|
{
|
||||||
|
|
||||||
WindowImplBase::~WindowImplBase()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowImplBase::OnFinalMessage( HWND hWnd )
|
|
||||||
{
|
|
||||||
__super::OnFinalMessage(hWnd);
|
__super::OnFinalMessage(hWnd);
|
||||||
ReapObjects(GetRoot());
|
ReapObjects(GetRoot());
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG WindowImplBase::GetStyle()
|
LONG WindowImplBase::GetStyle()
|
||||||
{
|
{
|
||||||
LONG styleValue = ::GetWindowLong(GetHWND(), GWL_STYLE);
|
LONG styleValue = ::GetWindowLong(GetHWND(), GWL_STYLE);
|
||||||
styleValue &= ~WS_CAPTION;
|
styleValue &= ~WS_CAPTION;
|
||||||
|
|
||||||
return styleValue;
|
return styleValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT WindowImplBase::GetClassStyle() const
|
UINT WindowImplBase::GetClassStyle() const
|
||||||
{
|
{
|
||||||
return CS_DBLCLKS;
|
return CS_DBLCLKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring WindowImplBase::GetResourceID() const
|
std::wstring WindowImplBase::GetResourceID() const
|
||||||
{
|
{
|
||||||
return _T("");
|
return _T("");
|
||||||
}
|
}
|
||||||
|
|
||||||
Control* WindowImplBase::CreateControl(const std::wstring& pstrClass)
|
Control* WindowImplBase::CreateControl(const std::wstring& pstrClass)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
if( ::IsIconic(GetHWND()) ) bHandled = FALSE;
|
if (::IsIconic(GetHWND())) bHandled = FALSE;
|
||||||
return (wParam == 0) ? TRUE : FALSE;
|
return (wParam == 0) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
if (IsZoomed(m_hWnd))
|
if (IsZoomed(m_hWnd))
|
||||||
{
|
{
|
||||||
@ -98,15 +94,15 @@ LRESULT WindowImplBase::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnNcLButtonDbClick(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnNcLButtonDbClick(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
/*if (!::IsZoomed(GetHWND()))
|
/*if (!::IsZoomed(GetHWND()))
|
||||||
{
|
{
|
||||||
SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);
|
SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);
|
||||||
@ -117,10 +113,10 @@ LRESULT WindowImplBase::OnNcLButtonDbClick(UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam);
|
POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam);
|
||||||
::ScreenToClient(GetHWND(), &pt);
|
::ScreenToClient(GetHWND(), &pt);
|
||||||
|
|
||||||
@ -129,17 +125,17 @@ LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
|
|||||||
|
|
||||||
rcClient.Deflate(m_shadow.GetShadowCorner());
|
rcClient.Deflate(m_shadow.GetShadowCorner());
|
||||||
|
|
||||||
if( !::IsZoomed(GetHWND()) ) {
|
if (!::IsZoomed(GetHWND())) {
|
||||||
UiRect rcSizeBox = GetSizeBox();
|
UiRect rcSizeBox = GetSizeBox();
|
||||||
if( pt.y < rcClient.top + rcSizeBox.top ) {
|
if (pt.y < rcClient.top + rcSizeBox.top) {
|
||||||
if (pt.y >= rcClient.top) {
|
if (pt.y >= rcClient.top) {
|
||||||
if (pt.x < (rcClient.left + rcSizeBox.left) && pt.x >= rcClient.left) return HTTOPLEFT;
|
if (pt.x < (rcClient.left + rcSizeBox.left) && pt.x >= rcClient.left) return HTTOPLEFT;
|
||||||
else if (pt.x >(rcClient.right - rcSizeBox.right) && pt.x <= rcClient.right) return HTTOPRIGHT;
|
else if (pt.x > (rcClient.right - rcSizeBox.right) && pt.x <= rcClient.right) return HTTOPRIGHT;
|
||||||
else return HTTOP;
|
else return HTTOP;
|
||||||
}
|
}
|
||||||
else return HTCLIENT;
|
else return HTCLIENT;
|
||||||
}
|
}
|
||||||
else if( pt.y > rcClient.bottom - rcSizeBox.bottom ) {
|
else if (pt.y > rcClient.bottom - rcSizeBox.bottom) {
|
||||||
if (pt.y <= rcClient.bottom) {
|
if (pt.y <= rcClient.bottom) {
|
||||||
if (pt.x < (rcClient.left + rcSizeBox.left) && pt.x >= rcClient.left) return HTBOTTOMLEFT;
|
if (pt.x < (rcClient.left + rcSizeBox.left) && pt.x >= rcClient.left) return HTBOTTOMLEFT;
|
||||||
else if (pt.x > (rcClient.right - rcSizeBox.right) && pt.x <= rcClient.right) return HTBOTTOMRIGHT;
|
else if (pt.x > (rcClient.right - rcSizeBox.right) && pt.x <= rcClient.right) return HTBOTTOMRIGHT;
|
||||||
@ -159,10 +155,10 @@ LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
|
|||||||
}
|
}
|
||||||
|
|
||||||
UiRect rcCaption = GetCaptionRect();
|
UiRect rcCaption = GetCaptionRect();
|
||||||
if( pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
|
if (pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
|
||||||
&& pt.y >= rcClient.top + rcCaption.top && pt.y < rcClient.top + rcCaption.bottom ) {
|
&& pt.y >= rcClient.top + rcCaption.top && pt.y < rcClient.top + rcCaption.bottom) {
|
||||||
Control* pControl = FindControl(pt);
|
Control* pControl = FindControl(pt);
|
||||||
if( pControl ) {
|
if (pControl) {
|
||||||
if (dynamic_cast<Button*>(pControl) || dynamic_cast<ButtonBox*>(pControl) || dynamic_cast<RichEdit*>(pControl))
|
if (dynamic_cast<Button*>(pControl) || dynamic_cast<ButtonBox*>(pControl) || dynamic_cast<RichEdit*>(pControl))
|
||||||
return HTCLIENT;
|
return HTCLIENT;
|
||||||
else
|
else
|
||||||
@ -171,11 +167,11 @@ LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
|
|||||||
}
|
}
|
||||||
|
|
||||||
return HTCLIENT;
|
return HTCLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
LPMINMAXINFO lpMMI = (LPMINMAXINFO) lParam;
|
LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
|
||||||
MONITORINFO oMonitor = {};
|
MONITORINFO oMonitor = {};
|
||||||
oMonitor.cbSize = sizeof(oMonitor);
|
oMonitor.cbSize = sizeof(oMonitor);
|
||||||
::GetMonitorInfo(::MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST), &oMonitor);
|
::GetMonitorInfo(::MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST), &oMonitor);
|
||||||
@ -213,22 +209,22 @@ LRESULT WindowImplBase::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
|||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnMouseHover(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnMouseHover(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnDpiChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnDpiChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
|
|
||||||
// 重置全局 DPI 设定
|
// 重置全局 DPI 设定
|
||||||
@ -240,12 +236,12 @@ LRESULT WindowImplBase::OnDpiChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BO
|
|||||||
// TODO 对窗口大小进行进行改变,让所有控件重新根据 DPI 计算大小
|
// TODO 对窗口大小进行进行改变,让所有控件重新根据 DPI 计算大小
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
CSize szRoundCorner = GetRoundCorner();
|
CSize szRoundCorner = GetRoundCorner();
|
||||||
if( !::IsIconic(GetHWND()) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0) ) {
|
if (!::IsIconic(GetHWND()) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0)) {
|
||||||
UiRect rcWnd;
|
UiRect rcWnd;
|
||||||
::GetWindowRect(GetHWND(), &rcWnd);
|
::GetWindowRect(GetHWND(), &rcWnd);
|
||||||
rcWnd.Offset(-rcWnd.left, -rcWnd.top);
|
rcWnd.Offset(-rcWnd.left, -rcWnd.top);
|
||||||
@ -257,16 +253,16 @@ LRESULT WindowImplBase::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
|||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
if (wParam == SC_CLOSE) {
|
if (wParam == SC_CLOSE) {
|
||||||
bHandled = TRUE;
|
bHandled = TRUE;
|
||||||
SendMessage(WM_CLOSE);
|
SendMessage(WM_CLOSE);
|
||||||
@ -275,16 +271,15 @@ LRESULT WindowImplBase::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BO
|
|||||||
|
|
||||||
BOOL bZoomed = ::IsZoomed(GetHWND());
|
BOOL bZoomed = ::IsZoomed(GetHWND());
|
||||||
LRESULT lRes = Window::HandleMessage(uMsg, wParam, lParam);
|
LRESULT lRes = Window::HandleMessage(uMsg, wParam, lParam);
|
||||||
if( ::IsZoomed(GetHWND()) != bZoomed )
|
if (::IsZoomed(GetHWND()) != bZoomed)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return lRes;
|
return lRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
::SetWindowLong(this->GetHWND(), GWL_STYLE, GetStyle());
|
::SetWindowLong(this->GetHWND(), GWL_STYLE, GetStyle());
|
||||||
|
|
||||||
Init(m_hWnd);
|
Init(m_hWnd);
|
||||||
@ -311,17 +306,17 @@ LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
|||||||
if (pRoot->GetFixedWidth() == DUI_LENGTH_AUTO || pRoot->GetFixedHeight() == DUI_LENGTH_AUTO) {
|
if (pRoot->GetFixedWidth() == DUI_LENGTH_AUTO || pRoot->GetFixedHeight() == DUI_LENGTH_AUTO) {
|
||||||
CSize maxSize(99999, 99999);
|
CSize maxSize(99999, 99999);
|
||||||
CSize needSize = pRoot->EstimateSize(maxSize);
|
CSize needSize = pRoot->EstimateSize(maxSize);
|
||||||
if( needSize.cx < pRoot->GetMinWidth() ) needSize.cx = pRoot->GetMinWidth();
|
if (needSize.cx < pRoot->GetMinWidth()) needSize.cx = pRoot->GetMinWidth();
|
||||||
if( pRoot->GetMaxWidth() >= 0 && needSize.cx > pRoot->GetMaxWidth() ) needSize.cx = pRoot->GetMaxWidth();
|
if (pRoot->GetMaxWidth() >= 0 && needSize.cx > pRoot->GetMaxWidth()) needSize.cx = pRoot->GetMaxWidth();
|
||||||
if( needSize.cy < pRoot->GetMinHeight() ) needSize.cy = pRoot->GetMinHeight();
|
if (needSize.cy < pRoot->GetMinHeight()) needSize.cy = pRoot->GetMinHeight();
|
||||||
if( needSize.cy > pRoot->GetMaxHeight() ) needSize.cy = pRoot->GetMaxHeight();
|
if (needSize.cy > pRoot->GetMaxHeight()) needSize.cy = pRoot->GetMaxHeight();
|
||||||
|
|
||||||
::MoveWindow(m_hWnd, 0, 0, needSize.cx, needSize.cy, FALSE);
|
::MoveWindow(m_hWnd, 0, 0, needSize.cx, needSize.cy, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Control *pControl = (Control*)FindControl(L"closebtn");
|
Control* pControl = (Control*)FindControl(L"closebtn");
|
||||||
if (pControl) {
|
if (pControl) {
|
||||||
Button *pCloseBtn = dynamic_cast<Button*>(pControl);
|
Button* pCloseBtn = dynamic_cast<Button*>(pControl);
|
||||||
ASSERT(pCloseBtn);
|
ASSERT(pCloseBtn);
|
||||||
pCloseBtn->AttachClick(nbase::Bind(&WindowImplBase::OnButtonClick, this, std::placeholders::_1));
|
pCloseBtn->AttachClick(nbase::Bind(&WindowImplBase::OnButtonClick, this, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
@ -348,46 +343,46 @@ LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT WindowImplBase::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LRESULT lRes = 0;
|
LRESULT lRes = 0;
|
||||||
BOOL bHandled = TRUE;
|
BOOL bHandled = TRUE;
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
@ -420,18 +415,18 @@ LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (bHandled) return lRes;
|
if (bHandled) return lRes;
|
||||||
|
|
||||||
return Window::HandleMessage(uMsg, wParam, lParam);
|
return Window::HandleMessage(uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowImplBase::OnButtonClick(EventArgs* msg)
|
bool WindowImplBase::OnButtonClick(EventArgs* msg)
|
||||||
{
|
{
|
||||||
std::wstring sCtrlName = msg->pSender->GetName();
|
std::wstring sCtrlName = msg->pSender->GetName();
|
||||||
if( sCtrlName == _T("closebtn") ) {
|
if (sCtrlName == _T("closebtn")) {
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
else if( sCtrlName == _T("minbtn")) {
|
else if (sCtrlName == _T("minbtn")) {
|
||||||
SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
||||||
}
|
}
|
||||||
else if( sCtrlName == _T("maxbtn")) {
|
else if (sCtrlName == _T("maxbtn")) {
|
||||||
Control* pMaxButton = (Control*)FindControl(L"maxbtn");
|
Control* pMaxButton = (Control*)FindControl(L"maxbtn");
|
||||||
Control* pRestoreButton = (Control*)FindControl(L"restorebtn");
|
Control* pRestoreButton = (Control*)FindControl(L"restorebtn");
|
||||||
if (pMaxButton && pRestoreButton) {
|
if (pMaxButton && pRestoreButton) {
|
||||||
@ -440,7 +435,7 @@ bool WindowImplBase::OnButtonClick(EventArgs* msg)
|
|||||||
}
|
}
|
||||||
SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);
|
SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);
|
||||||
}
|
}
|
||||||
else if( sCtrlName == _T("restorebtn")) {
|
else if (sCtrlName == _T("restorebtn")) {
|
||||||
Control* pMaxButton = (Control*)FindControl(L"maxbtn");
|
Control* pMaxButton = (Control*)FindControl(L"maxbtn");
|
||||||
Control* pRestoreButton = (Control*)FindControl(L"restorebtn");
|
Control* pRestoreButton = (Control*)FindControl(L"restorebtn");
|
||||||
if (pMaxButton && pRestoreButton) {
|
if (pMaxButton && pRestoreButton) {
|
||||||
@ -451,11 +446,10 @@ bool WindowImplBase::OnButtonClick(EventArgs* msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowImplBase::ActiveWindow()
|
||||||
void WindowImplBase::ActiveWindow()
|
{
|
||||||
{
|
|
||||||
if (::IsWindow(m_hWnd))
|
if (::IsWindow(m_hWnd))
|
||||||
{
|
{
|
||||||
if (::IsIconic(m_hWnd))
|
if (::IsIconic(m_hWnd))
|
||||||
@ -469,21 +463,20 @@ void WindowImplBase::ActiveWindow()
|
|||||||
::SetForegroundWindow(m_hWnd);
|
::SetForegroundWindow(m_hWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowImplBase::SetTaskbarTitle(const std::wstring &title)
|
void WindowImplBase::SetTaskbarTitle(const std::wstring& title)
|
||||||
{
|
{
|
||||||
::SetWindowTextW(m_hWnd, title.c_str());
|
::SetWindowTextW(m_hWnd, title.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowImplBase::ToTopMost(bool forever)
|
||||||
void WindowImplBase::ToTopMost(bool forever)
|
{
|
||||||
{
|
|
||||||
ASSERT(::IsWindow(m_hWnd));
|
ASSERT(::IsWindow(m_hWnd));
|
||||||
::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||||
if (!forever)
|
if (!forever)
|
||||||
{
|
{
|
||||||
::SetWindowPos(m_hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
::SetWindowPos(m_hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,13 +21,14 @@
|
|||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}</ProjectGuid>
|
<ProjectGuid>{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}</ProjectGuid>
|
||||||
<RootNamespace>duilib</RootNamespace>
|
<RootNamespace>duilib</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
@ -39,13 +40,13 @@
|
|||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
@ -232,6 +233,7 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<DisableSpecificWarnings>4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
<ProjectGuid>{F1A9371F-9A34-45A0-98EB-83FF371F067F}</ProjectGuid>
|
<ProjectGuid>{F1A9371F-9A34-45A0-98EB-83FF371F067F}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>basic</RootNamespace>
|
<RootNamespace>basic</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
@ -42,7 +42,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
@ -107,7 +107,7 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -7,7 +7,6 @@ BasicForm::BasicForm()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BasicForm::~BasicForm()
|
BasicForm::~BasicForm()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -27,9 +26,13 @@ std::wstring BasicForm::GetWindowClassName() const
|
|||||||
return kClassName;
|
return kClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT BasicForm::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
|
{
|
||||||
|
return WindowImplBase::OnNcHitTest(uMsg, wParam, lParam, bHandled);
|
||||||
|
}
|
||||||
|
|
||||||
void BasicForm::InitWindow()
|
void BasicForm::InitWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT BasicForm::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT BasicForm::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
|
@ -15,6 +15,7 @@ public:
|
|||||||
virtual std::wstring GetSkinFolder() override;
|
virtual std::wstring GetSkinFolder() override;
|
||||||
virtual std::wstring GetSkinFile() override;
|
virtual std::wstring GetSkinFile() override;
|
||||||
virtual std::wstring GetWindowClassName() const override;
|
virtual std::wstring GetWindowClassName() const override;
|
||||||
|
virtual LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收到 WM_CREATE 消息时该函数会被调用,通常做一些控件初始化的操作
|
* 收到 WM_CREATE 消息时该函数会被调用,通常做一些控件初始化的操作
|
||||||
@ -28,4 +29,3 @@ public:
|
|||||||
|
|
||||||
static const std::wstring kClassName;
|
static const std::wstring kClassName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
|||||||
_In_ LPWSTR lpCmdLine,
|
_In_ LPWSTR lpCmdLine,
|
||||||
_In_ int nCmdShow)
|
_In_ int nCmdShow)
|
||||||
{
|
{
|
||||||
|
AllocConsole();
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
|
||||||
@ -40,12 +43,13 @@ void MainThread::Init()
|
|||||||
// 如需修改请指定 Startup 最后两个参数
|
// 如需修改请指定 Startup 最后两个参数
|
||||||
ui::GlobalManager::Startup(theme_dir + L"resources\\", ui::CreateControlCallback(), false);
|
ui::GlobalManager::Startup(theme_dir + L"resources\\", ui::CreateControlCallback(), false);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Release 模式下使用资源中的压缩包作为资源
|
// Release 模式下使用资源中的压缩包作为资源
|
||||||
// 资源被导入到资源列表分类为 THEME,资源名称为 IDR_THEME
|
// 资源被导入到资源列表分类为 THEME,资源名称为 IDR_THEME
|
||||||
// 如果资源使用的是本地的 zip 文件而非资源中的 zip 压缩包
|
// 如果资源使用的是本地的 zip 文件而非资源中的 zip 压缩包
|
||||||
// 可以使用 OpenResZip 另一个重载函数打开本地的资源压缩包
|
// 可以使用 OpenResZip 另一个重载函数打开本地的资源压缩包
|
||||||
ui::GlobalManager::OpenResZip(MAKEINTRESOURCE(IDR_THEME), L"THEME", "");
|
//ui::GlobalManager::OpenResZip(MAKEINTRESOURCE(IDR_THEME), L"THEME", "");
|
||||||
// ui::GlobalManager::OpenResZip(L"resources.zip", "");
|
ui::GlobalManager::OpenResZip(L"resources.zip", "");
|
||||||
ui::GlobalManager::Startup(L"resources\\", ui::CreateControlCallback(), false);
|
ui::GlobalManager::Startup(L"resources\\", ui::CreateControlCallback(), false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
<ProjectGuid>{B8588C07-9CE2-456C-83B1-86E4B65D4108}</ProjectGuid>
|
<ProjectGuid>{B8588C07-9CE2-456C-83B1-86E4B65D4108}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>cef</RootNamespace>
|
<RootNamespace>cef</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
@ -23,19 +23,19 @@
|
|||||||
<ProjectGuid>{8BD95440-9000-4745-8011-27DD553EF06F}</ProjectGuid>
|
<ProjectGuid>{8BD95440-9000-4745-8011-27DD553EF06F}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>controls</RootNamespace>
|
<RootNamespace>controls</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -75,7 +75,7 @@
|
|||||||
<IntDir>$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\</IntDir>
|
<IntDir>$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_d</TargetName>
|
<TargetName>$(ProjectName)_d</TargetName>
|
||||||
<OutDir>..\..\bin\</OutDir>
|
<OutDir>..\..\bin\</OutDir>
|
||||||
<IncludePath>..\..\;$(IncludePath)</IncludePath>
|
<IncludePath>..\..\;$(ProjectDir)..\..\duilib;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@ -107,7 +107,7 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "controls_form.h"
|
#include "controls_form.h"
|
||||||
|
#include "Utils\DpiManager.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
@ -9,7 +10,6 @@ ControlForm::ControlForm()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ControlForm::~ControlForm()
|
ControlForm::~ControlForm()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -29,6 +29,16 @@ std::wstring ControlForm::GetWindowClassName() const
|
|||||||
return kClassName;
|
return kClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ComboChange(ui::EventArgs* ev) {
|
||||||
|
if (nullptr != ev) {
|
||||||
|
printf("%d\r\n", ev->Type);
|
||||||
|
auto p = static_cast<ui::Combo*>(ev->pSender);
|
||||||
|
auto text = p->GetText();
|
||||||
|
wprintf(L"%s\r\n", text.c_str());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ControlForm::InitWindow()
|
void ControlForm::InitWindow()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -82,7 +92,7 @@ void ControlForm::InitWindow()
|
|||||||
element->SetText(nbase::StringPrintf(L"Combo element %d", i));
|
element->SetText(nbase::StringPrintf(L"Combo element %d", i));
|
||||||
combo->Add(element);
|
combo->Add(element);
|
||||||
}
|
}
|
||||||
|
combo->AttachAllEvents(ComboChange);
|
||||||
/* Load xml file content in global misc thread, and post update RichEdit task to UI thread */
|
/* Load xml file content in global misc thread, and post update RichEdit task to UI thread */
|
||||||
StdClosure closure = [this]() {
|
StdClosure closure = [this]() {
|
||||||
std::streamoff length = 0;
|
std::streamoff length = 0;
|
||||||
@ -103,7 +113,9 @@ void ControlForm::InitWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Post task to UI thread
|
// Post task to UI thread
|
||||||
nbase::ThreadManager::PostTask(kThreadUI, nbase::Bind(&ControlForm::OnLoadedResourceFile, this, xml)); // or Post2UI(nbase::Bind(&ControlForm::OnLoadedResourceFile, this, xml));
|
nbase::ThreadManager::PostTask(kThreadUI,
|
||||||
|
nbase::Bind(&ControlForm::OnLoadedResourceFile, this, xml));
|
||||||
|
// or Post2UI(nbase::Bind(&ControlForm::OnLoadedResourceFile, this, xml));
|
||||||
};
|
};
|
||||||
// Using ToWeakCallback to protect closure when if [ControlForm] was destoryed
|
// Using ToWeakCallback to protect closure when if [ControlForm] was destoryed
|
||||||
nbase::ThreadManager::PostTask(kThreadGlobalMisc, ToWeakCallback(closure)); // or Post2GlobalMisc(ToWeakCallback(closure));
|
nbase::ThreadManager::PostTask(kThreadGlobalMisc, ToWeakCallback(closure)); // or Post2GlobalMisc(ToWeakCallback(closure));
|
||||||
@ -111,9 +123,11 @@ void ControlForm::InitWindow()
|
|||||||
/* Post repeat task to update progress value 200 milliseconds once */
|
/* Post repeat task to update progress value 200 milliseconds once */
|
||||||
StdClosure repeat_task = [this]() {
|
StdClosure repeat_task = [this]() {
|
||||||
nbase::TimeDelta time_delta = nbase::TimeDelta::FromMicroseconds(nbase::Time::Now().ToInternalValue());
|
nbase::TimeDelta time_delta = nbase::TimeDelta::FromMicroseconds(nbase::Time::Now().ToInternalValue());
|
||||||
nbase::ThreadManager::PostTask(kThreadUI, nbase::Bind(&ControlForm::OnProgressValueChagned, this, time_delta.ToMilliseconds() % 100));
|
nbase::ThreadManager::PostTask(kThreadUI,
|
||||||
|
nbase::Bind(&ControlForm::OnProgressValueChagned, this, time_delta.ToMilliseconds() % 100));
|
||||||
};
|
};
|
||||||
nbase::ThreadManager::PostRepeatedTask(kThreadGlobalMisc, ToWeakCallback(repeat_task), nbase::TimeDelta::FromMilliseconds(200));
|
nbase::ThreadManager::PostRepeatedTask(kThreadGlobalMisc,
|
||||||
|
ToWeakCallback(repeat_task), nbase::TimeDelta::FromMilliseconds(200));
|
||||||
|
|
||||||
/* Show settings menu */
|
/* Show settings menu */
|
||||||
ui::Button* settings = dynamic_cast<ui::Button*>(FindControl(L"settings"));
|
ui::Button* settings = dynamic_cast<ui::Button*>(FindControl(L"settings"));
|
||||||
@ -154,7 +168,7 @@ void ControlForm::OnProgressValueChagned(float value)
|
|||||||
progress->SetValue(value);
|
progress->SetValue(value);
|
||||||
auto circleprogress = dynamic_cast<ui::Progress*>(FindControl(L"circleprogress"));
|
auto circleprogress = dynamic_cast<ui::Progress*>(FindControl(L"circleprogress"));
|
||||||
circleprogress->SetValue(value);
|
circleprogress->SetValue(value);
|
||||||
TCHAR szBuffer[32] = {0};
|
TCHAR szBuffer[32] = { 0 };
|
||||||
swprintf_s(szBuffer, _T("%.0f%%"), value);
|
swprintf_s(szBuffer, _T("%.0f%%"), value);
|
||||||
circleprogress->SetText(szBuffer);
|
circleprogress->SetText(szBuffer);
|
||||||
}
|
}
|
@ -4,12 +4,21 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "controls_form.h"
|
#include "controls_form.h"
|
||||||
|
#include "Utils\DpiManager.h"
|
||||||
|
|
||||||
|
|
||||||
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||||
_In_opt_ HINSTANCE hPrevInstance,
|
_In_opt_ HINSTANCE hPrevInstance,
|
||||||
_In_ LPWSTR lpCmdLine,
|
_In_ LPWSTR lpCmdLine,
|
||||||
_In_ int nCmdShow)
|
_In_ int nCmdShow)
|
||||||
{
|
{
|
||||||
|
AllocConsole();
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
|
||||||
|
auto dpiManager = ui::DpiManager::GetInstance();
|
||||||
|
dpiManager->SetAdaptDPI(); // 设置适配自动dpi
|
||||||
|
printf("dpi is %d\r\n",dpiManager->GetDPIFromRegistry());
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
class MiscThread : public nbase::FrameworkThread
|
class MiscThread : public nbase::FrameworkThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MiscThread(enum ThreadId thread_id, const char *name)
|
MiscThread(enum ThreadId thread_id, const char* name)
|
||||||
: FrameworkThread(name)
|
: FrameworkThread(name)
|
||||||
, thread_id_(thread_id) {}
|
, thread_id_(thread_id) {}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2013
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 12.0.40629.0
|
VisualStudioVersion = 16.0.31229.75
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{B2087994-3DF6-4A57-B8C6-6F744520D7FA}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{B2087994-3DF6-4A57-B8C6-6F744520D7FA}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -29,6 +29,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "duilib", "..\duilib\duilib.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ui_components", "..\ui_components\ui_components.vcxproj", "{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ui_components", "..\ui_components\ui_components.vcxproj", "{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proto_debuger", "proto_debuger\proto_debuger.vcxproj", "{6D78D8B7-1617-4ED4-B155-94369FC3E73C}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "catch_test", "catch_test\catch_test.vcxproj", "{91850193-0E5E-4983-9D11-F9875805D91E}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
@ -123,6 +127,22 @@ Global
|
|||||||
{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|Win32.Build.0 = Release|Win32
|
{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|Win32.Build.0 = Release|Win32
|
||||||
{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|x64.ActiveCfg = Release|x64
|
{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|x64.ActiveCfg = Release|x64
|
||||||
{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|x64.Build.0 = Release|x64
|
{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|x64.Build.0 = Release|x64
|
||||||
|
{6D78D8B7-1617-4ED4-B155-94369FC3E73C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{6D78D8B7-1617-4ED4-B155-94369FC3E73C}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{6D78D8B7-1617-4ED4-B155-94369FC3E73C}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{6D78D8B7-1617-4ED4-B155-94369FC3E73C}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{6D78D8B7-1617-4ED4-B155-94369FC3E73C}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{6D78D8B7-1617-4ED4-B155-94369FC3E73C}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{6D78D8B7-1617-4ED4-B155-94369FC3E73C}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{6D78D8B7-1617-4ED4-B155-94369FC3E73C}.Release|x64.Build.0 = Release|x64
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -136,6 +156,7 @@ Global
|
|||||||
{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9} = {1DA0A8E2-5832-42FC-83F7-2CDCAD379C90}
|
{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9} = {1DA0A8E2-5832-42FC-83F7-2CDCAD379C90}
|
||||||
{8BD95440-9000-4745-8011-27DD553EF06F} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
|
{8BD95440-9000-4745-8011-27DD553EF06F} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
|
||||||
{E35589C6-9509-4116-996F-1D045C2DACAE} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
|
{E35589C6-9509-4116-996F-1D045C2DACAE} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
|
||||||
|
{91850193-0E5E-4983-9D11-F9875805D91E} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {68CA0970-4242-4E4F-94D2-C19760FCA05D}
|
SolutionGuid = {68CA0970-4242-4E4F-94D2-C19760FCA05D}
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
<ProjectGuid>{2BFFA1EE-039D-479E-9BCC-2D12F8AEDD16}</ProjectGuid>
|
<ProjectGuid>{2BFFA1EE-039D-479E-9BCC-2D12F8AEDD16}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>layouts</RootNamespace>
|
<RootNamespace>layouts</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
@ -22,12 +22,13 @@
|
|||||||
<ProjectGuid>{FDB5539F-1060-4975-B603-B66454C8C897}</ProjectGuid>
|
<ProjectGuid>{FDB5539F-1060-4975-B603-B66454C8C897}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>multi_browser</RootNamespace>
|
<RootNamespace>multi_browser</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
86
examples/proto_debuger/base_form.cpp
Normal file
86
examples/proto_debuger/base_form.cpp
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#include "base_form.h"
|
||||||
|
#include "new_monitor_form.h"
|
||||||
|
|
||||||
|
const std::wstring BasicForm::kClassName = L"Basic";
|
||||||
|
#define WM_USER_POS_CHANGED (WM_USER + 2)
|
||||||
|
|
||||||
|
BasicForm::BasicForm()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BasicForm::~BasicForm()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring BasicForm::GetSkinFolder()
|
||||||
|
{
|
||||||
|
return L"basic";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring BasicForm::GetSkinFile()
|
||||||
|
{
|
||||||
|
return L"basic.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring BasicForm::GetWindowClassName() const
|
||||||
|
{
|
||||||
|
return kClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if (uMsg == WM_USER_POS_CHANGED) {
|
||||||
|
NewMonitorForm* window = new NewMonitorForm();
|
||||||
|
window->Create(NULL, NewMonitorForm::kClassName.c_str(), WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & WS_SIZEBOX, 0);
|
||||||
|
window->CenterWindow();
|
||||||
|
window->ShowModalFake(this->m_hWnd);
|
||||||
|
nim_comp::Toast::ShowToast(L"×Ô¶¨ÒåÏûÏ¢±»µ÷ÓÃ", 1000, this->GetHWND());
|
||||||
|
}
|
||||||
|
return WindowImplBase::HandleMessage(uMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BasicForm::InitWindow()
|
||||||
|
{
|
||||||
|
/* Show settings menu */
|
||||||
|
ui::Button* settings = dynamic_cast<ui::Button*>(FindControl(L"test_customize"));
|
||||||
|
if (nullptr != settings) {
|
||||||
|
settings->AttachClick([this](ui::EventArgs* args) {
|
||||||
|
printf("%d\r\n", ::PostMessage(this->GetHWND(), WM_USER_POS_CHANGED, 0, 0));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ui::TreeView* tree = dynamic_cast<ui::TreeView*>(FindControl(L"tree"));
|
||||||
|
if (nullptr != tree) {
|
||||||
|
ui::TreeNode* parent_node = nullptr;
|
||||||
|
for (auto j = 0; j < 8; j++)
|
||||||
|
{
|
||||||
|
ui::TreeNode* node = new ui::TreeNode;
|
||||||
|
node->SetClass(L"listitem");
|
||||||
|
node->SetFixedHeight(20);
|
||||||
|
if (parent_node)
|
||||||
|
{
|
||||||
|
node->SetText(nbase::StringPrintf(L"Child node %d", j));
|
||||||
|
node->SetMargin({ 10, 0, 0, 0 });
|
||||||
|
parent_node->AddChildNode(node);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node->SetText(nbase::StringPrintf(L"Parent node", j));
|
||||||
|
tree->GetRootNode()->AddChildNode(node);
|
||||||
|
parent_node = node;
|
||||||
|
parent_node->AttachClick([this](ui::EventArgs* args) {
|
||||||
|
printf("%d\r\n", ::PostMessage(this->GetHWND(), WM_USER_POS_CHANGED, 0, 0));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT BasicForm::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
|
{
|
||||||
|
PostQuitMessage(0L);
|
||||||
|
return __super::OnClose(uMsg, wParam, lParam, bHandled);
|
||||||
|
}
|
46
examples/proto_debuger/base_form.h
Normal file
46
examples/proto_debuger/base_form.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// C runtime header
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// base header
|
||||||
|
#include "base/base.h"
|
||||||
|
|
||||||
|
// duilib
|
||||||
|
#include "duilib/UIlib.h"
|
||||||
|
#include "ui_components/ui_components.h"
|
||||||
|
|
||||||
|
|
||||||
|
class BasicForm : public ui::WindowImplBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BasicForm();
|
||||||
|
~BasicForm();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一下三个接口是必须要覆写的接口,父类会调用这三个接口来构建窗口
|
||||||
|
* GetSkinFolder 接口设置你要绘制的窗口皮肤资源路径
|
||||||
|
* GetSkinFile 接口设置你要绘制的窗口的 xml 描述文件
|
||||||
|
* GetWindowClassName 接口设置窗口唯一的类名称
|
||||||
|
*/
|
||||||
|
virtual std::wstring GetSkinFolder() override;
|
||||||
|
virtual std::wstring GetSkinFile() override;
|
||||||
|
virtual std::wstring GetWindowClassName() const override;
|
||||||
|
virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
|
||||||
|
/**
|
||||||
|
* 收到 WM_CREATE 消息时该函数会被调用,通常做一些控件初始化的操作
|
||||||
|
*/
|
||||||
|
void InitWindow() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收到 WM_CLOSE 消息时该函数会被调用
|
||||||
|
*/
|
||||||
|
virtual LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
|
|
||||||
|
static const std::wstring kClassName;
|
||||||
|
};
|
67
examples/proto_debuger/main.cpp
Normal file
67
examples/proto_debuger/main.cpp
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
// basic.cpp : 定义应用程序的入口点。
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include "base_form.h"
|
||||||
|
#include"resource1.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
enum ThreadId
|
||||||
|
{
|
||||||
|
kThreadUI
|
||||||
|
};
|
||||||
|
|
||||||
|
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||||
|
_In_opt_ HINSTANCE hPrevInstance,
|
||||||
|
_In_ LPWSTR lpCmdLine,
|
||||||
|
_In_ int nCmdShow)
|
||||||
|
{
|
||||||
|
AllocConsole();
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
|
||||||
|
// 创建主线程
|
||||||
|
MainThread thread;
|
||||||
|
// 执行主线程循环
|
||||||
|
thread.RunOnCurrentThreadWithLoop(nbase::MessageLoop::kUIMessageLoop);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainThread::Init()
|
||||||
|
{
|
||||||
|
nbase::ThreadManager::RegisterThread(kThreadUI);
|
||||||
|
|
||||||
|
// 获取资源路径,初始化全局参数
|
||||||
|
std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
|
||||||
|
wprintf(L"%s\r\n", theme_dir);
|
||||||
|
#if 1
|
||||||
|
// Debug 模式下使用本地文件夹作为资源
|
||||||
|
// 默认皮肤使用 resources\\themes\\default
|
||||||
|
// 默认语言使用 resources\\lang\\zh_CN
|
||||||
|
// 如需修改请指定 Startup 最后两个参数
|
||||||
|
ui::GlobalManager::Startup(theme_dir + L"resources\\", ui::CreateControlCallback(), false);
|
||||||
|
#else
|
||||||
|
// Release 模式下使用资源中的压缩包作为资源
|
||||||
|
// 资源被导入到资源列表分类为 THEME,资源名称为 IDR_THEME
|
||||||
|
// 如果资源使用的是本地的 zip 文件而非资源中的 zip 压缩包
|
||||||
|
// 可以使用 OpenResZip 另一个重载函数打开本地的资源压缩包
|
||||||
|
ui::GlobalManager::OpenResZip(MAKEINTRESOURCE(IDR_THEME2), L"THEME", "");
|
||||||
|
//ui::GlobalManager::OpenResZip(L"resources.zip", "");
|
||||||
|
ui::GlobalManager::Startup(L"resources\\", ui::CreateControlCallback(), false);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 创建一个默认带有阴影的居中窗口
|
||||||
|
BasicForm* window = new BasicForm();
|
||||||
|
window->Create(NULL, BasicForm::kClassName.c_str(), WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & WS_SIZEBOX, 0);
|
||||||
|
window->CenterWindow();
|
||||||
|
window->ShowWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainThread::Cleanup()
|
||||||
|
{
|
||||||
|
ui::GlobalManager::Shutdown();
|
||||||
|
SetThreadWasQuitProperly(true);
|
||||||
|
nbase::ThreadManager::UnregisterThread();
|
||||||
|
}
|
40
examples/proto_debuger/main.h
Normal file
40
examples/proto_debuger/main.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
// C runtime header
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
// base header
|
||||||
|
#include "base/base.h"
|
||||||
|
|
||||||
|
// duilib
|
||||||
|
#include "duilib/UIlib.h"
|
||||||
|
|
||||||
|
/** @class MainThread
|
||||||
|
* @brief 主线程(UI线程)类,继承 nbase::FrameworkThread
|
||||||
|
* @copyright (c) 2015, NetEase Inc. All rights reserved
|
||||||
|
* @author towik
|
||||||
|
* @date 2015/1/1
|
||||||
|
*/
|
||||||
|
class MainThread : public nbase::FrameworkThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MainThread() : nbase::FrameworkThread("MainThread") {}
|
||||||
|
virtual ~MainThread() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* 虚函数,初始化主线程
|
||||||
|
* @return void 无返回值
|
||||||
|
*/
|
||||||
|
virtual void Init() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚函数,主线程退出时,做一些清理工作
|
||||||
|
* @return void 无返回值
|
||||||
|
*/
|
||||||
|
virtual void Cleanup() override;
|
||||||
|
};
|
41
examples/proto_debuger/new_monitor_form.cpp
Normal file
41
examples/proto_debuger/new_monitor_form.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#include "new_monitor_form.h"
|
||||||
|
const std::wstring NewMonitorForm::kClassName = L"Basic";
|
||||||
|
|
||||||
|
NewMonitorForm::NewMonitorForm()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NewMonitorForm::~NewMonitorForm()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring NewMonitorForm::GetSkinFolder()
|
||||||
|
{
|
||||||
|
return L"basic";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring NewMonitorForm::GetSkinFile()
|
||||||
|
{
|
||||||
|
return L"newmonitor.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring NewMonitorForm::GetWindowClassName() const
|
||||||
|
{
|
||||||
|
return kClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT NewMonitorForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
return WindowImplBase::HandleMessage(uMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewMonitorForm::InitWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT NewMonitorForm::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
|
{
|
||||||
|
PostQuitMessage(0L);
|
||||||
|
return __super::OnClose(uMsg, wParam, lParam, bHandled);
|
||||||
|
}
|
46
examples/proto_debuger/new_monitor_form.h
Normal file
46
examples/proto_debuger/new_monitor_form.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#pragma once
|
||||||
|
// C runtime header
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// base header
|
||||||
|
#include "base/base.h"
|
||||||
|
|
||||||
|
// duilib
|
||||||
|
#include "duilib/UIlib.h"
|
||||||
|
#include "ui_components/ui_components.h"
|
||||||
|
|
||||||
|
|
||||||
|
class NewMonitorForm : public ui::WindowImplBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NewMonitorForm();
|
||||||
|
~NewMonitorForm();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一下三个接口是必须要覆写的接口,父类会调用这三个接口来构建窗口
|
||||||
|
* GetSkinFolder 接口设置你要绘制的窗口皮肤资源路径
|
||||||
|
* GetSkinFile 接口设置你要绘制的窗口的 xml 描述文件
|
||||||
|
* GetWindowClassName 接口设置窗口唯一的类名称
|
||||||
|
*/
|
||||||
|
virtual std::wstring GetSkinFolder() override;
|
||||||
|
virtual std::wstring GetSkinFile() override;
|
||||||
|
virtual std::wstring GetWindowClassName() const override;
|
||||||
|
virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
|
||||||
|
/**
|
||||||
|
* 收到 WM_CREATE 消息时该函数会被调用,通常做一些控件初始化的操作
|
||||||
|
*/
|
||||||
|
void InitWindow() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收到 WM_CLOSE 消息时该函数会被调用
|
||||||
|
*/
|
||||||
|
virtual LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
|
|
||||||
|
static const std::wstring kClassName;
|
||||||
|
};
|
||||||
|
|
76
examples/proto_debuger/proto_debuger.rc
Normal file
76
examples/proto_debuger/proto_debuger.rc
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource1.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "winres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 中文(简体,中国) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
|
||||||
|
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
|
||||||
|
#pragma code_page(936)
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource1.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#include ""winres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Accelerator
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// THEME
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_THEME2 THEME "E:\\NIM_Duilib_Framework\\examples\\proto_debuger\\Release\\resources.zip"
|
||||||
|
|
||||||
|
#endif // 中文(简体,中国) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
181
examples/proto_debuger/proto_debuger.vcxproj
Normal file
181
examples/proto_debuger/proto_debuger.vcxproj
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{6d78d8b7-1617-4ed4-b155-94369fc3e73c}</ProjectGuid>
|
||||||
|
<RootNamespace>protodebuger</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<ReferencePath>$(VC_ReferencesPath_x86);</ReferencePath>
|
||||||
|
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\;$(IncludePath)</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>../../;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<ShowProgress>LinkVerbose</ShowProgress>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\base\base.vcxproj">
|
||||||
|
<Project>{8d9a6595-717a-41c8-b468-0011a72be3d1}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\duilib\duilib.vcxproj">
|
||||||
|
<Project>{e106acd7-4e53-4aee-942b-d0dd426db34e}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ui_components\ui_components.vcxproj">
|
||||||
|
<Project>{0149ba6e-3c0a-426d-aa0a-0b9ec7742f19}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="base_form.cpp" />
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
|
<ClCompile Include="new_monitor_form.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="base_form.h" />
|
||||||
|
<ClInclude Include="main.h" />
|
||||||
|
<ClInclude Include="new_monitor_form.h" />
|
||||||
|
<ClInclude Include="resource1.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Xml Include="..\Debug\resources\themes\default\global.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="proto_debuger.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\Release\resources.zip" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
55
examples/proto_debuger/proto_debuger.vcxproj.filters
Normal file
55
examples/proto_debuger/proto_debuger.vcxproj.filters
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="源文件">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="头文件">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="资源文件">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="base_form.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="new_monitor_form.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="main.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="base_form.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="resource1.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="new_monitor_form.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Xml Include="..\Debug\resources\themes\default\global.xml">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Xml>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="proto_debuger.rc">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\Release\resources.zip" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
17
examples/proto_debuger/resource1.h
Normal file
17
examples/proto_debuger/resource1.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ 生成的包含文件。
|
||||||
|
// 供 proto_debuger.rc 使用
|
||||||
|
//
|
||||||
|
#define IDR_ACCELERATOR1 101
|
||||||
|
#define IDR_THEME2 103
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 104
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40002
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
@ -23,13 +23,13 @@
|
|||||||
<ProjectGuid>{878F5BF0-652A-4FDB-992B-BB7F26D62F0D}</ProjectGuid>
|
<ProjectGuid>{878F5BF0-652A-4FDB-992B-BB7F26D62F0D}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>richlist</RootNamespace>
|
<RootNamespace>richlist</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
@ -43,7 +43,7 @@ void MainThread::Init()
|
|||||||
|
|
||||||
// 获取资源路径,初始化全局参数
|
// 获取资源路径,初始化全局参数
|
||||||
std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
|
std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
|
||||||
ui::GlobalManager::Startup(theme_dir + L"resources\\", MyCreateControlCallback, false);
|
ui::GlobalManager::Startup(theme_dir + L"resources\\", MyCreateControlCallback, true);
|
||||||
|
|
||||||
// 创建一个默认带有阴影的居中窗口
|
// 创建一个默认带有阴影的居中窗口
|
||||||
MainForm* window = new MainForm();
|
MainForm* window = new MainForm();
|
||||||
|
@ -46,8 +46,6 @@ void MainForm::InitWindow()
|
|||||||
m_DataProvider = new Provider;
|
m_DataProvider = new Provider;
|
||||||
m_pTileList->SetDataProvider(m_DataProvider);
|
m_pTileList->SetDataProvider(m_DataProvider);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT MainForm::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT MainForm::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
@ -72,7 +70,7 @@ bool MainForm::OnClicked(ui::EventArgs* args)
|
|||||||
if (m_CheckBoxItemCenter->IsSelected())
|
if (m_CheckBoxItemCenter->IsSelected())
|
||||||
{
|
{
|
||||||
m_pTileList->SetAttribute(L"width", L"auto");
|
m_pTileList->SetAttribute(L"width", L"auto");
|
||||||
m_pTileList->SetAttribute(L"halign", L"center");
|
m_pTileList->SetAttribute(L"halign", L"left");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_pTileList->SetAttribute(L"width", L"stretch");
|
m_pTileList->SetAttribute(L"width", L"stretch");
|
||||||
@ -93,7 +91,7 @@ bool MainForm::OnClicked(ui::EventArgs* args)
|
|||||||
}
|
}
|
||||||
else if (sName == L"btn_update")
|
else if (sName == L"btn_update")
|
||||||
{
|
{
|
||||||
m_DataProvider->ChangeTaskName(_ttoi(m_EditUpdate->GetText().c_str())-1,
|
m_DataProvider->ChangeTaskName(_ttoi(m_EditUpdate->GetText().c_str()) - 1,
|
||||||
m_EditTaskName->GetText());
|
m_EditTaskName->GetText());
|
||||||
}
|
}
|
||||||
else if (sName == L"btn_delete")
|
else if (sName == L"btn_delete")
|
||||||
|
@ -15,12 +15,13 @@
|
|||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>VirtualBox</RootNamespace>
|
<RootNamespace>VirtualBox</RootNamespace>
|
||||||
<ProjectName>virtualbox</ProjectName>
|
<ProjectName>virtualbox</ProjectName>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
@ -23,13 +23,14 @@
|
|||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
<ProjectName>libcef_dll_wrapper</ProjectName>
|
<ProjectName>libcef_dll_wrapper</ProjectName>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
@ -41,7 +42,7 @@
|
|||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
@ -35,10 +35,12 @@ public:
|
|||||||
// the ownership of the dialog
|
// the ownership of the dialog
|
||||||
bool DoModal(ModalWndBase *dlg);
|
bool DoModal(ModalWndBase *dlg);
|
||||||
void CancelModalThenExit();
|
void CancelModalThenExit();
|
||||||
|
template<class _Ty>
|
||||||
|
friend class Ref_count_obj;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<class _Ty>
|
|
||||||
friend class std::_Ref_count_obj;
|
|
||||||
|
|
||||||
friend class AsyncModalRunnerManager;
|
friend class AsyncModalRunnerManager;
|
||||||
friend class std::shared_ptr<AsyncModalRunner>;
|
friend class std::shared_ptr<AsyncModalRunner>;
|
||||||
|
@ -23,19 +23,19 @@
|
|||||||
<ProjectGuid>{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}</ProjectGuid>
|
<ProjectGuid>{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>uicomponents</RootNamespace>
|
<RootNamespace>uicomponents</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v120_xp</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -100,6 +100,7 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>.\;..\;..\third_party\cef_wrapper\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.\;..\;..\third_party\cef_wrapper\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@ -200,7 +201,6 @@
|
|||||||
<ClInclude Include="cef_control\util\util.h" />
|
<ClInclude Include="cef_control\util\util.h" />
|
||||||
<ClInclude Include="menu\ui_menu.h" />
|
<ClInclude Include="menu\ui_menu.h" />
|
||||||
<ClInclude Include="modal_wnd\async_do_modal.h" />
|
<ClInclude Include="modal_wnd\async_do_modal.h" />
|
||||||
<ClInclude Include="modal_wnd\async_modal_runner.h" />
|
|
||||||
<ClInclude Include="modal_wnd\file_dialog_ex.h" />
|
<ClInclude Include="modal_wnd\file_dialog_ex.h" />
|
||||||
<ClInclude Include="modal_wnd\modal_wnd_base.h" />
|
<ClInclude Include="modal_wnd\modal_wnd_base.h" />
|
||||||
<ClInclude Include="msgbox\msgbox.h" />
|
<ClInclude Include="msgbox\msgbox.h" />
|
||||||
@ -228,7 +228,6 @@
|
|||||||
<ClCompile Include="cef_control\util\memory_dc.cpp" />
|
<ClCompile Include="cef_control\util\memory_dc.cpp" />
|
||||||
<ClCompile Include="menu\ui_menu.cpp" />
|
<ClCompile Include="menu\ui_menu.cpp" />
|
||||||
<ClCompile Include="modal_wnd\async_do_modal.cpp" />
|
<ClCompile Include="modal_wnd\async_do_modal.cpp" />
|
||||||
<ClCompile Include="modal_wnd\async_modal_runner.cpp" />
|
|
||||||
<ClCompile Include="modal_wnd\file_dialog_ex.cpp" />
|
<ClCompile Include="modal_wnd\file_dialog_ex.cpp" />
|
||||||
<ClCompile Include="msgbox\msgbox.cpp" />
|
<ClCompile Include="msgbox\msgbox.cpp" />
|
||||||
<ClCompile Include="shadow_wnd\shadow_wnd.cpp" />
|
<ClCompile Include="shadow_wnd\shadow_wnd.cpp" />
|
||||||
|
@ -66,9 +66,6 @@
|
|||||||
<ClInclude Include="modal_wnd\async_do_modal.h">
|
<ClInclude Include="modal_wnd\async_do_modal.h">
|
||||||
<Filter>modal_wnd</Filter>
|
<Filter>modal_wnd</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="modal_wnd\async_modal_runner.h">
|
|
||||||
<Filter>modal_wnd</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="modal_wnd\file_dialog_ex.h">
|
<ClInclude Include="modal_wnd\file_dialog_ex.h">
|
||||||
<Filter>modal_wnd</Filter>
|
<Filter>modal_wnd</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -149,9 +146,6 @@
|
|||||||
<ClCompile Include="modal_wnd\async_do_modal.cpp">
|
<ClCompile Include="modal_wnd\async_do_modal.cpp">
|
||||||
<Filter>modal_wnd</Filter>
|
<Filter>modal_wnd</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="modal_wnd\async_modal_runner.cpp">
|
|
||||||
<Filter>modal_wnd</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="modal_wnd\file_dialog_ex.cpp">
|
<ClCompile Include="modal_wnd\file_dialog_ex.cpp">
|
||||||
<Filter>modal_wnd</Filter>
|
<Filter>modal_wnd</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
|
|
||||||
namespace nim_comp
|
namespace nim_comp
|
||||||
{
|
{
|
||||||
/** @class WindowEx
|
/** @class WindowEx
|
||||||
* @brief 所有窗体的基类
|
* @brief 所有窗体的基类
|
||||||
* @copyright (c) 2015, NetEase Inc. All rights reserved
|
* @copyright (c) 2015, NetEase Inc. All rights reserved
|
||||||
* @date 2015/9/16
|
* @date 2015/9/16
|
||||||
*/
|
*/
|
||||||
class WindowEx : public ui::WindowImplBase
|
class WindowEx : public ui::WindowImplBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WindowEx();
|
WindowEx();
|
||||||
virtual ~WindowEx();
|
virtual ~WindowEx();
|
||||||
|
|
||||||
@ -32,7 +32,8 @@ public:
|
|||||||
* @param[in] uMsg 消息
|
* @param[in] uMsg 消息
|
||||||
* @param[in] wParam 参数
|
* @param[in] wParam 参数
|
||||||
* @param[in] lParam 参数
|
* @param[in] lParam 参数
|
||||||
* @param[out] bHandled 消息是否被处理
|
* @param[out] b
|
||||||
|
d 消息是否被处理
|
||||||
* @return LRESULT 处理结果
|
* @return LRESULT 处理结果
|
||||||
*/
|
*/
|
||||||
virtual LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
virtual LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
@ -42,7 +43,7 @@ public:
|
|||||||
* @param[out] bHandled 消息是否被处理
|
* @param[out] bHandled 消息是否被处理
|
||||||
* @return void 无返回值
|
* @return void 无返回值
|
||||||
*/
|
*/
|
||||||
virtual void OnEsc(BOOL &bHandled);
|
virtual void OnEsc(BOOL& bHandled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取窗口类名的接口
|
* 获取窗口类名的接口
|
||||||
@ -65,7 +66,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* 从WindowManager中注册自己
|
* 从WindowManager中注册自己
|
||||||
* @return bool true 注册成功,false 注册失败
|
* @return bool true 注册成功,false 注册失败
|
||||||
@ -77,12 +78,11 @@ private:
|
|||||||
* @return void 无返回值
|
* @return void 无返回值
|
||||||
*/
|
*/
|
||||||
void UnRegisterWnd();
|
void UnRegisterWnd();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取弹出窗口可以显示在右下角位置的坐标
|
|
||||||
* @return POINT 窗口坐标
|
|
||||||
*/
|
|
||||||
POINT GetPopupWindowPos(WindowEx* window);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取弹出窗口可以显示在右下角位置的坐标
|
||||||
|
* @return POINT 窗口坐标
|
||||||
|
*/
|
||||||
|
POINT GetPopupWindowPos(WindowEx* window);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user