summaryrefslogtreecommitdiffhomepage
path: root/Public/Developer/SystemLib/Headers/Dialog.h
blob: 823b33667d4ae6cd36911a0262b3450b0495f840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* -------------------------------------------

    Copyright Mahrouss Logic

------------------------------------------- */

#pragma once

#include <Headers/Wm.h>

struct _DialogPort;
struct _DialogPoint;

/// @brief Dialog procedure type.
typedef VoidType(*WmDialogFn)(struct _DialogPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam);

/// @brief A point, can represent the size, position of a window.
typedef struct _DialogPoint {
  PositionType X, Y;
} DialogPoint;

typedef struct _DialogPort {
  WordType dlgPort;
  WordType dlgKind;
  BooleanType dlgVisible : 1;
  BooleanType dlgMoving : 1;
  DialogPoint dlgPosition;
  WmDialogFn dlgProc;
  struct _WmGFX* dlgGfx;
  struct _WmWindowPort* parentPort;
} DialogPort;

/// @brief Creates a new dialog from a rsrc fork id.
/// @param rsrcId the resource id.
/// @return the dialog port.
CA_EXTERN_C DialogPort* DlgCreateFromRsrc(QWordType rsrcId);

/// @brief Shows an message box according to format.
/// @param title the message box title
/// @param format the format
/// @param va_list the va args, that goes along with it.
/// @return 0: the user clicked Ok
/// @return > 0: User clicked on specific button.
CA_EXTERN_C Int32Type DlgMsgBox(const CharacterTypeUTF8* title, const CharacterTypeUTF8* format, ...);