Przeglądaj źródła

More of the same

Michael Ragazzon 6 lat temu
rodzic
commit
edc78bb958

+ 4 - 4
Source/Controls/ElementFormControlTextArea.cpp

@@ -39,8 +39,8 @@ ElementFormControlTextArea::ElementFormControlTextArea(const Rocket::Core::Strin
 {
 	widget = new WidgetTextInputMultiLine(this);
 
-	SetProperty("overflow", "auto");
-	SetProperty("white-space", "pre-wrap");
+	SetProperty("overflow", Core::Property(Core::Style::Overflow::Auto));
+	SetProperty("white-space", Core::Property(Core::Style::WhiteSpace::Prewrap));
 }
 
 ElementFormControlTextArea::~ElementFormControlTextArea()
@@ -151,9 +151,9 @@ void ElementFormControlTextArea::OnAttributeChange(const Core::AttributeNameList
 	if (changed_attributes.find("wrap") != changed_attributes.end())
 	{
 		if (GetWordWrap())
-			SetProperty("white-space", "pre-wrap");
+			SetProperty("white-space", Core::Property(Core::Style::WhiteSpace::Prewrap));
 		else
-			SetProperty("white-space", "pre");
+			SetProperty("white-space", Core::Property(Core::Style::WhiteSpace::Pre));
 	}
 
 	if (changed_attributes.find("rows") != changed_attributes.end() ||

+ 5 - 5
Source/Controls/ElementTabSet.cpp

@@ -124,9 +124,9 @@ void ElementTabSet::SetActiveTab(int tab_index)
 		Core::Element* new_window = windows->GetChild(tab_index);
 
 		if (old_window)
-			old_window->SetProperty("display", "none");			
+			old_window->SetProperty("display", Core::Property(Core::Style::Display::None));
 		if (new_window)
-			new_window->SetProperty("display", "inline-block");
+			new_window->SetProperty("display", Core::Property(Core::Style::Display::InlineBlock));
 
 		active_tab = tab_index;
 
@@ -180,7 +180,7 @@ void ElementTabSet::OnChildAdd(Core::Element* child)
 	if (child->GetParentNode() == GetChildByTag("tabs"))
 	{
 		// Set up the new button and append it
-		child->SetProperty("display", "inline-block");
+		child->SetProperty("display", Core::Property(Core::Style::Display::InlineBlock));
 		child->AddEventListener("click", this);
 
 		if (child->GetParentNode()->GetChild(active_tab) == child)
@@ -190,11 +190,11 @@ void ElementTabSet::OnChildAdd(Core::Element* child)
 	if (child->GetParentNode() == GetChildByTag("panels"))
 	{
 		// Hide the new tab window
-		child->SetProperty("display", "none");
+		child->SetProperty("display", Core::Property(Core::Style::Display::None));
 		
 		// Make the new element visible if its the active tab
 		if (child->GetParentNode()->GetChild(active_tab) == child)
-			child->SetProperty("display", "inline-block");
+			child->SetProperty("display", Core::Property(Core::Style::Display::InlineBlock));
 	}
 }
 

+ 7 - 7
Source/Controls/WidgetDropDown.cpp

@@ -52,11 +52,11 @@ WidgetDropDown::WidgetDropDown(ElementFormControl* element)
 	value_element = Core::Factory::InstanceElement(element, "*", "selectvalue", Rocket::Core::XMLAttributes());
 	selection_element = Core::Factory::InstanceElement(parent_element, "*", "selectbox", Rocket::Core::XMLAttributes());
 
-	value_element->SetProperty("overflow", "hidden");
+	value_element->SetProperty("overflow", Core::Property(Core::Style::Overflow::Hidden));
 
-	selection_element->SetProperty("visibility", "hidden");
+	selection_element->SetProperty("visibility", Core::Property(Core::Style::Visibility::Hidden));
 	selection_element->SetProperty("z-index", Core::Property(1.0f, Core::Property::NUMBER));
-	selection_element->SetProperty("clip", "none");
+	selection_element->SetProperty("clip", Core::Property(Core::Style::Clip::None));
 
 	parent_element->AddEventListener("click", this, true);
 	parent_element->AddEventListener("blur", this);
@@ -222,8 +222,8 @@ int WidgetDropDown::AddOption(const Rocket::Core::String& rml, const Rocket::Cor
 	Core::Element* element = Core::Factory::InstanceElement(selection_element, "*", "option", Rocket::Core::XMLAttributes());
 
 	// Force to block display and inject the RML. Register a click handler so we can be notified of selection.
-	element->SetProperty("display", "block");
-	element->SetProperty("clip", "auto");
+	element->SetProperty("display", Core::Property(Core::Style::Display::Block));
+	element->SetProperty("clip", Core::Property(Core::Style::Clip::Auto));
 	element->SetInnerRML(rml);
 	element->AddEventListener("click", this);
 
@@ -379,13 +379,13 @@ void WidgetDropDown::ShowSelectBox(bool show)
 {
 	if (show)
 	{
-		selection_element->SetProperty("visibility", "visible");
+		selection_element->SetProperty("visibility", Core::Property(Core::Style::Visibility::Visible));
 		value_element->SetPseudoClass("checked", true);
 		button_element->SetPseudoClass("checked", true);
 	}
 	else
 	{
-		selection_element->SetProperty("visibility", "hidden");
+		selection_element->SetProperty("visibility", Core::Property(Core::Style::Visibility::Hidden));
 		value_element->SetPseudoClass("checked", false);
 		button_element->SetPseudoClass("checked", false);
 	}

+ 1 - 1
Source/Controls/WidgetSlider.cpp

@@ -90,7 +90,7 @@ WidgetSlider::~WidgetSlider()
 // Initialises the slider to a given orientation.
 bool WidgetSlider::Initialise()
 {
-	Core::Property drag_property = Core::Property((int)Core::Style::Drag::Drag, Core::Property::KEYWORD);
+	Core::Property drag_property = Core::Property(Core::Style::Drag::Drag);
 	parent->SetProperty("drag", drag_property);
 
 	// Create all of our child elements as standard elements, and abort if we can't create them.

+ 3 - 3
Source/Controls/WidgetTextInput.cpp

@@ -43,9 +43,9 @@ WidgetTextInput::WidgetTextInput(ElementFormControl* _parent) : internal_dimensi
 	keyboard_showed = false;
 	
 	parent = _parent;
-	parent->SetProperty("white-space", "pre");
-	parent->SetProperty("overflow", "hidden");
-	parent->SetProperty("drag", "drag");
+	parent->SetProperty("white-space", Core::Property(Core::Style::WhiteSpace::Pre));
+	parent->SetProperty("overflow", Core::Property(Core::Style::Overflow::Hidden));
+	parent->SetProperty("drag", Core::Property(Core::Style::Drag::Drag));
 	parent->SetClientArea(Rocket::Core::Box::CONTENT);
 
 	parent->AddEventListener("keydown", this, true);

+ 2 - 2
Source/Core/Context.cpp

@@ -50,7 +50,7 @@ Context::Context(const String& name) : name(name), dimensions(0, 0), mouse_posit
 	root = Factory::InstanceElement(NULL, "*", "#root", XMLAttributes());
 	root->SetId(name);
 	root->SetOffset(Vector2f(0, 0), NULL);
-	root->SetProperty(Z_INDEX, "0");
+	root->SetProperty(Z_INDEX, Property(0, Property::NUMBER));
 
 	Element* element = Factory::InstanceElement(NULL, "body", "body", XMLAttributes());
 	cursor_proxy = dynamic_cast< ElementDocument* >(element);
@@ -1125,7 +1125,7 @@ void Context::CreateDragClone(Element* element)
 
 	// Set all the required properties and pseudo-classes on the clone.
 	drag_clone->SetPseudoClass("drag", true);
-	drag_clone->SetProperty("position", "absolute");
+	drag_clone->SetProperty("position", Property(Style::Position::Absolute));
 	drag_clone->SetProperty("left", Property(element->GetAbsoluteLeft() - element->GetBox().GetEdge(Box::MARGIN, Box::LEFT) - mouse_position.x, Property::PX));
 	drag_clone->SetProperty("top", Property(element->GetAbsoluteTop() - element->GetBox().GetEdge(Box::MARGIN, Box::TOP) - mouse_position.y, Property::PX));
 }