/*
* Images.cs - Manages the application icons and bitmaps.
*
* Copyright (C) 2004 - 2011 Andreas Scherrer
*
* This 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.
*
* This software 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 software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
using System;
using System.Drawing;
namespace Level9
{
///
/// Manages the application icons and bitmaps.
///
public class Images
{
// -- Enums ----------------------------------------------------------
///
/// The available image names.
///
public enum Stock
{
///
/// 'About' icon; size: 16 x 16 pixels.
///
About_16x16,
///
/// 'Accept' icon; size: 16 x 16 pixels.
///
Accept_16x16,
///
/// 'Close' icon; size: 16 x 16 pixels.
///
Close_16x16,
///
/// 'Copy' icon; size: 16 x 16 pixels.
///
Copy_16x16,
///
/// 'Dictionary' icon; size: 16 x 16 pixels.
///
Dictionary_16x16,
///
/// 'Down' icon; size: 16 x 16 pixels.
///
Down_16x16,
///
/// 'Execute' icon; size: 16 x 16 pixels.
///
Execute_16x16,
///
/// 'Exit' icon; size: 16 x 16 pixels.
///
Exit_16x16,
///
/// 'Fullscreen' icon; size: 16 x 16 pixels.
///
Fullscreen_16x16,
///
/// 'Help' icon; size: 16 x 16 pixels.
///
Help_16x16,
///
/// 'L9Cut' icon; size: 16 x 16 pixels.
///
L9cut_16x16,
///
/// Blank icon; size: 16 x 16 pixels.
///
Null_16x16,
///
/// 'Open' icon; size: 16 x 16 pixels.
///
Open_16x16,
///
/// 'Pause' icon; size: 16 x 16 pixels.
///
Pause_16x16,
///
/// 'Play' icon; size: 16 x 16 pixels.
///
Play_16x16,
///
/// 'Restore' icon; size: 16 x 16 pixels.
///
Restore_16x16,
///
/// 'Save' icon; size: 16 x 16 pixels.
///
Save_16x16,
///
/// 'Save position' icon; size: 16 x 16 pixels.
///
Savepos_16x16,
///
/// 'Scripts' icon; size: 16 x 16 pixels.
///
Scripts_16x16,
///
/// Script editor: 'Control: Play' icon; size: 16 x 16 pixels.
///
Script_Play_16x16,
///
/// Script editor: 'Control: Stop' icon; size: 16 x 16 pixels.
///
Script_Stop_16x16,
///
/// Script editor: 'Control: Pause' icon; size: 16 x 16 pixels.
///
Script_Pause_16x16,
///
/// Script editor: 'Remove Control' icon; size: 16 x 16 pixels.
///
Script_Remove_Control_16x16,
///
/// Script editor: 'Insert row' icon; size: 16 x 16 pixels.
///
Script_Insert_Row_16x16,
///
/// Script editor: 'Delete row(s)' icon; size: 16 x 16 pixels.
///
Script_Delete_Rows_16x16,
///
/// 'Scrollback' icon; size: 16 x 16 pixels.
///
Scrollback_16x16,
///
/// 'Settings' icon; size: 16 x 16 pixels.
///
Settings_16x16,
///
/// 'Stop' icon; size: 16 x 16 pixels.
///
Stop_16x16,
///
/// 'Trash' icon; size: 16 x 16 pixels.
///
Trash_16x16,
///
/// 'Up' icon; size: 16 x 16 pixels.
///
Up_16x16,
///
/// 'Record' icon (active); size: 16 x 16 pixels.
///
Record_48x48,
///
/// 'Record' icon (inactive); size: 16 x 16 pixels.
///
Record_Grey_48x48,
///
/// 'Colors' icon; size: 48 x 48 pixels.
///
Colors_48x48,
///
/// 'Font' icon; size: 48 x 48 pixels.
///
Font_48x48,
///
/// 'Graphics' icon; size: 48 x 48 pixels.
///
Graphics_48x48,
///
/// 'L9Cut' icon; size: 48 x 48 pixels.
///
L9cut_48x48,
///
/// Splash image; size: 300 x 93 pixels.
///
Splash_300x93,
};
// -- Attributes -----------------------------------------------------
///
/// The image resource names.
///
static string[] resources =
{
"about_16x16",
"accept_16x16",
"close_16x16",
"copy_16x16",
"dictionary_16x16",
"down_16x16",
"execute_16x16",
"exit_16x16",
"fullscreen_16x16",
"help_16x16",
"l9cut_16x16",
"null_16x16",
"open_16x16",
"pause_16x16",
"play_16x16",
"restore_16x16",
"save_16x16",
"savepos_16x16",
"scripts_16x16",
"script_play_16x16",
"script_stop_16x16",
"script_pause_16x16",
"script_remove_control_16x16",
"script_insert_row_16x16",
"script_delete_rows_16x16",
"scrollback_16x16",
"settings_16x16",
"stop_16x16",
"trash_16x16",
"up_16x16",
"record_48x48",
"record_grey_48x48",
"colors_48x48",
"font_48x48",
"graphics_48x48",
"l9cut_48x48",
"splash_300x93",
};
///
/// A list with Image elements.
///
static Image[] images;
// -- Constructors ---------------------------------------------------
///
/// Initializes static members of the Images class.
///
static Images()
{
images = new Image[resources.Length];
try {
System.Resources.ResourceManager manager =
new System.Resources.ResourceManager(typeof(Images));
for (int i = 0; i < resources.Length; i++) {
Image image = (Image)manager.GetObject(resources[i]);
if (image != null) {
images[i] = image;
}
}
}
catch(Exception e) {
ErrorHandler.Handle(typeof(Images),
"Error getting bitmap resource.", e);
}
}
// -- Methods --------------------------------------------------------
///
/// Provides an image for the given name.
///
/// the image name
/// the image, or null if an error occurred
public static Image Get(Stock imageName)
{
return images[(int)imageName];
}
}
}