LIBURANIA
GUI library (a wrapper of Win32 API) in C++
読み取り中…
検索中…
一致する文字列を見つけられません
dialog.h
[詳解]
1/*
2 * Copyright 2002-2024 oZ/acy (名賀月晃嗣)
3 * Redistribution and use in source and binary forms,
4 * with or without modification,
5 * are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 */
40#ifndef INCLUDE_GUARD_URANIA_DIALOG_H
41#define INCLUDE_GUARD_URANIA_DIALOG_H
42
43#include <any>
44#include "wbase.h"
45
46
51{
52 friend class urania::Window;
53
54public:
56 using MsgHandler = BOOL (*)(urania::Dialog*, UINT, WPARAM, LPARAM);
57
59 using Initializer = void (*)(urania::Dialog*);
60
61protected:
65 bool modal_;
66 std::any app_;
67
68 Dialog(Initializer i, Initializer u, MsgHandler h, bool m, const std::any& a)
69 : ini_(i), uini_(i), handler_(h), modal_(m), app_(a) {}
70
71 void init_(HWND hw) override;
72 void uninit_() override;
73 void destroyWindow_() override;
74
75public:
77
85 static
86 int
87 doModal(
88 int rid, Initializer ini, Initializer ui, MsgHandler hnd,
89 const std::any& app = std::any());
90
98 static
99 std::unique_ptr<Dialog>
101 int rid, Initializer ini, Initializer ui, MsgHandler hnd,
102 const std::any& a = std::any());
103
112 static
113 int
115 int rid, WndBase* par, Initializer ini, Initializer ui, MsgHandler hnd,
116 const std::any& a = std::any());
117
126 static
127 std::unique_ptr<Dialog>
129 int rid, WndBase* par, Initializer ini, Initializer ui, MsgHandler hnd,
130 const std::any& a = std::any());
131
132
135 void endModal(int i);
136
139 std::any& getAppData() { return app_; }
140
141
142protected:
144 virtual BOOL dproc_(UINT msg, WPARAM wp, LPARAM lp);
145
147 static BOOL CALLBACK dlgproc_(HWND hw, UINT msg, WPARAM wp, LPARAM lp);
148};
149
150
151
152
153#endif // INCLUDE_GUARD_URANIA_DIALOG_H
ダイアログ
Definition dialog.h:51
Dialog(Initializer i, Initializer u, MsgHandler h, bool m, const std::any &a)
Definition dialog.h:68
Initializer uini_
Definition dialog.h:63
void destroyWindow_() override
ウィンドウ破棄の實處理
Definition dialog.cpp:140
BOOL(*)(urania::Dialog *, UINT, WPARAM, LPARAM) MsgHandler
メッセージハンドラ
Definition dialog.h:56
void uninit_() override
メッセージ處理系初期化解除
Definition dialog.cpp:168
std::any app_
Definition dialog.h:66
void init_(HWND hw) override
メッセージ處理系初期化
Definition dialog.cpp:150
static BOOL CALLBACK dlgproc_(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
Dialogと結合しているDialogBox用のDlgProc
Definition dialog.cpp:99
MsgHandler handler_
Definition dialog.h:64
static int doOwnedModal(int rid, WndBase *par, Initializer ini, Initializer ui, MsgHandler hnd, const std::any &a=std::any())
所有者附のModalなダイアログの作成
Definition dialog.cpp:70
virtual BOOL dproc_(UINT msg, WPARAM wp, LPARAM lp)
各Dialogのメッセージ處理「プロシージャ」
Definition dialog.cpp:124
void(*)(urania::Dialog *) Initializer
初期化子/初期化解除子
Definition dialog.h:59
static int doModal(int rid, Initializer ini, Initializer ui, MsgHandler hnd, const std::any &app=std::any())
Modalなダイアログの作成
Definition dialog.cpp:45
std::any & getAppData()
設定データの參照
Definition dialog.h:139
Initializer ini_
Definition dialog.h:62
void endModal(int i)
Modalなダイアログの終了
Definition dialog.cpp:133
~Dialog()
Definition dialog.h:76
bool modal_
Definition dialog.h:65
static std::unique_ptr< Dialog > doOwnedModeless(int rid, WndBase *par, Initializer ini, Initializer ui, MsgHandler hnd, const std::any &a=std::any())
Definition dialog.cpp:83
static std::unique_ptr< Dialog > doModeless(int rid, Initializer ini, Initializer ui, MsgHandler hnd, const std::any &a=std::any())
Modelessなダイアログの作成
Definition dialog.cpp:58
ウィンドウ
Definition window.h:260
HWND管理用基底クラス
Definition wbase.h:55
void deleting_()
オブジェクト側からHWNDを破棄
Definition wbase.h:137
HWND管理基底クラス