OSDN Git Service

#32713 初コミット。SVNrev567時点での、ファイルはbranch/140707(ReBuild XGVersion)から移行したもの。
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / SlimDXc_Jun2010(VC++2008) / source / design / RationalConverter.h
1 /*
2 * Copyright (c) 2007-2010 SlimDX Group
3
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22 #pragma once
23
24 using namespace System::ComponentModel;
25
26 namespace SlimDX
27 {
28         value class Rational;
29
30         namespace Design
31         {
32                 /// <summary>
33                 /// Provides a type converter to convert <see cref="Rational"/> objects to and from various 
34                 /// other representations.
35                 /// </summary>
36                 public ref class RationalConverter : System::ComponentModel::ExpandableObjectConverter
37                 {
38                 private:
39                         System::ComponentModel::PropertyDescriptorCollection^ m_Properties;
40
41                 public:
42                         /// <summary>
43                         /// Initializes a new instance of the <see cref="RationalConverter"/> class.
44                         /// </summary>
45                         RationalConverter();
46
47                         /// <summary>
48                         /// Returns whether this converter can convert the object to the specified type, using the specified context.
49                         /// </summary>
50                         /// <param name="context">A <see cref="System::ComponentModel::ITypeDescriptorContext"/> that provides a format context.</param>
51                         /// <param name="destinationType">A <see cref="System::Type"/> that represents the type you want to convert to.</param>
52                         /// <returns><c>true</c> if this converter can perform the conversion; otherwise, <c>false</c>.</returns>
53                         virtual bool CanConvertTo(System::ComponentModel::ITypeDescriptorContext^ context, 
54                                 System::Type^ destinationType) override;
55
56                         /// <summary>
57                         /// Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.
58                         /// </summary>
59                         /// <param name="context">A <see cref="System::ComponentModel::ITypeDescriptorContext"/> that provides a format context.</param>
60                         /// <param name="sourceType">A System::Type that represents the type you want to convert from.</param>
61                         /// <returns><c>true</c> if this converter can perform the conversion; otherwise, <c>false</c>.</returns>
62                         virtual bool CanConvertFrom(System::ComponentModel::ITypeDescriptorContext^ context, 
63                                 System::Type^ sourceType) override;
64
65                         /// <summary>
66                         /// Converts the given value object to the specified type, using the specified context and culture information.
67                         /// </summary>
68                         /// <param name="context">A <see cref="System::ComponentModel::ITypeDescriptorContext"/> that provides a format context.</param>
69                         /// <param name="culture">A <see cref="System::Globalization::CultureInfo"/>. If <c>null</c> is passed, the current culture is assumed.</param>
70                         /// <param name="value">The <see cref="System::Object"/> to convert.</param>
71                         /// <param name="destinationType">A <see cref="System::Type"/> that represents the type you want to convert to.</param>
72                         /// <returns>An <see cref="System::Object"/> that represents the converted value.</returns>
73                         virtual System::Object^ ConvertTo(System::ComponentModel::ITypeDescriptorContext^ context, 
74                                 System::Globalization::CultureInfo^ culture, System::Object^ value, System::Type^ destinationType) override;
75
76                         /// <summary>
77                         /// Converts the given object to the type of this converter, using the specified context and culture information.
78                         /// </summary>
79                         /// <param name="context">A <see cref="System::ComponentModel::ITypeDescriptorContext"/> that provides a format context.</param>
80                         /// <param name="culture">A <see cref="System::Globalization::CultureInfo"/>. If <c>null</c> is passed, the current culture is assumed.</param>
81                         /// <param name="value">The <see cref="System::Object"/> to convert.</param>
82                         /// <returns>An <see cref="System::Object"/> that represents the converted value.</returns>
83                         virtual System::Object^ ConvertFrom(System::ComponentModel::ITypeDescriptorContext^ context, 
84                                 System::Globalization::CultureInfo^ culture, System::Object^ value) override;
85
86                         /// <summary>
87                         /// Returns whether changing a value on this object requires a call to <c>System::ComponentModel::TypeConverter::CreateInstance(System::Collections::IDictionary^)</c>
88                         /// to create a new value, using the specified context.
89                         /// </summary>
90                         /// <param name="context">A <see cref="System::ComponentModel::ITypeDescriptorContext"/> that provides a format context.</param>
91                         /// <returns><c>false</c> if changing a property on this object requires a call to <c>System::ComponentModel::TypeConverter::CreateInstance(System::Collections::IDictionary^)</c> to create a new value; otherwise, <c>false</c>.</returns>
92                         virtual bool GetCreateInstanceSupported(System::ComponentModel::ITypeDescriptorContext^ context) override;
93                 
94                         /// <summary>
95                         /// Creates an instance of the type that this <see cref="System::ComponentModel::TypeConverter"/> is associated with, using the specified context, given a set of property values for the object.
96                         /// </summary>
97                         /// <param name="context">A <see cref="System::ComponentModel::ITypeDescriptorContext"/> that provides a format context.</param>
98                         /// <param name="propertyValues">An <see cref="System::Collections::IDictionary"/> of new property values.</param>
99                         /// <returns>An <see cref="System::Object"/> representing the given <see cref="System::Collections::IDictionary"/>, or <c>null</c> if the object cannot be created.</returns>
100                         virtual System::Object^ CreateInstance(System::ComponentModel::ITypeDescriptorContext^ context, 
101                                 System::Collections::IDictionary^ propertyValues) override;
102
103                         /// <summary>
104                         /// Returns whether this object supports properties, using the specified context.
105                         /// </summary>
106                         /// <param name="context">A <see cref="System::ComponentModel::ITypeDescriptorContext"/> that provides a format context.</param>
107                         /// <returns><c>true</c> if GetProperties should be called to find the properties of this object; otherwise, <c>false</c>.</returns>
108                         virtual bool GetPropertiesSupported(System::ComponentModel::ITypeDescriptorContext^ context) override;
109
110                         /// <summary>
111                         /// Creates an instance of the type that this <see cref="System::ComponentModel::TypeConverter"/> is associated with, using the specified context, given a set of property values for the object.
112                         /// </summary>
113                         /// <param name="context">A <see cref="System::ComponentModel::ITypeDescriptorContext"/> that provides a format context.</param>
114                         /// <param name="value">An <see cref="System::Object"/> that specifies the type of array for which to get properties. </param>
115                         /// <param name="attributes">An array of type <see cref="System::Attribute"/> that is used as a filter.</param>
116                         /// <returns>A <see cref="System::ComponentModel::PropertyDescriptorCollection"/> with the properties that are exposed for this data type, or a null reference (<c>Nothing</c> in Visual Basic) if there are no properties.</returns>
117                         virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties(System::ComponentModel::ITypeDescriptorContext^ context,
118                                 System::Object^ value, array<System::Attribute^>^ attributes ) override;
119                 };
120         }
121 }