Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

messagebox.cpp

Go to the documentation of this file.
00001 /*
00002         ClanGUI, copyrights by various people. Have a look in the CREDITS file.
00003         
00004         This sourcecode is distributed using the Library GNU Public Licence,
00005         version 2 or (at your option) any later version. Please read LICENSE
00006         for details.
00007 */
00008 
00009 #include "precomp.h"
00010 #include <string>
00011 #include "../API/GUI/messagebox.h"
00012 #include "../API/GUI/component_options.h"
00013 #include "../API/GUI/stylemanager.h"
00014 #include "../API/GUI/gui_manager.h"
00015 #include "messagebox_generic.h"
00016 
00018 // Construction:
00019 
00020 CL_MessageBox::CL_MessageBox(
00021         const CL_ComponentOptions &options,
00022         CL_Component *parent,
00023         CL_StyleManager *style)
00024 :
00025         CL_Window(options, parent, style),
00026         impl(NULL)
00027 {
00028         impl = new CL_MessageBox_Generic(this, options, get_style_manager());
00029 }
00030 
00031 CL_MessageBox::CL_MessageBox(
00032         const std::string &title,
00033         const std::string &text,
00034         const std::string &button1,
00035         const std::string &button2,
00036         const std::string &button3,
00037         CL_Component *parent,
00038         CL_StyleManager *style)
00039 :
00040         CL_Window(
00041                 CL_MessageBox_Generic::create_options(title, text, button1, button2, button3),
00042                 parent,
00043                 style),
00044         impl(NULL)
00045 {
00046         CL_ComponentOptions options = CL_MessageBox_Generic::create_options(
00047                 title, text, button1, button2, button3);
00048         impl = new CL_MessageBox_Generic(this, options, get_style_manager());
00049 }
00050 
00051 CL_MessageBox::~CL_MessageBox()
00052 {
00053         delete impl;
00054 }
00055 
00056 void CL_MessageBox::info(
00057         const std::string &title,
00058         const std::string &text,
00059         CL_GUIManager *gui)
00060 {
00061         CL_MessageBox message(title, text, "Ok", "", "", NULL, gui->get_style_manager());
00062         message.run(gui);
00063 }
00064 
00065 int CL_MessageBox::info(
00066         const std::string &title,
00067         const std::string &text,
00068         const std::string &button1,
00069         const std::string &button2,
00070         const std::string &button3,
00071         CL_GUIManager *gui)
00072 {
00073         CL_MessageBox message(title, text, button1, button2, button3, NULL, gui->get_style_manager());
00074         message.run(gui);
00075         return message.get_result_button();
00076 }
00077 
00079 // Attributes:
00080 
00081 const std::string &CL_MessageBox::get_text() const
00082 {
00083         return impl->text;
00084 }
00085 
00086 int CL_MessageBox::get_result_button() const
00087 {
00088         return impl->result_button;
00089 }
00090 
00092 // Operations:
00093 
00094 void CL_MessageBox::set_text(const std::string &text)
00095 {
00096         impl->text = text;
00097 }
00098 
00100 // Signals:
00101 
00102 CL_Signal_v0 &CL_MessageBox::sig_button1()
00103 {
00104         return impl->sig_button[0];
00105 }
00106 
00107 CL_Signal_v0 &CL_MessageBox::sig_button2()
00108 {
00109         return impl->sig_button[1];
00110 }
00111 
00112 CL_Signal_v0 &CL_MessageBox::sig_button3()
00113 {
00114         return impl->sig_button[2];
00115 }

Generated at Wed Apr 4 19:54:01 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001