HtmlListBox.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 » HtmlListBox.cs
//-----------------------------------------------------------------------------
// wx.NET - HtmlListBox.cs
//
// The wxHtmlListBox wrapper class.
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 by Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: HtmlListBox.cs,v 1.9 2007/11/18 19:33:48 harald_meyer Exp $
//-----------------------------------------------------------------------------

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

namespace wx{
  public abstract class HtmlListBox : VListBox
  {
    private delegate void Virtual_VoidNoParams();
    private delegate void Virtual_VoidSizeT(int n);
    private delegate IntPtr Virtual_wxStringSizeT(int n);
    private delegate IntPtr Virtual_wxColourwxColour(IntPtr colour);
    private delegate void Virtual_OnDrawItem(IntPtr dc, IntPtr rect, int n);
    private delegate int Virtual_OnMeasureItem(int n);

    private Virtual_VoidNoParams virtual_VoidNoParams;
    private Virtual_VoidSizeT virtual_VoidSizeT;
    private Virtual_wxStringSizeT virtual_wxStringSizeT1;
    private Virtual_wxStringSizeT virtual_wxStringSizeT2;
    private Virtual_wxColourwxColour virtual_wxColourwxColour1;
    private Virtual_wxColourwxColour virtual_wxColourwxColour2;
    private Virtual_OnDrawItem virtual_OnDrawItem1;
    private Virtual_OnDrawItem virtual_OnDrawItem2;
    private Virtual_OnDrawItem virtual_OnDrawItem3;
    private Virtual_OnMeasureItem virtual_OnMeasureItem1;
    private Virtual_OnMeasureItem virtual_OnMeasureItem2;
    
    //-----------------------------------------------------------------------------
    
    [DllImport("wx-c")] static extern IntPtr wxHtmlListBox_ctor2(IntPtr parent, int id, int posX, int posY, int width, int height, uint style, IntPtr name);
    [DllImport("wx-c")] static extern void wxHtmlListBox_RegisterVirtual(IntPtr self,
      Virtual_VoidNoParams refreshAll,
      Virtual_VoidSizeT setItemCount,
      Virtual_wxStringSizeT onGetItem,
      Virtual_wxStringSizeT onGetItemMarkup,
      Virtual_wxColourwxColour getSelectedTextColour,
      Virtual_wxColourwxColour getSelectedTextBgColour,
      Virtual_OnDrawItem onDrawItem,
      Virtual_OnMeasureItem onMeasureItem,
      Virtual_OnDrawItem onDrawSeparator,
      Virtual_OnDrawItem onDrawBackground,
      Virtual_OnMeasureItem onGetLineHeight);
    [DllImport("wx-c")] static extern bool wxHtmlListBox_Create(IntPtr self, IntPtr parent, int id, ref Point pos, ref Size size, uint style, string name);
    [DllImport("wx-c")] static extern void wxHtmlListBox_RefreshAll(IntPtr self);
    [DllImport("wx-c")] static extern void wxHtmlListBox_SetItemCount(IntPtr self, int count);
    [DllImport("wx-c")] static extern IntPtr wxHtmlListBox_OnGetItemMarkup(IntPtr self, int n);
    [DllImport("wx-c")] static extern IntPtr wxHtmlListBox_GetSelectedTextColour(IntPtr self, IntPtr colFg);
    [DllImport("wx-c")] static extern IntPtr wxHtmlListBox_GetSelectedTextBgColour(IntPtr self, IntPtr colBg);
    [DllImport("wx-c")] static extern void wxHtmlListBox_OnDrawItem(IntPtr self, IntPtr dc, ref Rectangle rect, int n);
    [DllImport("wx-c")] static extern int wxHtmlListBox_OnMeasureItem(IntPtr self, int n);
    [DllImport("wx-c")] static extern void wxHtmlListBox_OnSize(IntPtr self, IntPtr evt);
    [DllImport("wx-c")] static extern void wxHtmlListBox_Init(IntPtr self);
    [DllImport("wx-c")] static extern void wxHtmlListBox_CacheItem(IntPtr self, int n);
    
