Gauge.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 » Gauge.cs
//-----------------------------------------------------------------------------
// wx.NET - Gauge.cs
//
// The wxGauge wrapper class.
//
// Written by Bryan Bulten (bryan@bulten.ca)
// (C) 2003 Bryan Bulten
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: Gauge.cs,v 1.11 2007/11/11 14:14:46 harald_meyer Exp $
//-----------------------------------------------------------------------------

using System;
using System.Drawing;
using System.Runtime.InteropServices;

namespace wx{
  public class Gauge :  Control
  {
    public const int wxGA_HORIZONTAL       = Orientation.wxHORIZONTAL;
    public const int wxGA_VERTICAL         = Orientation.wxVERTICAL;
    public const int wxGA_PROGRESSBAR      = 0x0010;
  
    // Windows only
    public const int wxGA_SMOOTH           = 0x0020;
  
    //---------------------------------------------------------------------
    
    [DllImport("wx-c")] static extern IntPtr wxGauge_ctor();
    [DllImport("wx-c")] static extern void   wxGauge_dtor(IntPtr self);
    [DllImport("wx-c")] static extern bool   wxGauge_Create(IntPtr self, IntPtr parent, int id, int range, int posX, int posY, int width, int height, uint style, IntPtr validator, IntPtr name);
    [DllImport("wx-c")] static extern void   wxGauge_SetRange(IntPtr self, int range);
    [DllImport("wx-c")] static extern int    wxGauge_GetRange(IntPtr self);
    [DllImport("wx-c")] static extern void   wxGauge_SetValue(IntPtr self, int pos);
    [DllImport("wx-c")] static extern int    wxGauge_GetValue(IntPtr self);
    [DllImport("wx-c")] static extern void   wxGauge_SetShadowWidth(IntPtr self, int w);
    [DllImport("wx-c")] static extern int    wxGauge_GetShadowWidth(IntPtr self);
    [DllImport("wx-c")] static extern void   wxGauge_SetBezelFace(IntPtr self, int w);
    [DllImport("wx-c")] static extern int    wxGauge_GetBezelFace(IntPtr self);
    [DllImport("wx-c")] static extern bool   wxGauge_AcceptsFocus(IntPtr self);
    [DllImport("wx-c")] static extern bool   wxGauge_IsVertical(IntPtr self);
  
    //---------------------------------------------------------------------
    
    public Gauge(IntPtr wxObject) 
      : base(wxObject) {}

    public Gauge()
      : base(wxGauge_ctor()) { }

    public Gauge(Window parent, int id, int range, Point pos, Size size)
      : this(parent, id, range, pos, size, 0, null, null) { }

    public Gauge(Window parent, int id, int range, Point pos, Size size, uint style)
      : this(parent, id, range, pos, size, style, null, null) { }

    public Gauge(Window parent, int id, int range, Point pos, Size size, uint style, Validator val)
      : this(parent, id, range, pos, size, style, val, null) { }

    public Gauge(Window parent, int id, int range, Point pos, Size size, 
        uint style, Validator validator, string name)
      : base(wxGauge_ctor())
    {  
      if (!Create(parent, id, range, pos, size, style, validator, name)) 
      {
        throw new InvalidOperationException("Failed to create Gauge");
      }
    }
    
    //---------------------------------------------------------------------
    // ctors with self created id
    
    public Gauge(Window parent, int range, Point pos, Size size)
      : this(parent, Window.UniqueID, range, pos, size, 0, null, null) { }

    public Gauge(Window parent, int range, Point pos, Size size, uint style)
      : this(parent, Window.UniqueID, range, pos, size, style, null, null) { }

    public Gauge(Window parent, int range, Point pos, Size size, uint style, Validator val)
      : this(parent, Window.UniqueID, range, pos, size, style, val, null) { }

    public Gauge(Window parent, int range, Point pos, Size size, 
        uint style, Validator validator, string name)
      : this(parent, Window.UniqueID, range, pos, size, style, validator, name) {}
    
    //---------------------------------------------------------------------

    public bool Create(Window parent, int id, int range, Point pos, 
        Size size, uint style, Validator validator, 
        string name)
    {
            wxString wxname = wxString.SafeNew(name);
      return wxGauge_Create(wxObject, Object.SafePtr(parent), id, range, 
          pos.X, pos.Y, size.Width, size.Height, (uint)style, 
          Object.SafePtr(validator), Object.SafePtr(wxname));
    }

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

    public int Range
    {
      get { return wxGauge_GetRange(wxObject); }
      set { wxGauge_SetRange(wxObject, value); }
    }

    //---------------------------------------------------------------------
        
    public int Value
    {
      get { return wxGauge_GetValue(wxObject); }
      set { wxGauge_SetValue(wxObject, value); }
    }

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

    public int ShadowWidth
    {
      get { return wxGauge_GetShadowWidth(wxObject); }
      set { wxGauge_SetShadowWidth(wxObject, value); }
    }

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

    public int BezelFace
    {
      get { return wxGauge_GetBezelFace(wxObject); }
      set { wxGauge_SetBezelFace(wxObject, value); }
    }

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

    public override bool AcceptsFocus()
    {
      return wxGauge_AcceptsFocus(wxObject);
    }
    
    //---------------------------------------------------------------------
    
    public bool IsVertical
    {
      get { return wxGauge_IsVertical(wxObject); }
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.