using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Runtime.InteropServices; namespace Foo.Settings { /// /// Use this to specificy the names of each themed button /// [ComVisible(false)] public static class ButtonNames { public const string BUTTON_UP = "ButtonUp.ico"; public const string BUTTON_DOWN = "ButtonDown.ico"; public const string TOGGLE_UP = "ToggleUp.ico"; } /// /// Button Location Interface for COM /// [Guid("CFE7FDB8-E3F0-45aa-9935-C9A8502FF7DF")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] [ComVisible(true)] public interface IButtonIconLocation { string GetBUTTON_UP(); string GetBUTTON_DOWN(); string GetTOGGLE_UP(); } /// /// Button Theme Settings COM /// [Guid("F82358CD-8521-4d03-AFF9-352491E9A10E")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] [ComVisible(true)] public interface IButtonThemeSetting { int Top(); int Right(); int Height(); int Width(); } /// /// Parent Class for all the Button Shared Code - *MAIN class for everthing basically* /// [ComVisible(false)] public class ButtonSharedCode : IButtonThemeSetting, IButtonIconLocation { private string m_RelativePath = ""; private string m_AssemblyPath = ""; private int m_nTop = 0; private int m_nRight = 0; private int m_nHeight = 0; private int m_nWidth = 0; /// /// Constructor for SharedButtonCode /// /// relative location (folder) inside running application directory /// Theme specific Top location for Button /// Theme specific Right location for Button /// Theme specific Height of Button /// Theme specific Width of Button public ButtonSharedCode(string strRelativeLoc, int nTop, int nRight, int nHeight, int nWidth) { // Theme settings are stored in the Platform Path //m_AssemblyPath = Platform.InstallationSpec.PlatformPath; m_AssemblyPath = Platform.InstallationSpec.InstallPath; // Debug path //m_AssemblyPath = @"C:\_ROOT_\Ooganizer\Ooganizer_1.0\Target\debug\Platform"; m_RelativePath = strRelativeLoc; m_nTop = nTop; m_nRight = nRight; m_nHeight = nHeight; m_nWidth = nWidth; } //// // IButtonThemeSetting //// public int Top() { return m_nTop; } public int Right() { return m_nRight; } public int Height() { return m_nHeight; } public int Width() { return m_nWidth; } //// // IButtonLocation //// public string GetBUTTON_UP() { return (m_AssemblyPath + "\\" + m_RelativePath + "\\" + ButtonNames.BUTTON_UP); } public string GetBUTTON_DOWN() { return (m_AssemblyPath + "\\" + m_RelativePath + "\\" + ButtonNames.BUTTON_DOWN); } public string GetTOGGLE_UP() { return (m_AssemblyPath + "\\" + m_RelativePath + "\\" + ButtonNames.TOGGLE_UP); } } /// /// Classic Button Theme Setting /// [ComVisible(false)] public class ButtonClassicTheme : ButtonSharedCode { public ButtonClassicTheme() : base("Resources\\Themes\\ClassicTheme", 0, 0, 0, 0) { } } /// /// XP Button Theme Setting /// [ComVisible(false)] public class ButtonXPTheme : ButtonSharedCode { public ButtonXPTheme() : base("Resources\\Themes\\XPTheme", 1, 126, 16, 26) { } } /// /// Aero Button Theme Setting /// [ComVisible(false)] public class ButtonAeroTheme : ButtonSharedCode { //public ButtonAeroTheme() : base("Resources\\AeroTheme", 0, 129, 18, 26) { } public ButtonAeroTheme() : base("Resources\\Themes\\AeroTheme", 1, 126, 16, 26) { } } /// /// Vista No Aero Theme Setting /// [ComVisible(false)] public class ButtonVistaNoAeroTheme : ButtonSharedCode { public ButtonVistaNoAeroTheme() : base("Resources\\Themes\\VistaNoAeroTheme", 0, 0, 15, 28) { } } /// /// This class abstracts away all the settings we need for /// ButtonHook to deal with themes and Buttons. (we may consider in the future /// to use this class to retrieve custom settings) /// ~this class is accessible via COM for the W32Button to work /// [Guid("9EEC54A0-77F3-4dcf-8C74-B6720437C59E")] [ClassInterface(ClassInterfaceType.AutoDual)] [ProgId("Ooganizer.ButtonThemeNIconSettingsCCW")] [ComVisible(true)] public class ButtonThemeNIconSettingsCCW { private object m_oButtonThemeObject = null; public ButtonThemeNIconSettingsCCW() { switch (Foo.Platform.Env.Theme) { case Foo.Platform.Env.Themes.Classic: m_oButtonThemeObject = new ButtonClassicTheme(); break; case Foo.Platform.Env.Themes.AeroTheme: m_oButtonThemeObject = new ButtonAeroTheme(); break; case Foo.Platform.Env.Themes.VistaNoAero: m_oButtonThemeObject = new ButtonVistaNoAeroTheme(); break; case Foo.Platform.Env.Themes.XPtheme: m_oButtonThemeObject = new ButtonXPTheme(); break; } } public IButtonThemeSetting GetIButtonThemeInterface() { return (IButtonThemeSetting)m_oButtonThemeObject; } public IButtonIconLocation GetIButtonIconLocation() { return (IButtonIconLocation)m_oButtonThemeObject; } } }