41#ifndef INCLUDE_GUARD_URANIA_BASICWINDOW_H
42#define INCLUDE_GUARD_URANIA_BASICWINDOW_H
83 x(CW_USEDEFAULT),
w(CW_USEDEFAULT),
103 std::wstring wcname_;
108 bool operator==(
const WC_& other)
const noexcept
110 if (icon_id_ != other.icon_id_)
112 if (cursor_id_ != other.cursor_id_)
114 if (bkcolor_ != other.bkcolor_)
116 if (proc_ != other.proc_)
122 bool operator!=(
const WC_& other)
const noexcept
124 return !(*
this == other);
130 static std::vector<WC_> vwc_S;
145 SetWindowLongPtr(hw, 0,
reinterpret_cast<ULONG_PTR
>(
this));
152 SetWindowLongPtr(
hw_, 0,
reinterpret_cast<ULONG_PTR
>(
nullptr));
169 virtual LRESULT
wproc_(UINT msg, WPARAM wp, LPARAM lp) =0;
179 static LRESULT CALLBACK
winproc_(HWND hw, UINT msg, WPARAM wp, LPARAM lp);
205 ::InvalidateRect(
hw_,
nullptr, FALSE);
218 r.right = rect.right;
220 r.bottom = rect.bottom;
222 ::InvalidateRect(
hw_, &r, FALSE);
242 template<
class PT_> LRESULT
onPaint(PT_&& proc, WPARAM wp, LPARAM lp);
250 ::GetClientRect(
hw_, &rc);
260 ::GetClientRect(
hw_, &rc);
274 ::GetClientRect(
hw_, &rc);
302 ::SetWindowPos(
hw_,
nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
316 ::GetWindowRect(
hw_, &wr);
317 ::GetClientRect(
hw_, &cr);
318 w += wr.right - wr.left - cr.right;
319 h += wr.bottom - wr.top - cr.bottom;
320 ::SetWindowPos(
hw_,
nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
326 void setTimer(
int id,
int elapse) { ::SetTimer(
hw_,
id, elapse,
nullptr); }
333 virtual LRESULT
defHandler(UINT msg, WPARAM wp, LPARAM lp);
353 ::BeginPaint(
hw_, &ps);
355 ::GetClientRect(
hw_, &rc);
359 proc(
this, pd.get());
362 ::EndPaint(
hw_, &ps);
Window管理・操作用基底クラス
Definition bwin.h:54
void update()
ウィンドウ更新(再描畫要求)
Definition bwin.h:192
void destroyWindow_() override
ウィンドウ破棄の實處理を實裝
Definition bwin.h:156
void unbindHWND_()
HWNDからBasicWindowオブジェクトへの結合を切斷
Definition bwin.h:149
bool getClientWidthAndHeight(int &w, int &h)
クライアント領域の幅と高さの取得
Definition bwin.h:269
void invalidate(const eunomia::Rect &rect)
ウィンドウの再描畫領域の設定
Definition bwin.h:213
static std::wstring registerWC_(const WC_ &wc)
Definition bwin.cpp:50
void bindHWND_(HWND hw)
BasicWindowオブジェクトとHWNDの二重結合を形成
Definition bwin.h:142
void createWindow0_(const D0_ &de)
Definition bwin.cpp:144
void resizeClientArea(int w, int h)
ウィンドウの大きさを變更
Definition bwin.h:311
std::unique_ptr< PaintDevice > getPaintDevice()
ウィンドウ描畫用のPaintDeviceを取得
Definition bwin.cpp:255
void setTimer(int id, int elapse)
タイマーを設定
Definition bwin.h:326
static LRESULT CALLBACK winproc_(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
ウィンドウプロシージャ
Definition bwin.cpp:205
virtual LRESULT wproc_(UINT msg, WPARAM wp, LPARAM lp)=0
ウィンドウプロシージャ(個別)
void killTimer(int id)
タイマーを破棄
Definition bwin.h:330
virtual LRESULT defHandler(UINT msg, WPARAM wp, LPARAM lp)
デフォルトのメッセージ處理
Definition bwin.cpp:236
void resize(int w, int h)
ウィンドウの大きさを變更
Definition bwin.h:299
int getClientWidth()
クライアント領域の幅を取得
Definition bwin.h:245
void invalidate()
ウィンドウの再描畫領域の設定
Definition bwin.h:202
LRESULT onPaint(PT_ &&proc, WPARAM wp, LPARAM lp)
ウィンドウ再描畫
Definition bwin.h:347
int getClientHeight()
クライアント領域の高さを取得
Definition bwin.h:255
static std::unique_ptr< PaintDevice > create(HDC dc, DestProc dp, void *a, int w, int h)
Definition pdev.cpp:84
HWND管理用基底クラス
Definition wbase.h:55
void link_(HWND h)
HWNDの強固な連結
Definition wbase.h:73
HWND hw_
管理對象のHWND
Definition wbase.h:57
void kill_()
HWNDの切り離しと破棄
Definition wbase.h:84
@ BG_WHITE
Definition decl.h:107
@ DEFAULT_RC
Definition decl.h:102
bool can_resize
Definition bwin.h:79
bool v_scrollbar
Definition bwin.h:76
int h
Definition bwin.h:67
unsigned cursor
Definition bwin.h:70
HWND pwnd
Definition bwin.h:63
int w
Definition bwin.h:67
bool maxbox
Definition bwin.h:73
HMENU hm
Definition bwin.h:64
std::wstring title
Definition bwin.h:62
unsigned icon
Definition bwin.h:69
int x
Definition bwin.h:67
bool border_only
Definition bwin.h:78
unsigned bkcolor
Definition bwin.h:71
bool popup
Definition bwin.h:77
D0_() noexcept
Definition bwin.h:81
int y
Definition bwin.h:67
bool minbox
Definition bwin.h:74
bool h_scrollbar
Definition bwin.h:75
WNDPROC winproc
Definition bwin.h:65