1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00

Added DependencyProperty and related classes

Replaced include guards
Removed redundant semicolons
This commit is contained in:
Tom Lint 2013-06-12 19:21:00 +02:00
parent 81af66d336
commit b1777ae216
25 changed files with 206 additions and 41 deletions

View File

@ -9,3 +9,11 @@ Being written in C++ allows XFX to be lightweight and as close to the hardware a
Compiling XFX requires at least OpenXDK version 0.7
As of this writing, XFX Contains the following libraries:
* libmscorlib - Provides the necessary classes found in mscorlib.dll to support the other libraries
* libSystem - Implements any types in the System.dll required by the other libs
* libSystem.Windows - A re-implementation of the System.Windows.dll found on Windows Phone, to allow the creation of GUI-driven applications
* libSystem.Xml - Implements the functions found in System.Xml.dll
* libXFX - Implements the functions found in Microsoft.Xna.Framework.dll
* libXFX.Game - Implements the functions found in Microsoft.Xna.Framework.Game.dll

View File

@ -1,9 +1,9 @@
/********************************************************
* TimeZone.h *
* *
* TimeZone definition file *
* Copyright (c) XFX Team. All Rights Reserved *
********************************************************/
/*****************************************************************************
* TimeZone.h *
* *
* System::TimeZone definition file *
* Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/
#ifndef _SYSTEM_TIMEZONE_
#define _SYSTEM_TIMEZONE_
@ -14,9 +14,9 @@ using namespace System::Globalization;
namespace System
{
class DateTime;
struct DateTime;
class String;
class TimeSpan;
struct TimeSpan;
// Represents a time zone.
class TimeZone : public Object

View File

@ -33,10 +33,9 @@ namespace System
static const String& ToString(const uint value);
static bool TryParse(const char* str, out uint* result);
operator uint() const;
bool operator==(const UInt32& right) const;
bool operator==(const uint& right) const;
bool operator!=(const UInt32& right) const;
bool operator!=(const uint& right) const;
};
}

View File

@ -37,9 +37,7 @@ namespace System
operator ulong() const;
bool operator==(const UInt64& right) const;
//bool operator==(const ulong& right) const;
bool operator!=(const UInt64& right) const;
//bool operator!=(const ulong& right) const;
};
}

View File

@ -1,7 +1,7 @@
/*****************************************************************************
* Version.h *
* *
* XFX Version definition file *
* XFX System::Version definition file *
* Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/
#ifndef _SYSTEM_VERSION_

View File

@ -1,4 +1,5 @@
#pragma once
#ifndef _SYSTEM_WINDOWS_CONTROLS_BORDER_
#define _SYSTEM_WINDOWS_CONTROLS_BORDER_
#include <System/Windows/CornerRadius.h>
#include <System/Windows/FrameworkElement.h>
@ -12,7 +13,9 @@ namespace System
{
namespace Controls
{
// Draws a border, background, or both around another object.
/**
* Draws a border, background, or both around another object.
*/
class Border : public FrameworkElement
{
public:
@ -31,3 +34,5 @@ namespace System
}
}
}
#endif _SYSTEM_WINDOWS_CONTROLS_BORDER_

View File

@ -1,3 +1,6 @@
#ifndef _SYSTEM_WINDOWS_CONTROLS_CANVAS_
#define _SYSTEM_WINDOWS_CONTROLS_CANVAS_
#include <System/Windows/Controls/Panel.h>
namespace System
@ -34,3 +37,5 @@ namespace System
}
}
}
#endif //_SYSTEM_WINDOWS_CONTROLS_CANVAS_

View File

@ -1,4 +1,5 @@
#pragma once
#ifndef _SYSTEM_WINDOWS_CONTROLS_COLUMNDEFINITION_
#define _SYSTEM_WINDOWS_CONTROLS_COLUMNDEFINITION_
#include <System/Windows/GridLength.h>
#include <System/Windows/PresentationFrameworkCollection.h>
@ -9,7 +10,9 @@ namespace System
{
namespace Controls
{
// Defines row-specific properties that apply to System::Windows::Controls::Grid elements.
/**
* Defines row-specific properties that apply to System::Windows::Controls::Grid elements.
*/
class ColumnDefinition
{
public:
@ -31,3 +34,5 @@ namespace System
}
}
}
#endif //_SYSTEM_WINDOWS_CONTROLS_COLUMNDEFINITION_

View File

@ -1,4 +1,5 @@
#pragma once
#ifndef _SYSTEM_WINDOWS_CONTROLS_CONTENTCONTROL_
#define _SYSTEM_WINDOWS_CONTROLS_CONTENTCONTROL_
#include <System/String.h>
#include <System/Windows/Controls/Control.h>
@ -30,3 +31,5 @@ namespace System
}
}
}
#endif

View File

@ -1,4 +1,5 @@
#pragma once
#ifndef _SYSTEM_WINDOWS_CONTROLS_GRID_
#define _SYSTEM_WINDOWS_CONTROLS_GRID_
#include <System/Windows/Controls/Panel.h>
#include <System/Windows/Controls/ColumnDefinition.h>
@ -46,3 +47,5 @@ namespace System
}
}
}
#endif //_SYSTEM_WINDOWS_CONTROLS_GRID_

View File

@ -1,4 +1,11 @@
#pragma once
/*****************************************************************************
* DependencyObject.h *
* *
* System::Windows::DependencyObject definition file *
* Copyright (c) XFX Team. All rights reserved *
*****************************************************************************/
#ifndef _SYSTEM_WINDOWS_DEPENDENCYOBJECT_
#define _SYSTEM_WINDOWS_DEPENDENCYOBJECT_
#include <System/Collections/Generic/Dictionary.h>
@ -12,7 +19,7 @@ namespace System
class DependencyObject
{
private:
Dictionary<String, Object*> dependencyProperties;
Dictionary<String, Object *> dependencyProperties;
protected:
DependencyObject();
@ -25,3 +32,5 @@ namespace System
};
}
}
#endif //_SYSTEM_WINDOWS_DEPENDENCYOBJECT_

View File

@ -0,0 +1,45 @@
/*****************************************************************************
* DependencyProperty.h *
* *
* System::Windows::DependencyProperty definition file *
* Copyright (c) XFX Team. All rights reserved *
*****************************************************************************/
#ifndef _SYSTEM_WINDOWS_DEPENDENCYPROPERTY_
#define _SYSTEM_WINDOWS_DEPENDENCYPROPERTY_
#include <System/Collections/Generic/Dictionary.h>
#include "PropertyMetaData.h"
using namespace System::Collections::Generic;
namespace System
{
namespace Windows
{
template <typename T>
class DependencyProperty
{
private:
static Dictionary<int, Dictionary<String&, Object *> > _registeredProperties;
public:
static DependencyProperty<T> Register(const String& propertyName, const int type);
static DependencyProperty<T> Register(const String& propertyName, const int type, PropertyMetaData<T> const * propertyMetaData);
};
///////////////////////////////////////////////////////////////////////
template <typename T>
DependencyProperty<T> DependencyProperty<T>::Register(const String& propertyName, const int type)
{
Register(propertyName, type, new PropertyMetaData<T>(null));
}
template <typename T>
DependencyProperty<T> DependencyProperty<T>::Register(const String& propertyName, const int type, PropertyMetaData<T> const * propertyMetaData)
{
}
}
}
#endif //_SYSTEM_WINDOWS_DEPENDENCYPROPERTY_

View File

@ -1,4 +1,5 @@
#pragma once
#ifndef _SYSTEM_WINDOWS_ENUMS_
#define _SYSTEM_WINDOWS_ENUMS_
namespace System
{
@ -115,7 +116,7 @@ namespace System
};
};
// // Describes the kind of value that a GridLength object is holding.
// Describes the kind of value that a GridLength object is holding.
typedef GridUnitType::type GridUnitType_t;
//
typedef HorizontalAlignment::type HorizontalAlignment_t;
@ -133,3 +134,5 @@ namespace System
typedef WindowStyle::type WindowStyle_t;
}
}
#endif //_SYSTEM_WINDOWS_ENUMS_

View File

@ -1,4 +1,5 @@
#pragma once
#ifndef _SYSTEM_WINDOWS_FRAMEWORKELEMENT_
#define _SYSTEM_WINDOWS_FRAMEWORKELEMENT_
#include <System/Windows/Thickness.h>
#include <System/Windows/UIElement.h>
@ -34,3 +35,5 @@ namespace System
};
}
}
#endif //_SYSTEM_WINDOWS_FRAMEWORKELEMENT_

View File

@ -1,4 +1,11 @@
#pragma once
/*****************************************************************************
* PresentationFrameworkCollection.h *
* *
* System::Windows::PresentationFrameworkCollection definition file *
* Copyright (c) XFX Team. All rights reserved *
*****************************************************************************/
#ifndef _SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_
#define _SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_
#include <System/Collections/Generic/List.h>
#include <sassert.h>
@ -10,7 +17,7 @@ namespace System
namespace Windows
{
template <typename T>
class PresentationFrameworkCollection : public IList<T>
class PresentationFrameworkCollection : public IList<T>, public Object
{
private:
List<T> _items;
@ -26,6 +33,7 @@ namespace System
void Clear();
bool Contains(const T& item) const;
void CopyTo(T array[], const int index) const;
int GetType() const;
int IndexOf(const T& item) const;
void Insert(const int index, const T& item);
bool Remove(const T& item);
@ -109,3 +117,5 @@ namespace System
}
}
}
#endif //_SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* PropertyMetaData.h *
* *
* System::Windows::PropertyMetaData definition file *
* Copyright (c) XFX Team. All rights reserved *
*****************************************************************************/
#ifndef _SYSTEM_WINDOWS_PROPERTYMETADATA_
#define _SYSTEM_WINDOWS_PROPERTYMETADATA_
namespace System
{
namespace Windows
{
template <typename T>
class PropertyMetaData
{
public:
PropertyMetaData(T defaultValue);
~PropertyMetaData();
};
///////////////////////////////////////////////////////////////////////
template <typename T>
PropertyMetaData<T>::PropertyMetaData(T const defautValue)
{
}
template <typename T>
PropertyMetaData<T>::~PropertyMetaData()
{
}
}
}
#endif //_SYSTEM_WINDOWS_PROPERTYMETADATA_

View File

@ -1,4 +1,11 @@
#pragma once
/*****************************************************************************
* RoutedPropertyChangedEventArgs.h *
* *
* System::Windows::RoutedPropertyChangedEventArgs definition file *
* Copyright (c) XFX Team. All rights reserved *
*****************************************************************************/
#ifndef _SYSTEM_WINDOWS_ROUTEDPROPERTYCHANGEDEVENTARGS_
#define _SYSTEM_WINDOWS_ROUTEDPROPERTYCHANGEDEVENTARGS_
#include <System/Windows/RoutedEventArgs.h>
@ -18,5 +25,20 @@ namespace System
{
}
};
template <typename T>
class RoutedPropertyChangedEventArgs<T *> : public RoutedEventArgs
{
public:
T const * const OldValue;
T const * const NewValue;
RoutedPropertyChangedEventArgs(T const * const oldValue, T const * const newValue)
: OldValue(oldValue), NewValue(newValue)
{
}
};
}
}
#endif //_SYSTEM_WINDOWS_ROUTEDPROPERTYCHANGEDEVENTARGS_

View File

@ -11,10 +11,10 @@
#include <string.h>
void *memcpy(void *dest, const void *src, size_t count) __attribute__((nonnull (1, 2)));;
void *memcpy(void *dest, const void *src, size_t count) __attribute__((nonnull (1, 2)));
void *malloc(size_t size);
void *memset(void *s, char c, size_t count) __attribute__((nonnull (1)));;
void *memset(void *s, char c, size_t count) __attribute__((nonnull (1)));
#endif

View File

