Google
Web alhem.net
Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

OptionsDialog Class Reference

#include <OptionsDialog.h>

List of all members.

Public Member Functions

 OptionsDialog (Surface *)
 ~OptionsDialog ()
void OnEvent (surface_event_t *)
void Draw ()
void UpdateData (bool dlg2vars=true)

Private Attributes

Static m_st1
Edit m_host
Static m_st2
Edit m_port
Button m_ok
Button m_cancel


Constructor & Destructor Documentation

OptionsDialog::OptionsDialog Surface *  s  ) 
 

File ......... OptionsDialog.cpp Published .... 2005-02-07 Author ....... grymse@alhem.net

Definition at line 30 of file OptionsDialog.cpp.

References m_cancel, m_host, m_ok, m_port, m_st1, m_st2, OptionsDialog(), and UpdateData().

Referenced by OptionsDialog().

00031 :Dialog(s, 200, 200, 200, 200) 00032 ,m_st1 (this, 5, 5, 150, 25) 00033 ,m_host(this, 5, 35, 150, 25) 00034 ,m_st2 (this, 5, 65, 150, 25) 00035 ,m_port(this, 5, 95, 150, 25) 00036 ,m_ok (this, 5, 125, 90, 25) 00037 ,m_cancel(this,105,125, 90, 25) 00038 { 00039 Uint32 bgcolor = SDL_MapRGBA(GetScreen() -> format, 192, 192, 192, 255); 00040 Uint32 bgcolor2 = SDL_MapRGBA(GetScreen() -> format, 192, 192, 255, 255); 00041 Uint32 txtcolor = SDL_MapRGBA(GetScreen() -> format, 255, 192, 64, 255); 00042 00043 SetText("OptionsDialog"); 00044 CreateTemporaryScreen(); 00045 00046 // SetBgColor(bgcolor); 00047 // SetFgColor(txtcolor); 00048 SetMoveable(true); 00049 00050 m_st1.SetText("Host"); 00051 // m_host.SetBgColor(bgcolor2); 00052 m_st2.SetText("Port"); 00053 // m_port.SetBgColor(bgcolor2); 00054 m_ok.SetText("OK"); 00055 m_ok.SetAnchorDown(true); 00056 // m_ok.SetBgColor(bgcolor2); 00057 m_cancel.SetText("Cancel"); 00058 m_cancel.SetAnchorDown(true); 00059 m_cancel.SetAnchorRight(true); 00060 // m_cancel.SetBgColor(bgcolor2); 00061 00062 UpdateData(false); 00063 00064 AddChild(&m_st1); 00065 AddChild(&m_host); 00066 AddChild(&m_st2); 00067 AddChild(&m_port); 00068 AddChild(&m_ok); 00069 AddChild(&m_cancel); 00070 }

OptionsDialog::~OptionsDialog  ) 
 

Definition at line 73 of file OptionsDialog.cpp.

00074 { 00075 }


Member Function Documentation

void OptionsDialog::Draw  ) 
 

Definition at line 96 of file OptionsDialog.cpp.

00097 { 00098 SDL_Rect *area = GetClientRectPtr(); 00099 Uint32 color = GetBgColor(); 00100 00101 SDL_FillRect(m_screen, area, color); 00102 }

void OptionsDialog::OnEvent surface_event_t *   ) 
 

Definition at line 78 of file OptionsDialog.cpp.

References m_cancel, m_ok, OnEvent(), and UpdateData().

Referenced by OnEvent().

00079 { 00080 if (pstEvent -> type == GUI_EVENT_BUTTON) 00081 { 00082 if (pstEvent -> local_id == m_ok.GetLocalID()) 00083 { 00084 UpdateData(); 00085 OnClose(); 00086 } 00087 else 00088 if (pstEvent -> local_id == m_cancel.GetLocalID()) 00089 { 00090 OnClose(); 00091 } 00092 } 00093 }

void OptionsDialog::UpdateData bool  dlg2vars = true  ) 
 

Definition at line 105 of file OptionsDialog.cpp.

References m_host, m_port, and UpdateData().

Referenced by OnEvent(), OptionsDialog(), and UpdateData().

00106 { 00107 if (dlg2vars) 00108 { 00109 Globals::m_host = m_host.GetLine(); 00110 Globals::m_port = atoi(m_port.GetLine()); 00111 } 00112 else 00113 { 00114 char slask[200]; 00115 m_host.SetLine(Globals::m_host.c_str()); 00116 sprintf(slask,"%d",Globals::m_port); 00117 m_port.SetLine(slask); 00118 } 00119 }


Member Data Documentation

Button OptionsDialog::m_cancel [private]
 

Definition at line 49 of file OptionsDialog.h.

Referenced by OnEvent(), and OptionsDialog().

Edit OptionsDialog::m_host [private]
 

Definition at line 45 of file OptionsDialog.h.

Referenced by OptionsDialog(), and UpdateData().

Button OptionsDialog::m_ok [private]
 

Definition at line 48 of file OptionsDialog.h.

Referenced by OnEvent(), and OptionsDialog().

Edit OptionsDialog::m_port [private]
 

Definition at line 47 of file OptionsDialog.h.

Referenced by OptionsDialog(), and UpdateData().

Static OptionsDialog::m_st1 [private]
 

Definition at line 44 of file OptionsDialog.h.

Referenced by OptionsDialog().

Static OptionsDialog::m_st2 [private]
 

Definition at line 46 of file OptionsDialog.h.

Referenced by OptionsDialog().


The documentation for this class was generated from the following files:
Generated for SDL C++ GUI by doxygen 1.3.6