diff options
author | Ian C <ianc@noddybox.co.uk> | 2005-04-16 01:03:31 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2005-04-16 01:03:31 +0000 |
commit | ba88028c9e6f7a2da0b9bc31e86ca9633613745e (patch) | |
tree | a5c45537df2930eb31a8991d2727e27d2c3f86aa | |
parent | 339682700982983738dd6cdffc387393bb2bd5bb (diff) |
Changed message boxes to take a title string
-rw-r--r-- | src/common.cpp | 26 | ||||
-rw-r--r-- | src/test/GNUmakefile | 10 | ||||
-rw-r--r-- | src/w32dlib/common.h | 24 |
3 files changed, 35 insertions, 25 deletions
diff --git a/src/common.cpp b/src/common.cpp index d0b94a6..9bc1b80 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -36,49 +36,51 @@ void Common::Initialise() // ------------------------------------------------------------ // -void Common::Message(HWND parent, const char *msg) +void Common::Message(HWND parent, const char *title, const char *msg) { - ::MessageBox(parent,msg,"Message",MB_ICONINFORMATION|MB_OK); + ::MessageBox(parent,msg,title ? title:"Message",MB_ICONINFORMATION|MB_OK); } // ------------------------------------------------------------ // -void Common::Message(HWND parent, const std::string& msg) +void Common::Message(HWND parent, const char *title, const std::string& msg) { - ::MessageBox(parent,msg.c_str(),"Message",MB_ICONINFORMATION|MB_OK); + ::MessageBox(parent,msg.c_str(),title ? title:"Message", + MB_ICONINFORMATION|MB_OK); } // ------------------------------------------------------------ // -void Common::Error(HWND parent, const char *msg) +void Common::Error(HWND parent, const char *title, const char *msg) { - ::MessageBox(parent,msg,"Error",MB_ICONSTOP|MB_OK); + ::MessageBox(parent,msg,title ? title:"Error",MB_ICONSTOP|MB_OK); } // ------------------------------------------------------------ // -void Common::Error(HWND parent, const std::string& msg) +void Common::Error(HWND parent, const char *title, const std::string& msg) { - ::MessageBox(parent,msg.c_str(),"Error",MB_ICONSTOP|MB_OK); + ::MessageBox(parent,msg.c_str(),title ? title:"Error",MB_ICONSTOP|MB_OK); } // ------------------------------------------------------------ // -bool Common::Query(HWND parent, const char *msg) +bool Common::Query(HWND parent, const char *title, const char *msg) { - return ::MessageBox(parent,msg,"Question",MB_ICONQUESTION|MB_YESNO)==IDOK; + return ::MessageBox(parent,msg,title ? title:"Question", + MB_ICONQUESTION|MB_YESNO)==IDOK; } // ------------------------------------------------------------ // -bool Common::Query(HWND parent, const std::string& msg) +bool Common::Query(HWND parent, const char *title, const std::string& msg) { - return ::MessageBox(parent,msg.c_str(),"Question", + return ::MessageBox(parent,msg.c_str(),title ? title:"Question", MB_ICONQUESTION|MB_YESNO)==IDOK; } diff --git a/src/test/GNUmakefile b/src/test/GNUmakefile index db4a121..dc0618e 100644 --- a/src/test/GNUmakefile +++ b/src/test/GNUmakefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: GNUmakefile,v 1.3 2005-04-11 23:00:49 ianc Exp $ +# $Id: GNUmakefile,v 1.4 2005-04-16 01:03:31 ianc Exp $ # @@ -34,8 +34,6 @@ OBJECTS = $(SOURCES:.cpp=.o) $(RES).o FLAGS = -I.. -Wall -L.. -g -DEPEND = depend.mak - $(TARGET): $(OBJECTS) ../libw32dlib.a $(CXX) -o $(TARGET) $(FLAGS) $(OBJECTS) -mwindows -mconsole $(LIB) @@ -51,11 +49,9 @@ $(RES).o: $(RES).rc $(RES).h clean: -rm -f $(TARGET) $(OBJECTS) depend.mak -depend: $(DEPEND) - -$(DEPEND): $(SOURCES) $(HEADERS) GNUMakefile +depend: @echo Dependencies updated.... - $(CXX) -MM $(FLAGS) $(SOURCES) > $(DEPEND) + $(CXX) -MM $(FLAGS) $(SOURCES) > depend.mak # END OF FILE diff --git a/src/w32dlib/common.h b/src/w32dlib/common.h index 7c0482c..7f49c08 100644 --- a/src/w32dlib/common.h +++ b/src/w32dlib/common.h @@ -43,51 +43,63 @@ namespace W32DLib /// \brief Displays a message box. /// /// \param parent Parent window (NULL for none) + /// \param title The title to display (NULL for default "Message") /// \param msg The message to display. /// - static void Message(HWND parent, const char *msg); + static void Message(HWND parent, const char *title, + const char *msg); /// \brief Displays a message box. /// /// \param parent Parent window (NULL for none) + /// \param title The title to display (NULL for default "Message") /// \param msg The message to display. /// - static void Message(HWND parent, const std::string& msg); + static void Message(HWND parent, const char *title, + const std::string& msg); /// \brief Displays an error message box. /// /// \param parent Parent window (NULL for none) + /// \param title The title to display (NULL for default "Error") /// \param msg The error message to display. /// - static void Error(HWND parent, const char *msg); + static void Error(HWND parent, const char *title, + const char *msg); /// \brief Displays an error message box. /// /// \param parent Parent window (NULL for none) + /// \param title The title to display (NULL for default "Error") /// \param msg The error message to display. /// - static void Error(HWND parent, const std::string& msg); + static void Error(HWND parent, const char *title, + const std::string& msg); /// \brief Displays a Yes/No message box. /// /// \param parent Parent window (NULL for none) + /// \param title The title to display (NULL for default "Question") /// \param msg The message to display. /// \return True if the user selects Yes. /// - static bool Query(HWND parent, const char *msg); + static bool Query(HWND parent, const char *title, + const char *msg); /// \brief Displays a Yes/No message box. /// /// \param parent Parent window (NULL for none) + /// \param title The title to display (NULL for default "Question") /// \param msg The message to display. /// \return True if the user selects Yes. /// - static bool Query(HWND parent, const std::string& msg); + static bool Query(HWND parent, const char *title, + const std::string& msg); /// \brief Requests a file to open. |