Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
main.cpp: Exit on -h and load application icon.
[xestiacalendar/.git] / source / main.cpp
1 // main.cpp - Main subroutine (application start).
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/> 
19 #include <stdlib.h>
21 #include <wx/wx.h>
22 #include <wx/icon.h>
23 #include <wx/mstream.h>
24 #include <wx/cmdline.h>
25 #include <wx/wxprec.h>
26 #include <wx/filename.h>
27 #include <curl/curl.h>
29 #include "version.h"
30 #include "bitmaps.h"
31 #include "forms/main/frmMain.h"
33 class XestiaCALApp: public wxApp
34 {
35     virtual bool OnInit();
36 };
38 IMPLEMENT_APP(XestiaCALApp);
40 bool XestiaCALApp::OnInit()
41 {
43         wxInitAllImageHandlers();
44         
45         static const wxCmdLineEntryDesc g_cmdLineDesc [] =
46         {
47                 { wxCMD_LINE_SWITCH, "h", "help", "Displays help on command line parameters",
48                         wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
49                 { wxCMD_LINE_SWITCH, "v", "version", "Displays version number",
50                         wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
51                 { wxCMD_LINE_NONE }
52         };
53         
54         // Setup the locale.
56         wxLocale locale;
57         locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
58         
59         wxCmdLineParser XCALArgs (g_cmdLineDesc, argc, argv);
60         XCALArgs.Parse();
61         
62         if (XCALArgs.Found(wxT("h"))){
63     
64                 // Print out the list of help commands.
65     
66                 return false;
67     
68         }
69         
70         if (XCALArgs.Found(wxT("v"))){
71     
72                 // Print out the version number.    
74                 wxPuts(XSDCAL_VERSION);
75                 return false;
76     
77         }
78         
79         frmMain *frame = new frmMain( NULL );
80         
81         wxMemoryInputStream istream(bigimgs_appicon48_png, sizeof(bigimgs_appicon48_png));
82         wxImage bigimgs_appicon48i(istream, wxBITMAP_TYPE_PNG);
83         wxBitmap appiconbmp(bigimgs_appicon48i, -1);    
84         wxIcon appicon;
85     
86         appicon.CopyFromBitmap(appiconbmp);
87         
88         frame->SetIcon(appicon);
89         frame->Show(true);
90         
91         SetTopWindow(frame);
92         
93         return true;
94         
95 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy