summaryrefslogtreecommitdiffstats
path: root/src/libs/7zip/unix/CPP/Windows/Control/DialogImpl.h
blob: a9720b778c51a9395dcc2aac0780fd5a1043fd33 (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
// Windows/Control/DialogImpl.h

#ifndef __WINDOWS_CONTROL_DIALOGIMPL_H
#define __WINDOWS_CONTROL_DIALOGIMPL_H

#include "Windows/Window.h"
#include "Windows/Control/Dialog.h"

void myCreateHandle(int n); // FIXME - duplicate

enum {
    WORKER_EVENT=100    // this one gets sent from the worker thread
};

namespace NWindows {
	namespace NControl {

#define TIMER_ID_IMPL (1234)

		class CModalDialogImpl : public wxDialog
		{
			wxTimer _timer;

			CDialog *_dialog;
		public:
			CModalDialogImpl(CDialog *dialog, wxWindow* parent, wxWindowID id, const wxString& title,
				       	const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
				       	long style = wxDEFAULT_DIALOG_STYLE );

			CDialog * Detach()
			{
				CDialog * oldDialog = _dialog;
				_dialog = NULL;
				return oldDialog;
			}

			void OnInit()
			{
				if (_dialog) _dialog->OnInit(this);
			}

			void OnAnyButton(wxCommandEvent& event);
			void OnAnyChoice(wxCommandEvent &event);
			void OnAnyTimer(wxTimerEvent &event);

/* FIXME			virtual void SetLabel(const wxString &title)
			{
				// Why we must do this "alias" ?
				this->SetTitle(title);
			}
*/
			//////////////////
			UINT_PTR SetTimer(UINT_PTR /* FIXME idEvent */, unsigned milliseconds)
			{
				_timer.Start(milliseconds);
				return TIMER_ID_IMPL;
			}
			void KillTimer(UINT_PTR idEvent)
			{
				if (idEvent == TIMER_ID_IMPL) _timer.Stop();
			}
			void OnWorkerEvent(wxCommandEvent& event)
			{
				int n = event.GetInt();
				// printf("CModalDialogImpl::OnWorkerEvent(n=%d)\n",n);
				myCreateHandle(n);
			}
		};
}
}

#endif