~ubuntu-branches/ubuntu/raring/monodevelop/raring

« back to all changes in this revision

Viewing changes to src/addins/MacPlatform/Framework/ComponentManager.cs

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2011-06-29 06:56:25 UTC
  • mfrom: (1.8.1 upstream) (1.3.11 experimental)
  • Revision ID: james.westby@ubuntu.com-20110629065625-7xx19c4vb95j65pl
Tags: 2.5.92+dfsg-1ubuntu1
* Merge from Debian experimental:
 - Dropped patches & changes to debian/control for Moonlight
   + debian/patches/remove_support_for_moonlight.patch,
   + debian/patches/dont_add_moonlight_to_core_addins.patch,
 - Remaining patches:
   + debian/patches/no_appmenu:

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// 
2
 
// ComponentManager.cs
3
 
//  
4
 
// Author:
5
 
//       Michael Hutchinson <mhutchinson@novell.com>
6
 
// 
7
 
// Copyright (c) 2010 Novell, Inc.
8
 
// 
9
 
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
 
// of this software and associated documentation files (the "Software"), to deal
11
 
// in the Software without restriction, including without limitation the rights
12
 
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
 
// copies of the Software, and to permit persons to whom the Software is
14
 
// furnished to do so, subject to the following conditions:
15
 
// 
16
 
// The above copyright notice and this permission notice shall be included in
17
 
// all copies or substantial portions of the Software.
18
 
// 
19
 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
 
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
 
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
 
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
 
// THE SOFTWARE.
26
 
 
27
 
using System;
28
 
using System.Runtime.InteropServices;
29
 
 
30
 
namespace OSXIntegration.Framework
31
 
{
32
 
        // http://developer.apple.com/mac/library/documentation/Carbon/Reference/Component_Manager/Reference/reference.html
33
 
        
34
 
        static class ComponentManager
35
 
        {
36
 
                [DllImport (Carbon.CarbonLib)]
37
 
                public static extern ComponentInstance OpenDefaultComponent (OSType componentType, OSType componentSubType);
38
 
                
39
 
                [DllImport (Carbon.CarbonLib)]
40
 
                public static extern ComponentErr CloseComponent (ComponentInstance componentInstance);
41
 
                
42
 
                [DllImport (Carbon.CarbonLib)]
43
 
                public static extern int GetComponentInstanceError (ComponentInstance componentInstance); //returns an oserr
44
 
        }
45
 
        
46
 
        struct ComponentInstance {
47
 
                IntPtr Handle;
48
 
                public bool IsNull {
49
 
                        get { return Handle == IntPtr.Zero; }
50
 
                }
51
 
        }
52
 
        
53
 
        enum ComponentResult : long
54
 
        {
55
 
                InvalidComponentId = -3000,
56
 
                ValidInstancesExist = -3001,
57
 
                ComponentNotCaptured = -3002,
58
 
                ComponentDontRegister = -3003,
59
 
                UnresolvedComponentDll = -3004,
60
 
                RetryComponentRegistration =-3005,
61
 
                BadComponentSelector     = 0x80008002,
62
 
                BadComponentInstance     = 0x80008001
63
 
        }
64
 
        
65
 
        enum ComponentErr : int //this is an OSErr
66
 
        {
67
 
                InvalidComponentId = -3000,
68
 
                ValidInstancesExist = -3001,
69
 
                ComponentNotCaptured = -3002,
70
 
                ComponentDontRegister = -3003,
71
 
                UnresolvedComponentDll = -3004,
72
 
                RetryComponentRegistration =-3005,
73
 
                BadComponentSelector     = -32766, // 0x80008002,
74
 
                BadComponentInstance     = -32767, //0x80008001
75
 
        }
76
 
        
77
 
        [Flags]
78
 
        enum DefaultComponent {
79
 
                Identical = 0,
80
 
                AnyFlags = 1,
81
 
                AnyManufacturer = 2,
82
 
                AnySubType = 4,
83
 
                AnyFlagsAnyManufacturer = (AnyFlags & AnyManufacturer),
84
 
                AnyFlagsAnyManufacturerAnySubType =  (AnyFlags & AnyManufacturer & AnySubType)
85
 
        }
86
 
        
87
 
        enum ComponentRequest {
88
 
                OpenSelect = -1,
89
 
                CloseSelect = -2,
90
 
                CanDoSelect = -3,
91
 
                VersionSelect = -4,
92
 
                RegisterSelect = -5,
93
 
                TargetSelect = -6,
94
 
                UnregisterSelect = -7,
95
 
                GetMPWorkFunctionSelect = -8,
96
 
                ExecuteWiredActionSelect = -9,
97
 
                GetPublicResourceSelect = -10
98
 
        }
99
 
}
100