OSDN Git Service

Add facility for control of child window placement.
[mingw/wtklite.git] / wtkmain.cpp
1 /*
2  * wtkmain.cpp
3  *
4  * ---------------------------------------------------------------------------
5  *
6  * Implementation of a minimal C++ class framework for use with the
7  * Microsoft Windows Application Programming Interface.
8  *
9  * $Id$
10  *
11  * This file provides the implementation for the standard methods of
12  * the MainWindowMaker class.
13  *
14  * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
15  * Copyright (C) 2012, MinGW.org Project.
16  *
17  * ---------------------------------------------------------------------------
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining a
20  * copy of this software and associated documentation files (the "Software"),
21  * to deal in the Software without restriction, including without limitation
22  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
23  * and/or sell copies of the Software, and to permit persons to whom the
24  * Software is furnished to do so, subject to the following conditions:
25  *
26  * The above copyright notice, this permission notice, and the following
27  * disclaimer shall be included in all copies or substantial portions of
28  * the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
33  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
36  * DEALINGS IN THE SOFTWARE.
37  *
38  * ---------------------------------------------------------------------------
39  *
40  */
41 #define WIN32_LEAN_AND_MEAN
42
43 #include "wtklite.h"
44
45 namespace WTK
46 {
47   int MainWindowMaker::Invoked()
48   {
49     /* Initiate the message processing loop for the main window.
50      */
51     MSG message; int status;
52     while( (status = GetMessage( &message, NULL, 0, 0 )) != 0 )
53     {
54       if( status == -1 )
55         throw( runtime_error( "Unexpected message handler exception" ) );
56
57       else
58       {
59         TranslateMessage( &message );
60         DispatchMessage( &message );
61       }
62     }
63   }
64
65   long MainWindowMaker::OnDestroy()
66   {
67     /* When the top level window is being destroyed, we notify the
68      * message loop that the application is terminating.
69      */
70     PostQuitMessage( EXIT_SUCCESS );
71     return EXIT_SUCCESS;
72   }
73 }
74
75 /* $RCSfile$: end of file */