From 7740ebb87b8aa440f10095a77fea5d781844dd97 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 17 Apr 2005 00:34:01 +0000 Subject: Added Registry class and default message box titles --- src/common.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/common.cpp') diff --git a/src/common.cpp b/src/common.cpp index 9bc1b80..59c7695 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -25,6 +25,10 @@ namespace W32DLib { +static const char *def_msg="Message"; +static const char *def_err="Error"; +static const char *def_qry="Error"; + // ------------------------------------------------------------ // void Common::Initialise() @@ -34,11 +38,21 @@ void Common::Initialise() } +// ------------------------------------------------------------ +// +void Common::MessageTitle(const char *title) +{ + def_msg=title; + def_err=title; + def_qry=title; +} + + // ------------------------------------------------------------ // void Common::Message(HWND parent, const char *title, const char *msg) { - ::MessageBox(parent,msg,title ? title:"Message",MB_ICONINFORMATION|MB_OK); + ::MessageBox(parent,msg,title ? title:def_msg,MB_ICONINFORMATION|MB_OK); } @@ -46,7 +60,7 @@ void Common::Message(HWND parent, const char *title, const char *msg) // void Common::Message(HWND parent, const char *title, const std::string& msg) { - ::MessageBox(parent,msg.c_str(),title ? title:"Message", + ::MessageBox(parent,msg.c_str(),title ? title:def_msg, MB_ICONINFORMATION|MB_OK); } @@ -55,7 +69,7 @@ void Common::Message(HWND parent, const char *title, const std::string& msg) // void Common::Error(HWND parent, const char *title, const char *msg) { - ::MessageBox(parent,msg,title ? title:"Error",MB_ICONSTOP|MB_OK); + ::MessageBox(parent,msg,title ? title:def_err,MB_ICONSTOP|MB_OK); } @@ -63,7 +77,7 @@ void Common::Error(HWND parent, const char *title, const char *msg) // void Common::Error(HWND parent, const char *title, const std::string& msg) { - ::MessageBox(parent,msg.c_str(),title ? title:"Error",MB_ICONSTOP|MB_OK); + ::MessageBox(parent,msg.c_str(),title ? title:def_err,MB_ICONSTOP|MB_OK); } @@ -71,7 +85,7 @@ void Common::Error(HWND parent, const char *title, const std::string& msg) // bool Common::Query(HWND parent, const char *title, const char *msg) { - return ::MessageBox(parent,msg,title ? title:"Question", + return ::MessageBox(parent,msg,title ? title:def_qry, MB_ICONQUESTION|MB_YESNO)==IDOK; } @@ -80,7 +94,7 @@ bool Common::Query(HWND parent, const char *title, const char *msg) // bool Common::Query(HWND parent, const char *title, const std::string& msg) { - return ::MessageBox(parent,msg.c_str(),title ? title:"Question", + return ::MessageBox(parent,msg.c_str(),title ? title:def_qry, MB_ICONQUESTION|MB_YESNO)==IDOK; } -- cgit v1.2.3