Listbook.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 » Listbook.cs
//-----------------------------------------------------------------------------
// wx.NET - Listbook.cs
//
// The wxListbook 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: Listbook.cs,v 1.9 2007/11/18 19:33:48 harald_meyer Exp $
//-----------------------------------------------------------------------------

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

namespace wx{
  public class ListbookEvent : Event
  {
    [DllImport("wx-c")] static extern IntPtr wxListbookEvent_ctor(int commandType, int id, int nSel, int nOldSel);
    [DllImport("wx-c")] static extern int    wxListbookEvent_GetSelection(IntPtr self);
    [DllImport("wx-c")] static extern void   wxListbookEvent_SetSelection(IntPtr self, int nSel);
    [DllImport("wx-c")] static extern int    wxListbookEvent_GetOldSelection(IntPtr self);
    [DllImport("wx-c")] static extern void   wxListbookEvent_SetOldSelection(IntPtr self, int nOldSel);
    [DllImport("wx-c")] static extern void wxListbookEvent_Veto(IntPtr self);
    [DllImport("wx-c")] static extern void wxListbookEvent_Allow(IntPtr self);
    [DllImport("wx-c")] static extern bool wxListbookEvent_IsAllowed(IntPtr self);    

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

    public ListbookEvent(IntPtr wxObject)
      : base(wxObject) { }

    public ListbookEvent(int commandType, int id, int nSel, int nOldSel)
      : base(wxListbookEvent_ctor(commandType, id, nSel, nOldSel)) { }

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

    public int Selection
    {
      get { return wxListbookEvent_GetSelection(wxObject); }
      set { wxListbookEvent_SetSelection(wxObject, value); }
    }

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

    public int OldSelection
    {
      get { return wxListbookEvent_GetOldSelection(wxObject); }
      set { wxListbookEvent_SetOldSelection(wxObject, value); }
    }
    
    //-----------------------------------------------------------------------------    
    
