-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Soul Dark
committed
Nov 6, 2017
1 parent
d47d2f7
commit 33a9358
Showing
30 changed files
with
959 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
#include <WS2tcpip.h> | ||
template<class Derived> | ||
class Dialog; | ||
|
||
template<class Derived> | ||
class Dialog { | ||
public: | ||
static VOID Destroy(); | ||
static HWND Handle_Get(); | ||
static VOID Handle_Set(HWND Handle); | ||
private: | ||
static HWND Handle_; | ||
}; | ||
|
||
template<class Derived> | ||
HWND Dialog<Derived>::Handle_ = NULL; | ||
|
||
//public: | ||
|
||
template<class Derived> | ||
VOID Dialog<Derived>::Destroy() { | ||
DestroyWindow(Handle_); | ||
} | ||
|
||
template<class Derived> | ||
HWND Dialog<Derived>::Handle_Get() { | ||
return Handle_; | ||
} | ||
|
||
template<class Derived> | ||
VOID Dialog<Derived>::Handle_Set(HWND Handle) { | ||
Handle_ = Handle; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
#include "Dialog_Main.h" | ||
#include <shellapi.h> | ||
#include "../Dialog_Setting/Dialog_Setting.h" | ||
#include "../Menu/Menu.h" | ||
#include "../Net/Net.h" | ||
#include "../NotifyIcon/NotifyIcon.h" | ||
#include "../Registry/Registry.h" | ||
#include "../Resource/resource.h" | ||
|
||
HBRUSH Dialog_Main::Handle_Color_Background_; | ||
BOOL Dialog_Main::Show_; | ||
|
||
//public: | ||
|
||
INT_PTR Dialog_Main::Process(HWND Handle_Dialog, UINT Message_Dialog, WPARAM Param_WORD, LPARAM Param_LONG) { | ||
Handle_Set(Handle_Dialog); | ||
BOOL Result_Process = TRUE; | ||
switch (Message_Dialog) { | ||
case WM_COMMAND: | ||
{ | ||
switch (LOWORD(Param_WORD)) { | ||
case WM_MENU_EXIT: | ||
{ | ||
Menu::Item_Exit(); | ||
break; | ||
} | ||
case WM_MENU_SETTING: | ||
{ | ||
Menu::Item_Setting(); | ||
break; | ||
} | ||
case WM_MENU_SHOW: | ||
{ | ||
Menu::Item_Show(); | ||
break; | ||
} | ||
case WM_MENU_STARTUP: | ||
{ | ||
Menu::Item_Startup(); | ||
break; | ||
} | ||
default: | ||
{ | ||
Result_Process = FALSE; | ||
break; | ||
} | ||
} | ||
break; | ||
} | ||
case WM_CTLCOLORDLG: | ||
{ | ||
return (INT_PTR)Handle_Color_Background_; | ||
} | ||
case WM_CTLCOLORSTATIC: | ||
{ | ||
SetBkMode((HDC)Param_WORD, TRANSPARENT); | ||
SetTextColor((HDC)Param_WORD, RGB(255, 255, 255)); | ||
return (INT_PTR)Handle_Color_Background_; | ||
} | ||
case WM_DESTROY: | ||
{ | ||
NotifyIcon::Destroy(); | ||
return 0; | ||
} | ||
case WM_EXITSIZEMOVE: | ||
{ | ||
Registry::Position_Save(); | ||
break; | ||
} | ||
case WM_INITDIALOG: | ||
{ | ||
Handle_Color_Background_ = CreateSolidBrush(RGB(0, 0, 0)); | ||
POINT Position = Registry::Position_Get(); | ||
Position_Set(Position); | ||
SetWindowLongW( | ||
Handle_Get(), | ||
GWL_EXSTYLE, | ||
GetWindowLongW(Handle_Get(), GWL_EXSTYLE) | WS_EX_LAYERED | WS_EX_TOOLWINDOW | ||
); | ||
INT Transparency = Registry::Transparency_Get(); | ||
Transparency_Set(Transparency); | ||
Net::Refresh_Start(); | ||
break; | ||
} | ||
case WM_LBUTTONDOWN: | ||
{ | ||
SendMessageW(Handle_Get(), WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(LOWORD(Param_LONG), HIWORD(Param_LONG))); | ||
break; | ||
} | ||
case WM_NCPAINT: | ||
{ | ||
NotifyIcon::Init(); | ||
break; | ||
} | ||
case WM_NOTIFYICON: | ||
{ | ||
switch (Param_LONG) { | ||
case WM_RBUTTONUP: | ||
{ | ||
Menu::Pop(); | ||
return TRUE; | ||
} | ||
default: | ||
{ | ||
Result_Process = FALSE; | ||
break; | ||
} | ||
} | ||
break; | ||
} | ||
case WM_RBUTTONUP: | ||
{ | ||
Menu::Pop(); | ||
break; | ||
} | ||
default: | ||
{ | ||
Result_Process = FALSE; | ||
break; | ||
} | ||
} | ||
return Result_Process; | ||
} | ||
|
||
POINT Dialog_Main::Position_Get() { | ||
RECT Position_RECT; | ||
GetWindowRect(Dialog_Main::Handle_Get(), &Position_RECT); | ||
MapWindowPoints(HWND_DESKTOP, GetParent(Dialog_Main::Handle_Get()), (LPPOINT)&Position_RECT, sizeof(RECT) / sizeof(POINT)); | ||
POINT Position_POINT; | ||
Position_POINT.x = Position_RECT.left; | ||
Position_POINT.y = Position_RECT.top; | ||
return Position_POINT; | ||
} | ||
|
||
VOID Dialog_Main::Position_Set(POINT Position) { | ||
SetWindowPos(Handle_Get(), NULL, Position.x, Position.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER); | ||
} | ||
|
||
BOOL Dialog_Main::Show_Get() { | ||
return IsWindowVisible(Handle_Get()); | ||
} | ||
|
||
VOID Dialog_Main::Show_Set(BOOL Show) { | ||
if (Show == TRUE) { | ||
ShowWindow(Dialog_Main::Handle_Get(), SW_SHOW); | ||
} | ||
else { | ||
ShowWindow(Dialog_Main::Handle_Get(), SW_HIDE); | ||
} | ||
if (Dialog_Setting::Handle_Get() != NULL) { | ||
Dialog_Setting::Refresh_Check_Setting_Show(); | ||
} | ||
} | ||
|
||
INT Dialog_Main::Transparency_Get() { | ||
BYTE Transparency_BYTE; | ||
GetLayeredWindowAttributes(Dialog_Main::Handle_Get(), NULL, &Transparency_BYTE, NULL); | ||
INT Transparency_INT = Transparency_BYTE * 100.0 / 255.0 + 0.5; | ||
return Transparency_INT; | ||
} | ||
|
||
VOID Dialog_Main::Transparency_Set(INT Transparency) { | ||
SetLayeredWindowAttributes(Handle_Get(), 0, (255.0* Transparency) / 100.0 + 0.5, LWA_ALPHA); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
#include <WS2tcpip.h> | ||
class Dialog_Main; | ||
#include "../Dialog/Dialog.h" | ||
|
||
class Dialog_Main :public Dialog<Dialog_Main> { | ||
public: | ||
static INT_PTR WINAPI Process(HWND Handle_Dialog, UINT Message_Dialog, WPARAM Param_WORD, LPARAM Param_LONG); | ||
static POINT Position_Get(); | ||
static VOID Position_Set(POINT Position); | ||
static BOOL Show_Get(); | ||
static VOID Show_Set(BOOL Show); | ||
static INT Transparency_Get(); | ||
static VOID Transparency_Set(INT Transparency); | ||
private: | ||
static HBRUSH Handle_Color_Background_; | ||
static BOOL Show_; | ||
}; | ||
|
||
|
||
|
Oops, something went wrong.