    [DllImport("wx-c")] static extern void wxHtmlListBox_OnDrawSeparator(IntPtr self, IntPtr dc, ref Rectangle rect, int n);
    [DllImport("wx-c")] static extern void wxHtmlListBox_OnDrawBackground(IntPtr self, IntPtr dc, ref Rectangle rect, int n);
    [DllImport("wx-c")] static extern int wxHtmlListBox_OnGetLineHeight(IntPtr self, int line);    
    
    //-----------------------------------------------------------------------------
    
    public HtmlListBox(IntPtr wxObject)
      : base(wxObject) { }
            
    public HtmlListBox()
      : this(null, Window.UniqueID, wxDefaultPosition, wxDefaultSize, 0, "") {}  
      
    /*public HtmlListBox(Window parent)
      : this(parent, -1, wxDefaultPosition, wxDefaultSize, 0, "") {}*/
      
    public HtmlListBox(Window parent, int id)
      : this(parent, id, wxDefaultPosition, wxDefaultSize, 0, "") {}
      
    public HtmlListBox(Window parent, int id, Point pos)
      : this(parent, id, pos, wxDefaultSize, 0, "") {}
      
    public HtmlListBox(Window parent, int id, Point pos, Size size)
      : this(parent, id, pos, size, 0, "") {}
      
    public HtmlListBox(Window parent, int id, Point pos, Size size, uint style)
      : this(parent, id, pos, size, style, "") {}
    
    public HtmlListBox(Window parent, int id, Point pos, Size size, uint style, string name)
            : this(parent, id, pos, size, style, wxString.SafeNew(name))
        {
        }
        public HtmlListBox(Window parent, int id, Point pos, Size size, uint style, wxString name)
            : this(wxHtmlListBox_ctor2(Object.SafePtr(parent), id, pos.X, pos.Y, size.Width, size.Height, (uint)style, Object.SafePtr(name)))
    {
        virtual_VoidNoParams = new Virtual_VoidNoParams(RefreshAll);
        virtual_VoidSizeT = new Virtual_VoidSizeT(SetItemCount);
        virtual_wxStringSizeT1 = new Virtual_wxStringSizeT(OnDoGetItem);
        virtual_wxStringSizeT2 = new Virtual_wxStringSizeT(OnDoGetItemMarkup);
        virtual_wxColourwxColour1 = new Virtual_wxColourwxColour(DoGetSelectedTextColour);
        virtual_wxColourwxColour2 = new Virtual_wxColourwxColour(DoGetSelectedTextBgColour);
        virtual_OnDrawItem1 = new Virtual_OnDrawItem(DoOnDrawItem);
        virtual_OnMeasureItem1 = new Virtual_OnMeasureItem(OnMeasureItem);
        virtual_OnDrawItem2 = new Virtual_OnDrawItem(DoOnDrawSeparator);
        virtual_OnDrawItem3 = new Virtual_OnDrawItem(DoOnDrawBackground);
        virtual_OnMeasureItem2 = new Virtual_OnMeasureItem(OnGetLineHeight);


      wxHtmlListBox_RegisterVirtual(wxObject, virtual_VoidNoParams,
        virtual_VoidSizeT,
        virtual_wxStringSizeT1,
        virtual_wxStringSizeT2,
        virtual_wxColourwxColour1,
        virtual_wxColourwxColour2,
        virtual_OnDrawItem1,
        virtual_OnMeasureItem1,
        virtual_OnDrawItem2,
        virtual_OnDrawItem3,
        virtual_OnMeasureItem2);   
    }
    
    //---------------------------------------------------------------------
    // ctors with self created id
    
    public HtmlListBox(Window parent)
      : this(parent, Window.UniqueID, wxDefaultPosition, wxDefaultSize, 0, "") {}
      
    public HtmlListBox(Window parent, Point pos)
      : this(parent, Window.UniqueID, pos, wxDefaultSize, 0, "") {}
      
    public HtmlListBox(Window parent, Point pos, Size size)
      : this(parent, Window.UniqueID, pos, size, 0, "") {}
      
    public HtmlListBox(Window parent, Point pos, Size size, uint style)
      : this(parent, Window.UniqueID, pos, size, style, "") {}
    
    public HtmlListBox(Window parent, Point pos, Size size, uint style, string name)
      : this(parent, Window.UniqueID, pos, size, style, name) {}
    
    //-----------------------------------------------------------------------------
    