    public void Veto()
    {
      wxListbookEvent_Veto(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public void Allow()
    {
      wxListbookEvent_Allow(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public bool Allowed
    {
      get { return wxListbookEvent_IsAllowed(wxObject); }
    }    
  }
  
  //-----------------------------------------------------------------------------

  public class Listbook : Control
  {
    public const int wxLB_DEFAULT    = 0;
    public const int wxLB_TOP    = 0x1;
    public const int wxLB_BOTTOM    = 0x2;
    public const int wxLB_LEFT    = 0x4;
    public const int wxLB_RIGHT    = 0x8;
    public const int wxLB_ALIGN_MASK  = 0xf;
    
    //-----------------------------------------------------------------------------

    [DllImport("wx-c")] static extern IntPtr wxListbook_ctor();
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_Create(IntPtr self, IntPtr parent, int id, int x, int y, int width, int height, uint style, IntPtr name);
    [DllImport("wx-c")] static extern int wxListbook_GetSelection(IntPtr self);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_SetPageText(IntPtr self, int n, IntPtr strText);
    [DllImport("wx-c")] static extern IntPtr wxListbook_GetPageText(IntPtr self, int n);
    [DllImport("wx-c")] static extern int wxListbook_GetPageImage(IntPtr self, int n);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_SetPageImage(IntPtr self, int n, int imageId);
    [DllImport("wx-c")] static extern void wxListbook_CalcSizeFromPage(IntPtr self, int widthPage, int heightPage, out int outWidth, out int outHeight);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_InsertPage(IntPtr self, int n, IntPtr page, IntPtr text, bool bSelect, int imageId);
    [DllImport("wx-c")] static extern int wxListbook_SetSelection(IntPtr self, int n);
    [DllImport("wx-c")] static extern void wxListbook_SetImageList(IntPtr self, IntPtr imageList);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_IsVertical(IntPtr self);
    [DllImport("wx-c")] static extern int wxListbook_GetPageCount(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxListbook_GetPage(IntPtr self, int n);
    [DllImport("wx-c")] static extern void wxListbook_AssignImageList(IntPtr self, IntPtr imageList);
    [DllImport("wx-c")] static extern IntPtr wxListbook_GetImageList(IntPtr self);
    [DllImport("wx-c")] static extern void wxListbook_SetPageSize(IntPtr self, ref Size size);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_DeletePage(IntPtr self, int nPage);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_RemovePage(IntPtr self, int nPage);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_DeleteAllPages(IntPtr self);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxListbook_AddPage(IntPtr self, IntPtr page, IntPtr text, bool bselect, int imageId);
    [DllImport("wx-c")] static extern void wxListbook_AdvanceSelection(IntPtr self, bool forward);
    
    //-----------------------------------------------------------------------------

    public Listbook(IntPtr wxObject) 
      : base(wxObject) { }

    public Listbook()
      : base(wxListbook_ctor()) {}

    public Listbook(Window parent, int id)
      : this(parent, id, wxDefaultPosition, wxDefaultSize, 0, "") {}

    public Listbook(Window parent, int id, Point pos)
      : this(parent, id, pos, wxDefaultSize, 0, "") {}

    public Listbook(Window parent, int id, Point pos, Size size)
      : this(parent, id, pos, size, 0, "") {}

    public Listbook(Window parent, int id, Point pos, Size size, uint style)
      : this(parent, id, pos, size, style, "") {}

    public Listbook(Window parent, int id, Point pos, Size size, uint style, string name)
      : base(wxListbook_ctor())
    {
            wxString wxName = wxString.SafeNew(name);
      wxListbook_Create(wxObject, Object.SafePtr(parent), id, pos.X, pos.Y, size.Width, size.Height, style, Object.SafePtr(wxName));
    }
    
    //---------------------------------------------------------------------
    // ctors with self created id
    
    public Listbook(Window parent)
      : this(parent, Window.UniqueID, wxDefaultPosition, wxDefaultSize, 0, "") {}

    public Listbook(Window parent, Point pos)
      : this(parent, Window.UniqueID, pos, wxDefaultSize, 0, "") {}

    public Listbook(Window parent, Point pos, Size size)
      : this(parent, Window.UniqueID, pos, size, 0, "") {}

    public Listbook(Window parent, Point pos, Size size, uint style)
      : this(parent, Window.UniqueID, pos, size, style, "") {}

    public Listbook(Window parent, Point pos, Size size, uint style, string name)
      : this(parent, Window.UniqueID, pos, size, style, name) {}
    
    //-----------------------------------------------------------------------------

    public int Selection
    {
      get { return wxListbook_GetSelection(wxObject); }
      set { wxListbook_SetSelection(wxObject, value); }
    }
    
    //-----------------------------------------------------------------------------

        public bool SetPageText(int n, string strText)
        {
            return this.SetPageText(n, wxString.SafeNew(strText));
        }
    public bool SetPageText(int n, wxString strText)
    {
      return wxListbook_SetPageText(wxObject, n, Object.SafePtr(strText));
    }
    
    //-----------------------------------------------------------------------------

    public string GetPageText(int n)
    {
      return new wxString(wxListbook_GetPageText(wxObject, n), true);
    }
    
    //-----------------------------------------------------------------------------

    public int GetPageImage(int n)
    {
      return wxListbook_GetPageImage(wxObject, n);
    }
    
    //-----------------------------------------------------------------------------

    public bool SetPageImage(int n, int imageId)
    {
      return wxListbook_SetPageImage(wxObject, n, imageId);
    }
    
    //-----------------------------------------------------------------------------

    public Size CalcSizeFromPage(Size sizePage)
    {
            int width, height;
      wxListbook_CalcSizeFromPage(wxObject, sizePage.Width, sizePage.Height, out width, out height);
      return new Size(width, height);
        }
    
    //-----------------------------------------------------------------------------

    
    public bool InsertPage(int n, Window page, string text)
    {
      return InsertPage(n, page, text, false, -1);
    }
    

    public bool InsertPage(int n, Window page, string text, bool bSelect)
    {
      return InsertPage(n, page, text, bSelect, -1);
    }

        public bool InsertPage(int n, Window page, string text, bool bSelect, int imageId)
        {
            return this.InsertPage(n, page, wxString.SafeNew(text), bSelect, imageId);
        }
    public bool InsertPage(int n, Window page, wxString text, bool bSelect, int imageId)
    {
      return wxListbook_InsertPage(wxObject, n, Object.SafePtr(page), Object.SafePtr(text), bSelect, imageId);
    }
    
    //-----------------------------------------------------------------------------

    public ImageList ImageList
    {
      set { wxListbook_SetImageList(wxObject, Object.SafePtr(value)); }
      get { return (ImageList)FindObject(wxListbook_GetImageList(wxObject), typeof(ImageList)); }
    }
    
    //-----------------------------------------------------------------------------

    public bool Vertical
    {
      get { return wxListbook_IsVertical(wxObject); }
    }
    
    //-----------------------------------------------------------------------------

    public int PageCount
    {
      get { return wxListbook_GetPageCount(wxObject); }
    }
    
    //-----------------------------------------------------------------------------

    public Window GetPage(int n)
    {
      return (Window)FindObject(wxListbook_GetPage(wxObject, n), typeof(Window));
    }
    
    //-----------------------------------------------------------------------------

    public void AssignImageList(ImageList imageList)
    {
      wxListbook_AssignImageList(wxObject, Object.SafePtr(imageList));
    }
    
    //-----------------------------------------------------------------------------

    public Size PageSize
    {
      set { wxListbook_SetPageSize(wxObject, ref value); }
    }
    
    //-----------------------------------------------------------------------------

    public bool DeletePage(int nPage)
    {
      return wxListbook_DeletePage(wxObject, nPage);
    }
    
    //-----------------------------------------------------------------------------

    public bool RemovePage(int nPage)
    {
      return wxListbook_RemovePage(wxObject, nPage);
    }
    
    //-----------------------------------------------------------------------------

    public bool DeleteAllPages()
    {
      return wxListbook_DeleteAllPages(wxObject);
    }
    
    //-----------------------------------------------------------------------------

        public bool AddPage(Window page, string text, bool bSelect, int imageId)
        {
            return this.AddPage(page, wxString.SafeNew(text), bSelect, imageId);
        }
    public bool AddPage(Window page, wxString text, bool bSelect, int imageId)
    {
      return wxListbook_AddPage(wxObject, Object.SafePtr(page), Object.SafePtr(text), bSelect, imageId);
    }
    
    //-----------------------------------------------------------------------------

    public void AdvanceSelection(bool forward)
    {
      wxListbook_AdvanceSelection(wxObject, forward);
    }

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

    public event EventListener PageChange
    {
      add { AddCommandListener(Event.wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, ID, value, this); }
      remove { RemoveHandler(value, this); }
    }

    public event EventListener PageChanging
    {
      add { AddCommandListener(Event.wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, ID, value, this); }
      remove { RemoveHandler(value, this); }
    }
  }
}
    
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.