summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/MsnNavDlg.cpp
blob: 7858aaf8bc0ee71b9c3f018989e1d35c1095f48a (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.

    AUTHOR:       John DiCamillo


    OVERVIEW
    ========
    Mission Briefing Dialog Active Window class
*/

#include "MsnNavDlg.h"
#include "PlanScreen.h"
#include "Campaign.h"
#include "Mission.h"
#include "Instruction.h"
#include "Ship.h"
#include "ShipDesign.h"
#include "StarSystem.h"

#include "Keyboard.h"

// +--------------------------------------------------------------------+
// DECLARE MAPPING FUNCTIONS:
DEF_MAP_CLIENT(MsnNavDlg, OnCommit);
DEF_MAP_CLIENT(MsnNavDlg, OnCancel);
DEF_MAP_CLIENT(MsnNavDlg, OnTabButton);

// +--------------------------------------------------------------------+

MsnNavDlg::MsnNavDlg(Screen* s, FormDef& def, PlanScreen* mgr)
: NavDlg(s, def, mgr), MsnDlg(mgr)
{
    RegisterControls();
}

MsnNavDlg::~MsnNavDlg()
{
}

// +--------------------------------------------------------------------+

void
MsnNavDlg::RegisterControls()
{
    RegisterMsnControls(this);

    if (commit)
    REGISTER_CLIENT(EID_CLICK, commit, MsnNavDlg, OnCommit);

    if (cancel)
    REGISTER_CLIENT(EID_CLICK, cancel, MsnNavDlg, OnCancel);

    if (sit_button)
    REGISTER_CLIENT(EID_CLICK, sit_button, MsnNavDlg, OnTabButton);

    if (pkg_button)
    REGISTER_CLIENT(EID_CLICK, pkg_button, MsnNavDlg, OnTabButton);

    if (nav_button)
    REGISTER_CLIENT(EID_CLICK, nav_button, MsnNavDlg, OnTabButton);

    if (wep_button)
    REGISTER_CLIENT(EID_CLICK, wep_button, MsnNavDlg, OnTabButton);
}

// +--------------------------------------------------------------------+

void
MsnNavDlg::Show()
{
    NavDlg::Show();
    ShowMsnDlg();
}

void
MsnNavDlg::ExecFrame()
{
    NavDlg::ExecFrame();

    if (Keyboard::KeyDown(VK_RETURN)) {
        OnCommit(0);
    }
}

// +--------------------------------------------------------------------+

void
MsnNavDlg::OnCommit(AWEvent* event)
{
    MsnDlg::OnCommit(event);
    NavDlg::OnCommit(event);
}

void
MsnNavDlg::OnCancel(AWEvent* event)
{
    MsnDlg::OnCancel(event);
    NavDlg::OnCancel(event);
}