add the 2.1-bootstrap dir to MONO_PATH when running smcs
[moon.git] / src / grid.h
blob73089ffa6c252d9d46366fe96f320344390573ee
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * grid.h
5 * Copyright 2008 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
8 *
9 */
11 #ifndef __MOON_GRID_H__
12 #define __MOON_GRID_H__
14 #include <glib.h>
15 #include "panel.h"
17 /* @IncludeInKinds */
18 /* @Namespace=System.Windows */
19 struct GridLength {
20 public:
21 double val;
22 GridUnitType type;
24 GridLength () {
25 val = 0;
26 type = GridUnitTypeAuto;
29 GridLength (double v, GridUnitType t)
31 val = v;
32 type = t;
36 /* @Namespace=System.Windows.Controls */
37 class ColumnDefinition : public DependencyObject {
38 protected:
39 virtual ~ColumnDefinition ();
41 public:
42 /* @PropertyType=double,DefaultValue=INFINITY,GenerateAccessors */
43 const static int MaxWidthProperty;
44 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
45 const static int MinWidthProperty;
46 /* @PropertyType=GridLength,DefaultValue=GridLength (1.0\, GridUnitTypeStar),GenerateAccessors */
47 const static int WidthProperty;
48 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors,ManagedSetterAccess=Private,ManagedFieldAccess=Private */
49 const static int ActualWidthProperty;
51 /* @GenerateCBinding,GeneratePInvoke */
52 ColumnDefinition ();
54 // property accessors
55 double GetActualWidth ();
56 void SetActualWidth (double value);
58 double GetMaxWidth();
59 void SetMaxWidth (double value);
61 double GetMinWidth();
62 void SetMinWidth (double value);
64 GridLength* GetWidth();
65 void SetWidth (GridLength *value);
68 /* @Namespace=System.Windows.Controls */
69 class RowDefinition : public DependencyObject {
70 protected:
71 virtual ~RowDefinition ();
73 public:
74 /* @PropertyType=GridLength,DefaultValue=GridLength (1.0\, GridUnitTypeStar),GenerateAccessors */
75 const static int HeightProperty;
76 /* @PropertyType=double,DefaultValue=INFINITY,GenerateAccessors */
77 const static int MaxHeightProperty;
78 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
79 const static int MinHeightProperty;
80 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors,ManagedSetterAccess=Private,ManagedFieldAccess=Private */
81 const static int ActualHeightProperty;
83 /* @GenerateCBinding,GeneratePInvoke */
84 RowDefinition ();
86 // property accessors
87 double GetActualHeight ();
88 void SetActualHeight (double value);
90 double GetMaxHeight();
91 void SetMaxHeight (double value);
93 double GetMinHeight();
94 void SetMinHeight (double value);
96 GridLength* GetHeight();
97 void SetHeight (GridLength *value);
100 /* @Namespace=System.Windows.Controls */
101 class ColumnDefinitionCollection : public DependencyObjectCollection {
102 protected:
103 virtual ~ColumnDefinitionCollection ();
105 virtual bool AddedToCollection (Value *value, MoonError *error);
107 public:
108 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Internal */
109 ColumnDefinitionCollection ();
111 virtual Type::Kind GetElementType () { return Type::COLUMNDEFINITION; }
115 /* @Namespace=System.Windows.Controls */
116 class RowDefinitionCollection : public DependencyObjectCollection {
117 protected:
118 virtual ~RowDefinitionCollection ();
120 virtual bool AddedToCollection (Value *value, MoonError *error);
122 public:
123 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Internal */
124 RowDefinitionCollection ();
126 virtual Type::Kind GetElementType () { return Type::ROWDEFINITION; }
130 /* @Namespace=System.Windows.Controls */
131 class Grid : public Panel {
132 Size magic;
134 protected:
135 virtual ~Grid ();
136 virtual void PostRender (cairo_t *cr, Region *region, bool front_to_back);
138 public:
139 /* @PropertyType=gint32,DefaultValue=0,Attached,GenerateAccessors,Validator=PositiveIntValidator */
140 const static int ColumnProperty;
141 /* @PropertyType=ColumnDefinitionCollection,AutoCreateValue,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
142 const static int ColumnDefinitionsProperty;
143 /* @PropertyType=gint32,DefaultValue=1,Attached,GenerateAccessors,Validator=IntGreaterThanZeroValidator */
144 const static int ColumnSpanProperty;
145 /* @PropertyType=gint32,DefaultValue=0,Attached,GenerateAccessors,Validator=PositiveIntValidator */
146 const static int RowProperty;
147 /* @PropertyType=RowDefinitionCollection,AutoCreateValue,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
148 const static int RowDefinitionsProperty;
149 /* @PropertyType=gint32,DefaultValue=1,Attached,GenerateAccessors,Validator=IntGreaterThanZeroValidator */
150 const static int RowSpanProperty;
153 * NOTE: The ShowGridLines property defaults to false but appears
154 * to be uninitialized before InitializeComponents is called
155 * causing the current moon-unit test to fail.
157 /* @PropertyType=bool,DefaultValue=false,GenerateAccessors */
158 const static int ShowGridLinesProperty;
160 /* @GenerateCBinding,GeneratePInvoke */
161 Grid ();
163 virtual void OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error);
164 virtual void OnCollectionChanged (Collection *col, CollectionChangedEventArgs *args);
165 virtual void OnCollectionItemChanged (Collection *col, DependencyObject *obj, PropertyChangedEventArgs *args);
166 virtual void ComputeBounds ();
168 virtual Size MeasureOverride (Size availableSize);
169 virtual Size ArrangeOverride (Size finalSize);
171 // property accessors
172 ColumnDefinitionCollection *GetColumnDefinitions ();
173 void SetColumnDefinitions (ColumnDefinitionCollection* value);
175 static gint32 GetColumn (DependencyObject *obj);
176 static void SetColumn (DependencyObject *obj, gint32 value);
178 static gint32 GetColumnSpan (DependencyObject *obj);
179 static void SetColumnSpan (DependencyObject *obj, gint32 value);
181 RowDefinitionCollection *GetRowDefinitions ();
182 void SetRowDefinitions (RowDefinitionCollection* value);
184 static gint32 GetRow (DependencyObject *obj);
185 static void SetRow (DependencyObject *obj, gint32 value);
187 static gint32 GetRowSpan (DependencyObject *obj);
188 static void SetRowSpan (DependencyObject *obj, gint32 value);
190 bool GetShowGridLines ();
191 void SetShowGridLines (bool value);
194 #endif /* __MOON_PANEL_H__ */