-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.h
143 lines (109 loc) · 3.45 KB
/
main.h
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef MAIN_H
#define MAIN_H
/**
* -----------------------------------------------------
* File main.h
* Authors David Ordnung, Impact
* License GPLv3
* Web http://dordnung.de, http://gugyclan.eu
* -----------------------------------------------------
*
* Copyright (C) 2013-2017 David Ordnung, Impact
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#pragma once
// Precomp Header
#include <wx/wxprec.h>
// We need WX
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/listbox.h>
#include <wx/notebook.h>
#include "call.h"
// Main Notebook
extern wxNotebook* notebook;
// Event ID's for Main Dialog
enum
{
wxID_Hide = wxID_HIGHEST+100,
wxID_Reconnect,
wxID_BoxClick,
wxID_CheckBox,
wxID_SteamChanged,
wxID_ThreadHandled,
};
// Main Dialog Class
class MainDialog: public wxDialog
{
private:
wxCheckBox* store;
wxCheckBox* available;
wxCheckBox* sound;
wxButton* reconnectButton;
wxPanel *panel;
wxListBox* callBox;
wxSizer* sizerBody;
wxStaticText* eventText;
wxStaticText* steamText;
public:
MainDialog(const wxString& title) : wxDialog(NULL, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxMINIMIZE_BOX)
{
// Initialize vars
store = NULL;
available = NULL;
sound = NULL;
reconnectButton = NULL;
panel = NULL;
callBox = NULL;
sizerBody = NULL;
eventText = NULL;
steamText = NULL;
}
// Create the window
void createWindow(bool taskbar = false);
// Check checkboxes
bool isAvailable() {return (available != NULL && available->IsChecked());}
bool wantStore() {return (store != NULL && !store->IsChecked());}
bool wantSound() {return (sound != NULL && sound->IsChecked());}
// Update Window
void setEventText(wxString text) {eventText->SetLabelText(text); sizerBody->Layout(); eventText->Refresh(); panel->SetSizerAndFit(sizerBody, false); notebook->Fit(); Fit();}
void setReconnectButton(bool enable=false) {reconnectButton->Enable(enable);}
void setSteamStatus(wxString text, wxColor color) {steamText->SetLabelText(text); steamText->SetForegroundColour(color); sizerBody->Layout(); panel->SetSizerAndFit(sizerBody, false); notebook->Fit(); Fit();}
// Update Call list
void updateCall();
void resetCalls() {callBox->Clear();}
void setHandled(int item)
{
callBox->SetString(item, "F - " + wxString::FromUTF8(call_dialogs[item]->getBoxText()));
call_dialogs[item]->setFinish();
call_dialogs[item]->takeover->Enable(false);
}
protected:
// Button Events
void OnHide(wxCommandEvent& event);
void OnReconnect(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void OnMinimizeWindow(wxIconizeEvent& event);
void OnBoxClick(wxCommandEvent& event);
void OnCheckBox(wxCommandEvent& event);
void OnSteamChange(wxCommandEvent& event);
// Thread Event
void OnThread(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
// Main Dialog
extern MainDialog *main_dialog;
#endif