1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2014 Eran Ifrah
// file name : clsplashscreen.cpp
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#include "clsplashscreen.h"
#include "autoversion.h"
#include <wx/dcmemory.h>
#include <wx/settings.h>
clSplashScreen* clSplashScreen::g_splashScreen = NULL;
bool clSplashScreen::g_destroyed = false;
clSplashScreen::clSplashScreen(const wxBitmap& bitmap,
long splashStyle,
int milliseconds,
wxWindow* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style)
: wxSplashScreen(bitmap, splashStyle, milliseconds, parent, id, pos, size, style)
{
Bind(wxEVT_CLOSE_WINDOW, &clSplashScreen::OnCloseWindow, this);
}
void clSplashScreen::OnCloseWindow(wxCloseEvent& event)
{
// mark the splash as "destroyed" so we won't destroy it again later
g_destroyed = true;
event.Skip();
}
clSplashScreen::~clSplashScreen() {}
wxBitmap clSplashScreen::CreateSplashScreenBitmap(const wxBitmap& origBmp)
{
wxBitmap bmp;
wxMemoryDC memDC;
bmp = wxBitmap(origBmp.GetWidth(), origBmp.GetHeight());
memDC.SelectObject(bmp);
memDC.SetBrush(wxColour(63, 80, 24));
memDC.SetPen(wxColour(63, 80, 24));
memDC.DrawRectangle(0, 0, origBmp.GetWidth(), origBmp.GetHeight());
memDC.DrawBitmap(origBmp, 0, 0, true);
memDC.SetPen(*wxWHITE);
memDC.SetBrush(*wxTRANSPARENT_BRUSH);
memDC.DrawRectangle(0, 0, origBmp.GetWidth(), origBmp.GetHeight());
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
font.SetPointSize(14);
font.SetWeight(wxFONTWEIGHT_BOLD);
memDC.SetFont(font);
wxString versionString;
versionString << "v" << CODELITE_VERSION_STRING;
wxSize textSize = memDC.GetTextExtent(versionString);
wxCoord textx, texty;
textx = (bmp.GetWidth() - textSize.GetWidth()) - 5;
texty = 5;
memDC.DrawText(versionString, textx, texty);
memDC.SelectObject(wxNullBitmap);
return bmp;
}
|