Colour.cs :  » GUI » wx-NET » wx » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » GUI » wx NET 
wx NET » wx » Colour.cs
//-----------------------------------------------------------------------------
// wx.NET - Colour.cs
//
// The wxColour wrapper class.
//
// Written by Jason Perkins (jason@379.com)
// (C) 2003 by 379, Inc.
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: Colour.cs,v 1.14 2007/11/11 14:14:45 harald_meyer Exp $
//-----------------------------------------------------------------------------

using System;
using System.Runtime.InteropServices;

namespace wx{
        public class Colour : Object
        {
                [DllImport("wx-c")] static extern IntPtr wxColour_ctor();
                [DllImport("wx-c")] static extern IntPtr wxColour_ctorByName(IntPtr name);
                [DllImport("wx-c")] static extern IntPtr wxColour_ctorByParts(byte red, byte green, byte blue);
                [DllImport("wx-c")] static extern void   wxColour_dtor(IntPtr self);
                //[DllImport("wx-c")] static extern void   wxColour_RegisterDisposable(IntPtr self, Virtual_Dispose onDispose);

                [DllImport("wx-c")] static extern byte   wxColour_Red(IntPtr self);
                [DllImport("wx-c")] static extern byte   wxColour_Blue(IntPtr self);
                [DllImport("wx-c")] static extern byte   wxColour_Green(IntPtr self);

                [DllImport("wx-c")] static extern bool   wxColour_Ok(IntPtr self);
                [DllImport("wx-c")] static extern void   wxColour_Set(IntPtr self, byte red, byte green, byte blue);
                [DllImport("wx-c")] static extern void   wxColour_SetFromColour(IntPtr self, IntPtr src);
                
                [DllImport("wx-c")] static extern IntPtr wxColour_CreateByName(string name);

                //---------------------------------------------------------------------

                public static Colour wxBLACK       = new Colour("Black");
                public static Colour wxWHITE       = new Colour("White");
                public static Colour wxRED         = new Colour("Red");
                public static Colour wxBLUE        = new Colour("Blue");
                public static Colour wxGREEN       = new Colour("Green");
                public static Colour wxCYAN        = new Colour("Cyan");
                public static Colour wxLIGHT_GREY  = new Colour("Light Gray");

                //---------------------------------------------------------------------

                public Colour(IntPtr wxObject)
                        : base(wxObject) 
                {
                }
                        
                internal Colour(IntPtr wxObject, bool memOwn)
                        : base(wxObject)
                { 
                        this.memOwn = memOwn;
                }

                public Colour() 
                        : this(wxColour_ctor(), true) 
                { 
                }

                public Colour(string name)
                    : this(wxString.SafeNew(name.ToUpper()))
                {
                }
                public Colour(wxString name)
                        : this(wxColour_ctorByName(Object.SafePtr(name)), true) 
                { 
                        /*virtual_Dispose = new Virtual_Dispose(VirtualDispose);
                        wxColour_RegisterDisposable(wxObject, virtual_Dispose);*/
                }

                public Colour(byte red, byte green, byte blue)
                        : this(wxColour_ctorByParts(red, green, blue), true) 
                { 
                        /*virtual_Dispose = new Virtual_Dispose(VirtualDispose);
                        wxColour_RegisterDisposable(wxObject, virtual_Dispose);*/
                }

                ~Colour()
                {
                        Dispose();
                }
                
                //---------------------------------------------------------------------

                public override void Dispose()
                {
                        if ((this != Colour.wxBLACK) && (this != Colour.wxWHITE) &&
                                (this != Colour.wxRED) && (this != Colour.wxBLUE) &&
                                        (this != Colour.wxGREEN) && (this != Colour.wxCYAN) &&
                                                (this != Colour.wxLIGHT_GREY)) 
                        {
                                Dispose(true);
                        }
                }

                //---------------------------------------------------------------------

                public byte Red
                {
                        get { return wxColour_Red(wxObject); }
                }

                public byte Green
                {
                        get { return wxColour_Green(wxObject); }
                }

                public byte Blue
                {
                        get { return wxColour_Blue(wxObject); }
                }

                //---------------------------------------------------------------------

                public bool Ok()
                {
                        return wxColour_Ok(wxObject);
                }

                public void Set(byte red, byte green, byte blue)
                {
                        wxColour_Set(wxObject, red, green, blue);
                }


                internal void Set(IntPtr src)
                {
                        wxColour_SetFromColour(wxObject, src);
                }

                public void Set(Colour src)
                {
                        Set(src.wxObject);
                }

                //---------------------------------------------------------------------
                
                #if __WXGTK__
                public static Colour CreateByName(string name)
                {
                    wxString wxName=wxString.NewFrom(name);
                    return new Colour(wxColour_CreateByName(Object.SafePtr(wxName)), true);
                }
                #endif
       }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.