OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4StartupAboutDlg.cpp
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2010-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 // About/credits screen
17 
18 #include "C4Include.h"
19 #include "gui/C4StartupAboutDlg.h"
20 
21 #include "gui/C4UpdateDlg.h"
23 #include "C4Version.h"
24 
25 // ------------------------------------------------
26 // --- C4StartupAboutDlg
27 
29 {
30  // ctor
31  UpdateSize();
32 
34  C4Rect rcClient = GetContainedClientRect();
35 
36  // bottom line buttons and copyright messages
37  C4GUI::ComponentAligner caMain(rcClient, 0,0, true);
38  C4GUI::ComponentAligner caButtons(caMain.GetFromBottom(caMain.GetHeight()*1/8), 0,0, false);
40  int32_t iButtonWidth = caButtons.GetInnerWidth() / 4;
41  AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_BACK"), caButtons.GetGridCell(0,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnBackBtn));
42  btn->SetToolTip(LoadResStr("IDS_DLGTIP_BACKMAIN"));
43 #ifdef WITH_AUTOMATIC_UPDATE
44  AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_CHECKFORUPDATES"), caButtons.GetGridCell(2,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnUpdateBtn));
45  btn->SetToolTip(LoadResStr("IDS_DESC_CHECKONLINEFORNEWVERSIONS"));
46 #endif
47 
48  AddElement(new C4GUI::Label("'Clonk' is a registered trademark of Matthes Bender.",
49  caButtons.GetFromBottom(rUseFont.GetLineHeight())));
50 }
51 
53 {
54 }
55 
57 {
59 }
60 
62 {
63  C4Startup::Get()->Graphics.fctAboutBG.Draw(cgo, true, 0, 0, true);
64 }
65 
66 #ifdef WITH_AUTOMATIC_UPDATE
67 void C4StartupAboutDlg::OnUpdateBtn(C4GUI::Control *btn)
68 {
69  C4UpdateDlg::CheckForUpdates(GetScreen());
70 }
71 #endif
int32_t GetHeight() const
Definition: C4Gui.h:2801
int GetLineHeight() const
Definition: C4FontLoader.h:132
#define C4GUI_ButtonHgt
Definition: C4Gui.h:111
virtual void DrawElement(C4TargetFacet &cgo)
Definition: C4Rect.h:29
void AddElement(Element *pChild)
C4Rect GetContainedClientRect()
Definition: C4Gui.h:448
C4GraphicsResource GraphicsResource
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
Definition: C4Facet.cpp:154
class C4StartupDlg * SwitchDialog(DialogID eToDlg, bool fFade=true, const char *szSubDialog=nullptr)
Definition: C4Startup.cpp:139
C4Rect & GetGridCell(int32_t iSectX, int32_t iSectXMax, int32_t iSectY, int32_t iSectYMax, int32_t iSectSizeX=-1, int32_t iSectSizeY=-1, bool fCenterPos=false, int32_t iSectNumX=1, int32_t iSectNumY=1)
Definition: C4Gui.cpp:1151
static C4Startup * Get()
Definition: C4Startup.h:133
virtual Screen * GetScreen()
Definition: C4Gui.cpp:290
C4FacetID fctAboutBG
Definition: C4Startup.h:44
C4StartupGraphics Graphics
Definition: C4Startup.h:100
bool GetFromBottom(int32_t iHgt, int32_t iWdt, C4Rect &rcOut)
Definition: C4Gui.cpp:1112
int32_t GetInnerWidth() const
Definition: C4Gui.h:2805
void OnBackBtn(C4GUI::Control *btn)
virtual void UpdateSize()