@ -10,10 +10,10 @@ extern "C" {
#undef sassert
#ifdef NDEBUG /* required by ANSI standard */
#define sassert(e,s) ((void)0)
#define sassert(e,msg) ((void)0)
#else
//! Causes a blue screen of death if e is not true with the msg "msg" displayed
#define sassert(e,msg) ((e) ? (void)0 : __sassert(__FILE__, __LINE__, #e, msg))
#define sassert(e,msg) ((e) ? (void)0 : __sassert(__FILE__, __LINE__, #e, msg))
#endif /* NDEBUG */

View File

@ -107,10 +107,12 @@
<ClInclude Include="..\..\include\System\Windows\Controls\Primitives\RepeatButton.h" />
<ClInclude Include="..\..\include\System\Windows\CornerRadius.h" />
<ClInclude Include="..\..\include\System\Windows\DependencyObject.h" />
<ClInclude Include="..\..\include\System\Windows\DependencyProperty.h" />
<ClInclude Include="..\..\include\System\Windows\Enums.h" />
<ClInclude Include="..\..\include\System\Windows\FrameworkElement.h" />
<ClInclude Include="..\..\include\System\Windows\GridLength.h" />
<ClInclude Include="..\..\include\System\Windows\Input\MouseButtonEventArgs.h" />
<ClInclude Include="..\..\include\System\Windows\PropertyMetaData.h" />
<ClInclude Include="memutil.h" />
<ClInclude Include="..\..\include\System\Windows\MessageBox.h" />
<ClInclude Include="..\..\include\System\Windows\Point.h" />

View File

@ -293,6 +293,12 @@
<ClInclude Include="..\..\include\System\Windows\Input\MouseButtonEventArgs.h">
<Filter>Header Files\Windows\Input</Filter>
</ClInclude>
<ClInclude Include="..\..\include\System\Windows\DependencyProperty.h">
<Filter>Header Files\Windows</Filter>
</ClInclude>
<ClInclude Include="..\..\include\System\Windows\PropertyMetaData.h">
<Filter>Header Files\Windows</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="makefile" />

View File

@ -1,4 +1,5 @@
#pragma once
#ifndef _MEMUTIL_H
#define _MEMUTIL_H
// sets count dwords of dest to value
inline void* memsetd(void* dest, const unsigned int value, const int count)
@ -13,3 +14,5 @@ inline void* memsetw(void* dest, const unsigned short value, const int count)
__asm__ __volatile__("rep stosw"::"c" (count),"a" (value),"D" (dest): "memory");
return dest;
}
#endif //_MEMUTIL_H

View File

@ -237,7 +237,7 @@ namespace System
bool DateTime::Equals(Object const * const obj) const
{
return is(obj, this) ? this->Equals((*(DateTime*)obj)) : false;
return is(obj, this) ? this->Equals(*(DateTime *)obj) : false;
}
bool DateTime::Equals(const DateTime obj) const

View File

@ -33,18 +33,18 @@
#include <sassert.h>
unsigned long long rawNaND = 0x7ff8000000000000ULL;
unsigned long long rawPosInfD = 0x7ff0000000000000ULL;
unsigned long long rawNegInfD = 0xfff0000000000000ULL;
namespace System
{
unsigned long long rawNaND = 0x7ff8000000000000ULL;
unsigned long long rawPosInfD = 0x7ff0000000000000ULL;
unsigned long long rawNegInfD = 0xfff0000000000000ULL;
const double Double::Epsilon = 4.94066e-324;
const double Double::MaxValue = 1.79769e+308;
const double Double::MinValue = -1.79769e+308;
const double Double::NaN = *(double*)&rawNaND;
const double Double::PositiveInfinity = *(double*)&rawPosInfD;
const double Double::NegativeInfinity = *(double*)&rawNegInfD;
const double Double::NaN = *(double *)&rawNaND;
const double Double::PositiveInfinity = *(double *)&rawPosInfD;
const double Double::NegativeInfinity = *(double *)&rawNegInfD;
Double::Double(const Double &obj)
: value(obj.value)

View File

@ -70,7 +70,7 @@ namespace System
OperatingSystem Environment::OSVersion()
{
return OperatingSystem(PlatformID::Xbox, Version(XboxKrnlVersion->VersionMajor,XboxKrnlVersion->VersionMinor, XboxKrnlVersion->Build));
return OperatingSystem(PlatformID::Xbox, Version(XboxKrnlVersion->VersionMajor, XboxKrnlVersion->VersionMinor, XboxKrnlVersion->Build));
}
int Environment::ProcessorCount()