FileDialog.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 » FileDialog.cs
//-----------------------------------------------------------------------------
// wx.NET - FileDialog.cs
//
// The wxFileDialog wrapper class.
//
// Written by Achim Breunig (achim.breunig@web.de)
// (C) 2003 Achim Breunig
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: FileDialog.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 FileDialogStyle
    {
        public const int wxOPEN              = 0x0001;
        public const int wxSAVE              = 0x0002;
        public const int wxOVERWRITE_PROMPT  = 0x0004;
        public const int wxHIDE_READONLY     = 0x0008;
        public const int wxFILE_MUST_EXIST   = 0x0010;
        public const int wxMULTIPLE          = 0x0020;
        public const int wxCHANGE_DIR        = 0x0040;
    }

    public class FileDialog : Dialog
    {
        [DllImport("wx-c")] static extern IntPtr wxFileDialog_ctor(IntPtr parent, IntPtr message, IntPtr defaultDir, IntPtr defaultFile, IntPtr wildcard, uint style, int posX, int posY);
        [DllImport("wx-c")] static extern void   wxFileDialog_dtor(IntPtr self);

        [DllImport("wx-c")] static extern IntPtr wxFileDialog_GetDirectory(IntPtr self);
        [DllImport("wx-c")] static extern void   wxFileDialog_SetDirectory(IntPtr self, IntPtr dir);

        [DllImport("wx-c")] static extern IntPtr wxFileDialog_GetFilename(IntPtr self);
        [DllImport("wx-c")] static extern void   wxFileDialog_SetFilename(IntPtr self, IntPtr filename);

        [DllImport("wx-c")] static extern IntPtr wxFileDialog_GetPath(IntPtr self);
        [DllImport("wx-c")] static extern void   wxFileDialog_SetPath(IntPtr self, IntPtr path);

        [DllImport("wx-c")] static extern void   wxFileDialog_SetFilterIndex(IntPtr self, int filterIndex);
        [DllImport("wx-c")] static extern int    wxFileDialog_GetFilterIndex(IntPtr self);

        [DllImport("wx-c")] static extern IntPtr wxFileDialog_GetWildcard(IntPtr self);
        [DllImport("wx-c")] static extern void   wxFileDialog_SetWildcard(IntPtr self, IntPtr wildcard);

        [DllImport("wx-c")] static extern void   wxFileDialog_SetMessage(IntPtr self, IntPtr message);
        [DllImport("wx-c")] static extern IntPtr wxFileDialog_GetMessage(IntPtr self);

        [DllImport("wx-c")] static extern int    wxFileDialog_ShowModal(IntPtr self);

        [DllImport("wx-c")] static extern uint   wxFileDialog_GetStyle(IntPtr self);
        [DllImport("wx-c")] static extern void   wxFileDialog_SetStyle(IntPtr self, uint style);

        [DllImport("wx-c")] static extern IntPtr wxFileDialog_GetPaths(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxFileDialog_GetFilenames(IntPtr self);

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

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

        public FileDialog(Window parent)
            : this(parent, "Choose a file", "", "", "*.*", 0, wxDefaultPosition) { }

        public FileDialog(Window parent, string message)
            : this(parent, message, "", "", "*.*", 0, wxDefaultPosition) { }

        public FileDialog(Window parent, string message, string defaultDir)
            : this(parent, message, defaultDir, "", "*.*", 0, wxDefaultPosition) { }

        public FileDialog(Window parent, string message, string defaultDir, string defaultFile)
            : this(parent, message, defaultDir, defaultFile, "*.*", 0, wxDefaultPosition) { }

        public FileDialog(Window parent, string message, string defaultDir, string defaultFile, string wildcard)
            : this(parent, message, defaultDir, defaultFile, wildcard, 0, wxDefaultPosition) { }

        public FileDialog(Window parent, string message, string defaultDir, string defaultFile, string wildcard, uint style)
            : this(parent, message, defaultDir, defaultFile, wildcard, style, wxDefaultPosition) { }

        public FileDialog(Window parent, string message, string defaultDir, string defaultFile, string wildcard, uint style, Point pos)
            : this(parent, wxString.SafeNew(message), wxString.SafeNew(defaultDir), wxString.SafeNew(defaultFile), wxString.SafeNew(wildcard), (uint)style, pos.X, pos.Y) { }
        public FileDialog(Window parent, wxString message, wxString defaultDir, wxString defaultFile, wxString wildcard, uint style, int posX, int posY)
            : this(wxFileDialog_ctor(Object.SafePtr(parent), Object.SafePtr(message), Object.SafePtr(defaultDir), Object.SafePtr(defaultFile), Object.SafePtr(wildcard), (uint)style, posX, posY)) { }

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

        public string Directory
        {
            get { return new wxString(wxFileDialog_GetDirectory(wxObject), true); }
            set
            {
                wxString wxValue = wxString.SafeNew(value);
                wxFileDialog_SetDirectory(wxObject, Object.SafePtr(wxValue));
            }
        }

        public string Filename
        {
            get { return new wxString(wxFileDialog_GetFilename(wxObject), true); }
            set
            {
                wxString wxValue = wxString.SafeNew(value);
                wxFileDialog_SetFilename(wxObject, Object.SafePtr(wxValue));
            }
        }

        public string Path
        {
            get { return new wxString(wxFileDialog_GetPath(wxObject), true); }
            set
            {
                wxString wxValue = wxString.SafeNew(value);
                wxFileDialog_SetPath(wxObject, Object.SafePtr(wxValue));
            }
        }

        public int FilterIndex
        {
            set
            {
                wxFileDialog_SetFilterIndex(wxObject, value);
            }
            get { return wxFileDialog_GetFilterIndex(wxObject); }
        }

        public string Message
        {
            set
            {
                wxString wxValue = wxString.SafeNew(value);
                wxFileDialog_SetMessage(wxObject, Object.SafePtr(wxValue));
            }
            get { return new wxString(wxFileDialog_GetMessage(wxObject), true); }
        }

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

        public override int ShowModal()
        {
            return wxFileDialog_ShowModal(wxObject);
        }

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

        public string Wildcard
        {
            get { return new wxString(wxFileDialog_GetWildcard(wxObject), true); }
            set
            {
                wxString wxValue = wxString.SafeNew(value);
                wxFileDialog_SetWildcard(wxObject, Object.SafePtr(wxValue));
            }
        }

        public uint style
        {
            get { return wxFileDialog_GetStyle(this.wxObject); }
            set { wxFileDialog_SetStyle(wxObject, (uint)value); }
        }

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

        public string[] Paths
        {
            get { return new ArrayString(wxFileDialog_GetPaths(this.wxObject), true); }
        }

        public string[] Filenames
        {
            get { return new ArrayString(wxFileDialog_GetFilenames(this.wxObject), true); }
        }
    }
}

www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.