OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4GUI Namespace Reference

Classes

class  ArrowButton
 
class  BaseCallbackHandler
 
class  BaseInputCallback
 
class  BaseParCallbackHandler
 
class  Button
 
class  CallbackButton
 
class  CallbackButtonEx
 
class  CallbackEdit
 
class  CallbackHandler
 
class  CallbackHandlerExPar
 
class  CallbackHandlerNoPar
 
class  CallbackRenameEdit
 
class  CancelButton
 
class  CancelIconButton
 
class  CBContextHandler
 
class  CBMenuHandler
 
class  CBMenuHandlerEx
 
class  CheckBox
 
class  CloseButton
 
class  CloseIconButton
 
class  CMouse
 
class  ComboBox
 
class  ComboBox_FillCallback
 
class  ComboBox_FillCB
 
class  ComponentAligner
 
class  ConfirmationDialog
 
class  Container
 
class  ContextButton
 
class  ContextHandler
 
class  ContextMenu
 
class  Control
 
class  ControlKeyCB
 
class  ControlKeyCBExPassKey
 
class  ControlKeyDlgCB
 
class  Dialog
 
class  DialogWindow
 
class  DlgCallback
 
class  DlgCallbackEx
 
class  DlgCloseButton
 
class  DlgKeyCB
 
class  DlgKeyCBEx
 
class  DlgKeyCBPassKey
 
struct  DynBarFacet
 
class  Edit
 
class  Element
 
class  FacetButton
 
class  FrameDecoration
 
class  FullscreenDialog
 
class  GroupBox
 
class  HorizontalLine
 
class  Icon
 
class  IconButton
 
class  InfoDialog
 
class  InputCallback
 
class  InputDialog
 
class  Label
 
class  LabeledEdit
 
class  ListBox
 
class  MenuHandler
 
class  MessageDialog
 
class  MultilineLabel
 
class  NoButton
 
class  OKButton
 
class  OKIconButton
 
class  OverlayPicture
 
class  PaintBox
 
class  ParCallbackHandler
 
class  Picture
 
class  ProgressBar
 
class  ProgressDialog
 
class  RenameEdit
 
class  ResetButton
 
class  RetryButton
 
class  Screen
 
class  ScrollBar
 
struct  ScrollBarFacets
 
class  ScrollWindow
 
class  SortCompareElements
 
class  Tabular
 
class  TextWindow
 
class  Window
 
class  WoodenLabel
 
class  YesButton
 

Enumerations

enum  { Ico_Extended = 0x100, Ico_Controller = 0x200 }
 
enum  Icons {
  Ico_Empty = -2, Ico_None = -1, Ico_Clonk = 0, Ico_Notify = 1,
  Ico_Wait = 2, Ico_NetWait = 3, Ico_Host = 4, Ico_Client = 5,
  Ico_UnknownClient = 6, Ico_UnknownPlayer = 7, Ico_ObserverClient = 8, Ico_Player = 9,
  Ico_Resource = 10, Ico_Error = 11, Ico_SavegamePlayer = 12, Ico_Save = 13,
  Ico_Active = 14, Ico_Options = 14, Ico_Editor = 14, Ico_Inactive = 15,
  Ico_Kick = 16, Ico_Loading = 17, Ico_Confirm = 18, Ico_Team = 19,
  Ico_AddPlr = 20, Ico_Record = 21, Ico_Chart = 21, Ico_Gfx = 22,
  Ico_Sound = 23, Ico_Keyboard = 24, Ico_Gamepad = 25, Ico_MouseOff = 26,
  Ico_MouseOn = 27, Ico_Help = 28, Ico_Definition = 29, Ico_GameRunning = 30,
  Ico_Lobby = 31, Ico_RuntimeJoin = 32, Ico_Exit = 33, Ico_Close = 34,
  Ico_Rank1 = 35, Ico_Rank2 = 36, Ico_Rank3 = 37, Ico_Rank4 = 38,
  Ico_Rank5 = 39, Ico_Rank6 = 40, Ico_Rank7 = 41, Ico_Rank8 = 42,
  Ico_Rank9 = 43, Ico_OfficialServer = 44, Ico_Surrender = 45, Ico_MeleeLeague = 46,
  Ico_Ready = 47, Ico_Star = 48, Ico_Disconnect = 49, Ico_View = 50,
  Ico_Ignored = 52, Ico_Ex_RecordOff = Ico_Extended + 0, Ico_Ex_RecordOn = Ico_Extended + 1, Ico_Ex_NormalCrew = Ico_Extended + 3,
  Ico_Ex_LeagueOff = Ico_Extended + 4, Ico_Ex_LeagueOn = Ico_Extended + 5, Ico_Ex_InternetOff = Ico_Extended + 6, Ico_Ex_InternetOn = Ico_Extended + 7,
  Ico_Ex_League = Ico_Extended + 8, Ico_Ex_NormalCrewGray = Ico_Extended + 10, Ico_Ex_Locked = Ico_Extended + 11, Ico_Ex_Unlocked = Ico_Extended + 12,
  Ico_Ex_LockedFrontal = Ico_Extended + 13, Ico_Ex_Update = Ico_Extended + 14, Ico_Ex_Chat = Ico_Extended + 15, Ico_Ex_GameList = Ico_Extended + 16,
  Ico_Ex_Comment = Ico_Extended + 17, Ico_Controller_A = Ico_Controller + 0, Ico_Controller_B = Ico_Controller + 3, Ico_Controller_X = Ico_Controller + 17,
  Ico_Controller_Y = Ico_Controller + 18, Ico_Controller_Back = Ico_Controller + 1, Ico_Controller_Start = Ico_Controller + 16, Ico_Controller_Dpad = Ico_Controller + 6,
  Ico_Controller_DpadLeft = Ico_Controller + 5, Ico_Controller_DpadRight = Ico_Controller + 7, Ico_Controller_DpadDown = Ico_Controller + 4, Ico_Controller_DpadUp = Ico_Controller + 8,
  Ico_Controller_LeftShoulder = Ico_Controller + 9, Ico_Controller_RightShoulder = Ico_Controller + 12, Ico_Controller_LeftTrigger = Ico_Controller + 11, Ico_Controller_RightTrigger = Ico_Controller + 14,
  Ico_Controller_LeftStick = Ico_Controller + 10, Ico_Controller_RightStick = Ico_Controller + 13
}
 

