source: trunk/src/openyahtzee.cpp @ 204

Revision 204, 2.5 KB checked in by guyru, 3 years ago (diff)

Center window on startup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/***************************************************************************
2 *   Copyright (C) 2006-2009 by Guy Rutenberg   *
3 *   guyrutenberg@gmail.com   *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 *                                                                         *
10 *   This program is distributed in the hope that it will be useful,       *
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13 *   GNU General Public License for more details.                          *
14 *                                                                         *
15 *   You should have received a copy of the GNU General Public License     *
16 *   along with this program; if not, write to the                         *
17 *   Free Software Foundation, Inc.,                                       *
18 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19 ***************************************************************************/
20
21// This is the main source file for the project. It includes the creation of the main window
22// but all other stuff is done on other files.
23
24/*
25PREFIX and DATA_DIR are passed by the make file to the program and hold the the
26path prefix and datadir path accordingly.
27*/
28
29/*
30 * If PORTABLE is defined, Open Yahtzee will be compiled for the Portable Edition. Add "-DPORTABLE" to the CXXFLAGS when compiling.
31 */
32
33#include "wx/wx.h"
34#include "MainFrame.h"
35// #ifdef WIN32
36//      #include openyahtzee.rc
37// #endif
38
39
40// Declare the application class
41class MyApp : public wxApp
42{
43public:
44        // Called on application startup
45        virtual bool OnInit();
46};
47
48        // Implements MyApp& GetApp()
49        DECLARE_APP(MyApp)
50        // Give wxWidgets the means to create a MyApp object
51        IMPLEMENT_APP(MyApp)
52        // Initialize the application
53
54bool MyApp::OnInit()
55{
56        //load all image handlers
57        ::wxInitAllImageHandlers();
58
59        // Create the main application window
60        main_frame::MainFrame *frame = new main_frame::MainFrame(wxT("Open Yahtzee"), wxDefaultSize, wxDEFAULT_FRAME_STYLE & (~wxRESIZE_BORDER));
61       
62        //Center the frame and show it
63        frame->Centre(true);
64        frame->Show(true);     
65        return true;
66}
Note: See TracBrowser for help on using the repository browser.