    public new bool Create(Window parent, int id, Point pos, Size size, uint style, string name)
    {
      return wxHtmlListBox_Create(wxObject, Object.SafePtr(parent), id, ref pos, ref size, style, name);
    }
    
    //-----------------------------------------------------------------------------
    
    public override void RefreshAll()
    {
      wxHtmlListBox_RefreshAll(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public virtual void SetItemCount(int count)
    {
      wxHtmlListBox_SetItemCount(wxObject, count);
    }
    
    //-----------------------------------------------------------------------------

        IntPtr OnDoGetItem(int n)
        {
            DisposableStringBox result = new DisposableStringBox(wxString.SafeNew(OnGetItem(n)));
            return result.wxObject;
        }

    protected abstract string OnGetItem(int n);
    
    //-----------------------------------------------------------------------------

        IntPtr OnDoGetItemMarkup(int n)
        {
            DisposableStringBox result = new DisposableStringBox(wxString.SafeNew(OnGetItemMarkup(n)));
            return result.wxObject;
        }
    
    protected virtual string OnGetItemMarkup(int n)
    {
      return new wxString(wxHtmlListBox_OnGetItemMarkup(wxObject, n), true);
    }
    
    //-----------------------------------------------------------------------------
    
    private IntPtr DoGetSelectedTextColour(IntPtr colFg)
    {
      return Object.SafePtr(GetSelectedTextColour((Colour)FindObject(colFg, typeof(Colour))));
    }
    
    protected virtual Colour GetSelectedTextColour(Colour colFg)
    {
      return new Colour(wxHtmlListBox_GetSelectedTextColour(wxObject, Object.SafePtr(colFg)), true);
    }
    
    //-----------------------------------------------------------------------------
    
    private IntPtr DoGetSelectedTextBgColour(IntPtr colBg)
    {
      return Object.SafePtr(GetSelectedTextBgColour((Colour)FindObject(colBg, typeof(Colour))));
    }
    
    protected virtual Colour GetSelectedTextBgColour(Colour colBg)
    {
      return new Colour(wxHtmlListBox_GetSelectedTextBgColour(wxObject, Object.SafePtr(colBg)), true);
    }    
    
    //-----------------------------------------------------------------------------
    
    private void DoOnDrawItem(IntPtr dc, IntPtr rect, int n)
    {
      OnDrawItem((DC)FindObject(dc, typeof(DC)), new wxRect(rect), n);
    }
    
    protected override void OnDrawItem(DC dc, Rectangle rect, int n)
    {
      wxHtmlListBox_OnDrawItem(wxObject, Object.SafePtr(dc), ref rect, n);
    }
    
    //-----------------------------------------------------------------------------
    
    protected override int OnMeasureItem(int n)
    {
      return wxHtmlListBox_OnMeasureItem(wxObject, n);
    }
    
    //-----------------------------------------------------------------------------
    
    protected void OnSize(SizeEvent evt)
    {
      wxHtmlListBox_OnSize(wxObject, Object.SafePtr(evt));
    }
    
    //-----------------------------------------------------------------------------
    
    protected void Init()
    {
      wxHtmlListBox_Init(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    protected void CacheItem(int n)
    {
      wxHtmlListBox_CacheItem(wxObject, n);
    }
    
    //-----------------------------------------------------------------------------
    
    protected override void OnDrawSeparator(DC dc, Rectangle rect, int n)
    {
      wxHtmlListBox_OnDrawSeparator(wxObject, Object.SafePtr(dc), ref rect, n);
    }
    
    private void DoOnDrawSeparator(IntPtr dc, IntPtr rect, int n)
    {
      OnDrawSeparator((DC)FindObject(dc, typeof(DC)), new wxRect(rect), n);
    }
    
    //-----------------------------------------------------------------------------
    
    protected override void OnDrawBackground(DC dc, Rectangle rect, int n)
    {
      wxHtmlListBox_OnDrawBackground(wxObject, Object.SafePtr(dc), ref rect, n);
    }
    
    private void DoOnDrawBackground(IntPtr dc, IntPtr rect, int n)
    {
      OnDrawBackground((DC)FindObject(dc, typeof(DC)), new wxRect(rect), n);
    }
    
    //-----------------------------------------------------------------------------
    
    protected override int OnGetLineHeight(int line)
    {
      return wxHtmlListBox_OnGetLineHeight(wxObject, line);
    }
    
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.