Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ProgressDialog.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 // Widget Names
5 const string WIDGET_TEXT_PROGRESS = "TxtProgress";
6 const string WIDGET_PROGRESS_BAR = "ProgressDownload";
7
8 // Widgets
11
12 //------------------------------------------------------------------------------------------------
13 // Dialog override functions
14 //------------------------------------------------------------------------------------------------
15
16 //------------------------------------------------------------------------------------------------
17 override void HandlerAttached(Widget w)
18 {
19 super.HandlerAttached(w);
20
21 // Get widgets
22 m_wTxtProgress = TextWidget.Cast(w.FindAnyWidget(WIDGET_TEXT_PROGRESS));
23
24 Widget wProgressBar = w.FindAnyWidget(WIDGET_PROGRESS_BAR);
25 if (wProgressBar)
27 }
28
29 //------------------------------------------------------------------------------------------------
30 // Public API
31 //------------------------------------------------------------------------------------------------
32
33 //------------------------------------------------------------------------------------------------
34 void SetProgress(float progress)
35 {
36 // Progress bar
37 if (m_ProgressBar)
38 {
39 m_ProgressBar.SetValue(progress);
40
41 // Get proper value in percent
42 float progValue = m_ProgressBar.GetValue() - m_ProgressBar.GetMin();
43 progValue /= m_ProgressBar.GetMax() - m_ProgressBar.GetMin();
44 progValue *= 100;
45 progValue = Math.Floor(progValue);
46
47 // Progress text
48 if (m_wTxtProgress)
49 m_wTxtProgress.SetText(progValue.ToString() + "%");
50 }
51 }
52
53};
54
55
56
Definition Math.c:13
override void HandlerAttached(Widget w)
void SetProgress(float progress)
SCR_WLibProgressBarComponent m_ProgressBar
Minimalist progress bar.