[go: up one dir, main page]

Menu

[r4]: / trunk / gui / resources.cpp  Maximize  Restore  History

Download this file

159 lines (134 with data), 6.5 kB

  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
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// This file is part of c'mon, a lightweight telephony monitor.
//
// Copyright (C) 2012 Peter Schaefer-Hutter ("THE AUTHOR")
//
// 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 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
// ----------------------------------------------------------------------------
// NOTE: This License does NOT permit incorporating this file (or parts or
// changed versions of it) into proprietary programs that are
// distributed to third-parties in binary form only.
// ----------------------------------------------------------------------------
// You can contact the original author by email at peter.schaefer@gmx.de
// if you need different license-terms or other modifications to c'mon.
// $Revision: 42 $ $Date: 2012-10-23 23:15:58 +0200 (Tue, 23 Oct 2012) $
#include "stdwx.h"
#include "resources.h"
#include "bitmaps.h" // auto generated
#include <cassert>
#ifdef __WXMSW__
#include <wx/msw/msvcrt.h> // redefines the new() operator
#endif
#define wxLOG_COMPONENT "GUI"
// -----------
wxBitmap *LoadMemoryBitmap(const unsigned char* data, int length, wxBitmapType type = wxBITMAP_TYPE_PNG)
{
wxMemoryInputStream stream(data, length);
return new wxBitmap( wxImage( stream, type, -1 ), -1 );
}
#define MEMPNG(a) LoadMemoryBitmap(a, sizeof a)
// -----------
wxFont *RESOURCES::m_pFont[FONT_COUNT];
wxBitmap *RESOURCES::m_pBmp[BMP_COUNT];
wxBrush *RESOURCES::m_pBrush[BRUSH_COUNT];
wxColour RESOURCES::m_Colour[COL_COUNT];
void RESOURCES::init()
{
wxImage::AddHandler(new wxPNGHandler);
m_pFont[FONT_NOTIFICATION] = new wxFont(11, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Calibri"));
m_pFont[FONT_NOTIFICATION_BOLD] = new wxFont(12, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Calibri"));
m_pFont[FONT_NOTIFICATION_SMALL] = new wxFont(9, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Calibri"));
m_pFont[FONT_NOTIFICATION_VERYSMALL] = new wxFont( 8, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Calibri"));
m_pFont[FONT_ABOUT_TITLE] = new wxFont(24, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
m_pFont[FONT_ABOUT_SUBTITLE] = new wxFont(11, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
m_pFont[FONT_ABOUT_TEXT] = new wxFont(9, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
m_pFont[FONT_ABOUT_SUBSCRIPT] = new wxFont(8, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
m_pBrush[BRUSH_NOTIFICATION_BGR] = new wxBrush(
wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK));
m_Colour[COL_NOTIFICATION_BGR] =
wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK);
m_Colour[COL_NOTIFICATION_TEXT] =
wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT);
m_pBmp[BMP_LOGO] = MEMPNG(logo_png);
m_pBmp[BMP_CALL_ALERT] = MEMPNG(appbar_alert_png);
m_pBmp[BMP_CALL_INCOMING] = MEMPNG(appbar_door_enter_png);
m_pBmp[BMP_CALL_OUTGOING] = MEMPNG(appbar_door_leave_png);
m_pBmp[BMP_CALL_ABSENCE] = MEMPNG(appbar_suitcase_png);
m_pBmp[BMP_FOLDER] = MEMPNG(appbar_folder_open_png);
m_pBmp[BMP_WRENCH] = MEMPNG(wrench_png);
m_pBmp[BMP_COG] = MEMPNG(cog_png);
m_pBmp[BMP_VCARD] = MEMPNG(vcard_png);
m_pBmp[BMP_CLOCK] = MEMPNG(time_png);
m_pBmp[BMP_PLUGIN] = MEMPNG(plugin_png);
m_pBmp[BMP_ABOOK] = MEMPNG(book_addresses_png);
m_pBmp[BMP_WORLD] = MEMPNG(world_png);
m_pBmp[BMP_ZOOM] = MEMPNG(zoom_png);
m_pBmp[BMP_PHONE] = MEMPNG(telephone_png);
m_pBmp[BMP_TB_JOURNAL] = MEMPNG(appbar_clock_big_png);
m_pBmp[BMP_TB_CONTACTS] = MEMPNG(appbar_user_big_png);
m_pBmp[BMP_TB_SETTINGS] = MEMPNG(appbar_tools_big_png);
m_pBmp[BMP_TB_ABOUT] = MEMPNG(appbar_information_circle_big_png);
m_pBmp[BMP_TB_LOG] = MEMPNG(appbar_journal_big_png);
m_pBmp[BMP_USER_ADD] = MEMPNG(appbar_user_add_png);
m_pBmp[BMP_USER] = MEMPNG(appbar_user_png);
m_pBmp[BMP_USER_DEL] = MEMPNG(appbar_user_delete_png);
m_pBmp[BMP_AVATAR] = MEMPNG(avatar_male_light_on_gray_96x96_png);
m_pBmp[BMP_PLUS] = MEMPNG(appbar_add_png);
m_pBmp[BMP_MINUS] = MEMPNG(appbar_minus_png);
m_pBmp[BMP_IMPORT] = MEMPNG(appbar_inbox_in_png);
m_pBmp[BMP_EXPORT] = MEMPNG(appbar_inbox_out_png);
m_pBmp[BMP_HANDSET] = MEMPNG(appbar_phone_png);
m_pBmp[BMP_DIAL] = MEMPNG(appbar_dial_png);
m_pBmp[BMP_BULLETDOWN] = MEMPNG(bullet_arrow_down_png);
m_pBmp[BMP_BULLETUP] = MEMPNG(bullet_arrow_up_png);
m_pBmp[BMP_BULLETWARN] = MEMPNG(bullet_error_png);
m_pBmp[BMP_BULLETADD] = MEMPNG(bullet_add_png);
m_pBmp[BMP_BULLETDELETE] = MEMPNG(bullet_delete_png);
m_pBmp[BMP_PHONE_BIG] = MEMPNG(phone_big_png);
m_pBmp[BMP_PAYPAL] = MEMPNG(paypal_png);
m_pBmp[BMP_SHEEP] = MEMPNG(sheepleap_logo_small_png);
}
void RESOURCES::free()
{
for (int i = 0; i < FONT_COUNT; ++i) delete m_pFont[i];
for (int i = 0; i < BMP_COUNT; ++i) delete m_pBmp[i];
for (int i = 0; i < BRUSH_COUNT; ++i) delete m_pBrush[i];
}
wxFont *RESOURCES::getFont(size_t idx)
{
assert(idx < FONT_COUNT);
return m_pFont[idx];
}
const wxBitmap& RESOURCES::getBitmap(size_t idx)
{
assert(idx < BMP_COUNT);
return *(m_pBmp[idx]);
}
wxBrush *RESOURCES::getBrush(size_t idx)
{
assert(idx < BRUSH_COUNT);
return m_pBrush[idx];
}
wxColour RESOURCES::getColour(size_t idx)
{
assert(idx < COL_COUNT);
return m_Colour[idx];
}