Functions

bool ExpandHotkeyMarkup (StdStrBuf &sText, uint32_t &rcHotkey, bool for_tooltip)
 
DWORD MakeColorReadableOnBlack (DWORD &rdwClr)
 
void GUISound (const char *szSound)
 
bool IsActive ()
 
bool IsExclusive ()
 
int32_t GetScreenWdt ()
 
int32_t GetScreenHgt ()
 
float GetZoom ()
 
void MouseMove (int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, class C4Viewport *pVP)
 
bool IsWholeWordSpacer (unsigned char c)
 

Variables

Screen TheScreen
 

Class Documentation

class C4GUI::DlgCallback

template<class CallbackDlg>
class C4GUI::DlgCallback< CallbackDlg >

Definition at line 1074 of file C4Gui.h.

Inheritance diagram for C4GUI::DlgCallback< CallbackDlg >:
[legend]
Class Members
typedef bool(* Bool2Func
typedef bool(* BoolFunc
typedef void(* ContextClickFunc
typedef ContextMenu *(* ContextFunc
typedef void(* Func
class C4GUI::DlgCallbackEx

template<class CallbackDlg, class TEx>
class C4GUI::DlgCallbackEx< CallbackDlg, TEx >

Definition at line 1085 of file C4Gui.h.

Inheritance diagram for C4GUI::DlgCallbackEx< CallbackDlg, TEx >:
[legend]
Class Members
typedef void(* ContextClickFunc

Enumeration Type Documentation

anonymous enum
Enumerator
Ico_Extended 
Ico_Controller 

Definition at line 632 of file C4Gui.h.

633  {
634  Ico_Extended = 0x100, // icon index offset for extended icons
635  Ico_Controller = 0x200,
636  };
Enumerator
Ico_Empty 
Ico_None 
Ico_Clonk 
Ico_Notify 
Ico_Wait 
Ico_NetWait 
Ico_Host 
Ico_Client 
Ico_UnknownClient 
Ico_UnknownPlayer 
Ico_ObserverClient 
Ico_Player 
Ico_Resource 
Ico_Error 
Ico_SavegamePlayer 
Ico_Save 
Ico_Active 
Ico_Options 
Ico_Editor 
Ico_Inactive 
Ico_Kick 
Ico_Loading 
Ico_Confirm 
Ico_Team 
Ico_AddPlr 
Ico_Record 
Ico_Chart 
Ico_Gfx 
Ico_Sound 
Ico_Keyboard 
Ico_Gamepad 
Ico_MouseOff 
Ico_MouseOn 
Ico_Help 
Ico_Definition 
Ico_GameRunning 
Ico_Lobby 
Ico_RuntimeJoin 
Ico_Exit 
Ico_Close 
Ico_Rank1 
Ico_Rank2 
Ico_Rank3 
Ico_Rank4 
Ico_Rank5 
Ico_Rank6 
Ico_Rank7 
Ico_Rank8 
Ico_Rank9 
Ico_OfficialServer 
Ico_Surrender 
Ico_MeleeLeague 
Ico_Ready 
Ico_Star 
Ico_Disconnect 
Ico_View 
Ico_Ignored 
Ico_Ex_RecordOff 
Ico_Ex_RecordOn 
Ico_Ex_NormalCrew 
Ico_Ex_LeagueOff 
Ico_Ex_LeagueOn 
Ico_Ex_InternetOff 
Ico_Ex_InternetOn 
Ico_Ex_League 
Ico_Ex_NormalCrewGray 
Ico_Ex_Locked 
Ico_Ex_Unlocked 
Ico_Ex_LockedFrontal 
Ico_Ex_Update 
Ico_Ex_Chat 
Ico_Ex_GameList 
Ico_Ex_Comment 
Ico_Controller_A 
Ico_Controller_B 
Ico_Controller_X 
Ico_Controller_Y 
Ico_Controller_Back 
Ico_Controller_Start 
Ico_Controller_Dpad 
Ico_Controller_DpadLeft 
Ico_Controller_DpadRight 
Ico_Controller_DpadDown 
Ico_Controller_DpadUp 
Ico_Controller_LeftShoulder 
Ico_Controller_RightShoulder 
Ico_Controller_LeftTrigger 
Ico_Controller_RightTrigger 
Ico_Controller_LeftStick 
Ico_Controller_RightStick 

Definition at line 637 of file C4Gui.h.

638  {
639  Ico_Empty = -2, // for context menus only
640  Ico_None = -1,
641  Ico_Clonk = 0,
642  Ico_Notify = 1,
643  Ico_Wait = 2,
644  Ico_NetWait = 3,
645  Ico_Host = 4,
646  Ico_Client = 5,
647  Ico_UnknownClient = 6,
648  Ico_UnknownPlayer = 7,
649  Ico_ObserverClient = 8,
650  Ico_Player = 9,
651  Ico_Resource = 10,
652  Ico_Error = 11,
653  Ico_SavegamePlayer = 12,
654  Ico_Save = 13,
655  Ico_Active = 14,
656  Ico_Options = 14,
657  Ico_Editor = 14,
658  Ico_Inactive = 15,
659  Ico_Kick = 16,
660  Ico_Loading = 17,
661  Ico_Confirm = 18,
662  Ico_Team = 19,
663  Ico_AddPlr = 20,
664  Ico_Record = 21,
665  Ico_Chart = 21,
666  Ico_Gfx = 22,
667  Ico_Sound = 23,
668  Ico_Keyboard = 24,
669  Ico_Gamepad = 25,
670  Ico_MouseOff = 26,
671  Ico_MouseOn = 27,
672  Ico_Help = 28,
673  Ico_Definition = 29,
674  Ico_GameRunning = 30,
675  Ico_Lobby = 31,
676  Ico_RuntimeJoin = 32,
677  Ico_Exit = 33,
678  Ico_Close = 34,
679  Ico_Rank1 = 35,
680  Ico_Rank2 = 36,
681  Ico_Rank3 = 37,
682  Ico_Rank4 = 38,
683  Ico_Rank5 = 39,
684  Ico_Rank6 = 40,
685  Ico_Rank7 = 41,
686  Ico_Rank8 = 42,
687  Ico_Rank9 = 43,
688  Ico_OfficialServer = 44,
689  Ico_Surrender = 45,
690  Ico_MeleeLeague = 46,
691  Ico_Ready = 47,
692  Ico_Star = 48,
693  Ico_Disconnect = 49,
694  Ico_View = 50,
695 // Ico_RegJoinOnly = 51,
696  Ico_Ignored = 52,
697 
700 // Ico_Ex_FairCrew = Ico_Extended + 2,
707 // Ico_Ex_FairCrewGray = Ico_Extended + 9,
713  Ico_Ex_Chat = Ico_Extended + 15,
716 
734  };

Function Documentation

bool C4GUI::ExpandHotkeyMarkup ( StdStrBuf sText,
uint32_t &  rcHotkey,
bool  for_tooltip 
)

Definition at line 38 of file C4Gui.cpp.

References StdStrBuf::AppendChar(), StdStrBuf::AppendFormat(), StdStrBuf::getData(), GetNextCharacter(), Inside(), LoadResStr(), LogF(), and StdStrBuf::Take().

Referenced by C4GUI::CheckBox::CheckBox(), C4GUI::ContextMenu::Entry::Entry(), C4GUI::IconButton::IconButton(), C4GUI::Label::SetText(), C4GUI::Button::SetText(), C4GUI::Tabular::Sheet::SetTitle(), and C4GUI::Tabular::Sheet::Sheet().

39  {
40  const char *HotkeyMarkup = (for_tooltip ? "<c ff800000>%s</c>" : "<c ffffff7f>%s</c>");
41 
42  StdStrBuf output;
43 
44  const char *input = sText.getData();
45  rcHotkey = 0;
46 
47  // Iterate over all input characters
48  while (input && *input)
49  {
50  if (*input != '&')
51  {
52  // This will correctly copy UTF-8 chars too
53  output.AppendChar(*input++);
54  }
55  else
56  {
57  ++input;
58  if (*input == '\0' || *input == '&')
59  {
60  // If the ampersand is followed by another ampersand, or it is the last character, copy it verbatimly
61  // Note: This means you can't use an ampersand as an accelerator key.
62  output.AppendChar(*input);
63  }
64  else
65  {
66  // Store the start of the hotkey so we can copy it later
67  const char *accel_start = input;
68  rcHotkey = GetNextCharacter(&input);
69  // Using std::string because StdStrBuf doesn't have a ctor from two iterators
70  std::string accel(accel_start, input);
71  output.AppendFormat(HotkeyMarkup, accel.c_str());
72 
73  // Converting a char code to upper case isn't trivial for unicode. (This should really just use ICU.)
74  if (Inside(rcHotkey, static_cast<uint32_t>('a'), static_cast<uint32_t>('z')))
75  {
76  rcHotkey += static_cast<uint32_t>('A') - 'a';
77  }
78  else if (!Inside(rcHotkey, static_cast<uint32_t>('A'), static_cast<uint32_t>('Z')))
79  {
80  // Warn about accelerator keys outside the basic latin alphabet.
81  LogF(LoadResStr("IDS_ERR_UNSUPPORTED_ACCELERATOR"), accel.c_str(), sText.getData());
82  }
83  }
84  }
85  }
86 
87  if (rcHotkey == 0)
88  {
89  // No accelerator found
90  return false;
91  }
92 
93  sText.Take(output);
94  // done, success
95  return true;
96  }
const char * getData() const
Definition: StdBuf.h:442
uint32_t GetNextCharacter(const char **pszString)
Definition: Standard.h:84
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
void AppendFormat(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:190
void AppendChar(char cChar)
Definition: StdBuf.h:588
void Take(char *pnData)
Definition: StdBuf.h:457
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:260
bool Inside(T ival, U lbound, V rbound)
Definition: Standard.h:43

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::GetScreenHgt ( )
inline

Definition at line 2822 of file C4Gui.h.

References C4GUI::Element::GetBounds(), C4GUI::Screen::GetScreenS(), and C4Rect::Hgt.

Referenced by C4GraphicsSystem::DoSaveScreenshot(), C4Game::InitFullscreenComponents(), C4MapFolderData::Load(), C4Application::PreInit(), C4ViewportList::RecalculateViewports(), and C4Game::SaveGameTitle().

2822 { return Screen::GetScreenS()->GetBounds().Hgt; }

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::GetScreenWdt ( )
inline

Definition at line 2821 of file C4Gui.h.

References C4GUI::Element::GetBounds(), C4GUI::Screen::GetScreenS(), and C4Rect::Wdt.

Referenced by C4GraphicsSystem::DoSaveScreenshot(), C4UpperBoard::Draw(), C4Game::InitFullscreenComponents(), IsSmallInputQuery(), C4MapFolderData::Load(), C4Application::PreInit(), C4ViewportList::RecalculateViewports(), and C4Game::SaveGameTitle().

2821 { return Screen::GetScreenS()->GetBounds().Wdt; }

Here is the call graph for this function:

Here is the caller graph for this function:

float C4GUI::GetZoom ( )
inline

Definition at line 2828 of file C4Gui.h.

References C4GUI::Screen::GetScreenS(), and C4GUI::Screen::GetZoom().

Referenced by C4GUI::Screen::SetMouseInGUI().

2828 { return Screen::GetScreenS()->GetZoom(); }

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::GUISound ( const char *  szSound)

Definition at line 1175 of file C4Gui.cpp.

References Config, C4ConfigSound::FESamples, C4Config::Sound, and StartSoundEffect().

Referenced by C4GUI::ContextMenu::Abort(), C4StartupScenSelDlg::DeselectAll(), C4GUI::ContextMenu::DoOK(), C4StartupNetDlg::DoRefresh(), C4GUI::ScrollBar::MouseInput(), C4GUI::Tabular::MouseInput(), C4GUI::Tabular::MouseLeaveCaptionArea(), C4GameLobby::MainDlg::OnChatInput(), C4GameOptionButtons::OnCommentSet(), C4GameOptionButtons::OnPasswordSet(), C4GUI::ContextMenu::Open(), C4GUI::ListBox::SelectionChanged(), C4GUI::ContextMenu::SelectionChanged(), C4GUI::Button::SetDown(), C4GUI::Button::SetUp(), and C4GUI::CheckBox::ToggleCheck().

1176  {
1177  if (Config.Sound.FESamples)
1178  StartSoundEffect(szSound);
1179  }
C4Config Config
Definition: C4Config.cpp:833
C4SoundInstance * StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance, int32_t iPitch, C4SoundModifier *modifier)
int32_t FESamples
Definition: C4Config.h:129
C4ConfigSound Sound
Definition: C4Config.h:254

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::IsActive ( )
inline

Definition at line 2817 of file C4Gui.h.

References C4GUI::Screen::GetScreenS(), and C4GUI::Screen::IsActive().

Referenced by C4GraphicsSystem::Execute().

2817 { return Screen::GetScreenS()->IsActive(); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::IsExclusive ( )
inline

Definition at line 2818 of file C4Gui.h.

References C4GUI::Screen::GetScreenS(), and C4GUI::Screen::IsExclusive().

2818 { return Screen::GetScreenS()->IsExclusive(); }

Here is the call graph for this function:

bool C4GUI::IsWholeWordSpacer ( unsigned char  c)

Definition at line 350 of file C4GuiEdit.cpp.

Referenced by C4GUI::Edit::GetCurrentWord(), and C4GUI::Edit::MouseInput().

351  {
352  // characters that make up a space between words
353  // the extended characters are all seen a letters, because they vary in different
354  // charsets (danish, french, etc.) and are likely to represent localized letters
355  return !Inside<char>(c, 'A', 'Z')
356  && !Inside<char>(c, 'a', 'z')
357  && !Inside<char>(c, '0', '9')
358  && c!='_' && c<127;
359  }

Here is the caller graph for this function:

DWORD C4GUI::MakeColorReadableOnBlack ( DWORD rdwClr)

Definition at line 98 of file C4Gui.cpp.

References b.

Referenced by C4GUI::MultilineLabel::AddLine(), C4Player::CreateGraphs(), C4MainMenu::DoRefillInternal(), C4GUI::Label::Label(), and C4GUI::Label::SetColor().

99  {
100  // max alpha
101  DWORD dwAlpha = std::max<DWORD>(rdwClr>>24&255, 0xff)<<24;
102  rdwClr &= 0xffffff;
103  // determine brightness
104  // 50% red, 87% green, 27% blue (max 164 * 255)
105  DWORD r=(rdwClr>>16&255), g=(rdwClr>>8&255), b=(rdwClr&255);
106  int32_t iLightness = r*50 + g*87 + b*27;
107  // above 65/164 (*255) is OK
108  if (iLightness < 16575)
109  {
110  int32_t iInc = (16575-iLightness) / 164;
111  // otherwise, lighten
112  rdwClr = (std::min<DWORD>(r+iInc, 255)<<16) | (std::min<DWORD>(g+iInc, 255)<<8) | std::min<DWORD>(b+iInc, 255);
113  }
114  // return color and alpha
115  rdwClr |= dwAlpha;
116  return rdwClr;
117  }
#define b
uint32_t DWORD

Here is the caller graph for this function:

void C4GUI::MouseMove ( int32_t  iButton,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam,
class C4Viewport pVP 
)
inline

Definition at line 2829 of file C4Gui.h.

References C4GUI::Screen::GetScreenS(), and C4GUI::Screen::MouseMove().

Referenced by FullScreenWinProc(), and ViewportWinProc().

2830  { Screen::GetScreenS()->MouseMove(iButton, iX, iY, dwKeyParam, pVP); }

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

Screen C4GUI::TheScreen

Definition at line 1054 of file C4Gui.cpp.

Referenced by C4StartupNetDlg::DoOK(), and C4StartupMainDlg::OnEditorBtn().