Browse Source

UIView -> UIState

Josh Engebretson 10 years ago
parent
commit
e90fa0a4b0

+ 2 - 2
Source/Atomic/UI/TBUI.cpp

@@ -19,7 +19,7 @@
 #include <TurboBadger/tb_core.h>
 #include <TurboBadger/tb_system.h>
 
-#include "UIView.h"
+#include "UIState.h"
 
 using namespace tb;
 
@@ -71,7 +71,7 @@ void TBUI::Shutdown()
 
 void TBUI::Initialize()
 {
-    theView_ = new UIView(context_);
+    theView_ = new UIState(context_);
 
 }
 

+ 2 - 2
Source/Atomic/UI/TBUI.h

@@ -13,7 +13,7 @@ class TBWidget;
 namespace Atomic
 {
 
-class UIView;
+class UIState;
 
 class ATOMIC_API TBUI : public Object
 {
@@ -35,7 +35,7 @@ public:
 
 private:
 
-    SharedPtr<UIView> theView_;
+    SharedPtr<UIState> theView_;
 
 };
 

+ 1 - 1
Source/Atomic/UI/UIRenderer.h

@@ -19,7 +19,7 @@ class TBUI;
 
 class UIRenderer : public tb::TBRendererBatcher
 {
-    friend class UIView;
+    friend class UIState;
 public:
 
     UIRenderer(Context* context);

+ 24 - 24
Source/Atomic/UI/UIView.cpp → Source/Atomic/UI/UIState.cpp

@@ -25,15 +25,15 @@ using namespace tb;
 #include "../Graphics/VertexBuffer.h"
 
 #include "UIRenderer.h"
-#include "UIView.h"
+#include "UIState.h"
 
 namespace Atomic
 {
 
-WeakPtr<Context> UIView::readerContext_;
+WeakPtr<Context> UIState::readerContext_;
 
 
-UIView::UIView(Context* context) :
+UIState::UIState(Context* context) :
     Object(context),
     rootWidget_(0),
     inputDisabled_(false),
@@ -50,7 +50,7 @@ UIView::UIView(Context* context) :
 
 }
 
-UIView::~UIView()
+UIState::~UIState()
 {
     tb::TBWidgetsAnimationManager::Shutdown();
     delete rootWidget_;
@@ -61,7 +61,7 @@ UIView::~UIView()
 }
 
 // refactor
-void UIView::Initialize()
+void UIState::Initialize()
 {
     readerContext_ = context_;
     TBFile::SetReaderFunction(TBFileReader);
@@ -104,22 +104,22 @@ void UIView::Initialize()
 
     rootWidget_->SetVisibilility(tb::WIDGET_VISIBILITY_VISIBLE);
 
-    SubscribeToEvent(E_MOUSEBUTTONDOWN, HANDLER(UIView, HandleMouseButtonDown));
-    SubscribeToEvent(E_MOUSEBUTTONUP, HANDLER(UIView, HandleMouseButtonUp));
-    SubscribeToEvent(E_MOUSEMOVE, HANDLER(UIView, HandleMouseMove));
-    SubscribeToEvent(E_MOUSEWHEEL, HANDLER(UIView, HandleMouseWheel));
-    SubscribeToEvent(E_KEYDOWN, HANDLER(UIView, HandleKeyDown));
-    SubscribeToEvent(E_KEYUP, HANDLER(UIView, HandleKeyUp));
-    SubscribeToEvent(E_TEXTINPUT, HANDLER(UIView, HandleTextInput));
-    SubscribeToEvent(E_UPDATE, HANDLER(UIView, HandleUpdate));
+    SubscribeToEvent(E_MOUSEBUTTONDOWN, HANDLER(UIState, HandleMouseButtonDown));
+    SubscribeToEvent(E_MOUSEBUTTONUP, HANDLER(UIState, HandleMouseButtonUp));
+    SubscribeToEvent(E_MOUSEMOVE, HANDLER(UIState, HandleMouseMove));
+    SubscribeToEvent(E_MOUSEWHEEL, HANDLER(UIState, HandleMouseWheel));
+    SubscribeToEvent(E_KEYDOWN, HANDLER(UIState, HandleKeyDown));
+    SubscribeToEvent(E_KEYUP, HANDLER(UIState, HandleKeyUp));
+    SubscribeToEvent(E_TEXTINPUT, HANDLER(UIState, HandleTextInput));
+    SubscribeToEvent(E_UPDATE, HANDLER(UIState, HandleUpdate));
 
-    SubscribeToEvent(E_RENDERUPDATE, HANDLER(UIView, HandleRenderUpdate));
+    SubscribeToEvent(E_RENDERUPDATE, HANDLER(UIState, HandleRenderUpdate));
 
     //TB_DEBUG_SETTING(LAYOUT_BOUNDS) = 1;
 }
 
 
-void UIView::Render(VertexBuffer* buffer, const PODVector<UIBatch>& batches, unsigned batchStart, unsigned batchEnd)
+void UIState::Render(VertexBuffer* buffer, const PODVector<UIBatch>& batches, unsigned batchStart, unsigned batchEnd)
 {
 
     if (batches.Empty())
@@ -203,7 +203,7 @@ void UIView::Render(VertexBuffer* buffer, const PODVector<UIBatch>& batches, uns
     }
 }
 
-void UIView::SetVertexData(VertexBuffer* dest, const PODVector<float>& vertexData)
+void UIState::SetVertexData(VertexBuffer* dest, const PODVector<float>& vertexData)
 {
     if (vertexData.Empty())
         return;
@@ -218,13 +218,13 @@ void UIView::SetVertexData(VertexBuffer* dest, const PODVector<float>& vertexDat
 }
 
 
-void UIView::Render()
+void UIState::Render()
 {
     SetVertexData(vertexBuffer_, vertexData_);
     Render(vertexBuffer_, batches_, 0, batches_.Size());
 }
 
-void UIView::HandleRenderUpdate(StringHash eventType, VariantMap& eventData)
+void UIState::HandleRenderUpdate(StringHash eventType, VariantMap& eventData)
 {
     // Get rendering batches from the non-modal UI elements
     batches_.Clear();
@@ -237,7 +237,7 @@ void UIView::HandleRenderUpdate(StringHash eventType, VariantMap& eventData)
 
 }
 
-void UIView::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor)
+void UIState::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor)
 {
     //if (!initialized_)
     //    return;
@@ -257,7 +257,7 @@ void UIView::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexDat
     tb::g_renderer->EndPaint();
 }
 
-void UIView::SubmitBatchVertexData(Texture* texture, const PODVector<float>& vertexData)
+void UIState::SubmitBatchVertexData(Texture* texture, const PODVector<float>& vertexData)
 {
     UIBatch b(BLEND_ALPHA , renderer_->currentScissor_, texture, &vertexData_);
 
@@ -275,7 +275,7 @@ void UIView::SubmitBatchVertexData(Texture* texture, const PODVector<float>& ver
 
 }
 
-void UIView::TBFileReader(const char* filename, void** data, unsigned* length)
+void UIState::TBFileReader(const char* filename, void** data, unsigned* length)
 {
     *data = 0;
     *length = 0;
@@ -305,7 +305,7 @@ void UIView::TBFileReader(const char* filename, void** data, unsigned* length)
 
 }
 
-bool UIView::LoadResourceFile(TBWidget* widget, const String& filename)
+bool UIState::LoadResourceFile(TBWidget* widget, const String& filename)
 {
 
     tb::TBNode node;
@@ -319,7 +319,7 @@ bool UIView::LoadResourceFile(TBWidget* widget, const String& filename)
 }
 
 
-void UIView::HandleScreenMode(StringHash eventType, VariantMap& eventData)
+void UIState::HandleScreenMode(StringHash eventType, VariantMap& eventData)
 {
     using namespace ScreenMode;
     rootWidget_->SetSize(eventData[P_WIDTH].GetInt(), eventData[P_HEIGHT].GetInt());
@@ -328,7 +328,7 @@ void UIView::HandleScreenMode(StringHash eventType, VariantMap& eventData)
 
 
 
-void UIView::HandleUpdate(StringHash eventType, VariantMap& eventData)
+void UIState::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
     TBMessageHandler::ProcessMessages();
 }

+ 4 - 4
Source/Atomic/UI/UIView.h → Source/Atomic/UI/UIState.h

@@ -15,16 +15,16 @@ namespace Atomic
 class VertexBuffer;
 class UIRenderer;
 
-class UIView : public Object
+class UIState : public Object
 {
-    OBJECT(UIView)
+    OBJECT(UIState)
 
 public:
 
     /// Construct.
-    UIView(Context* context);
+    UIState(Context* context);
     /// Destruct.
-    virtual ~UIView();
+    virtual ~UIState();
 
     tb::TBWidget* GetRootWidget() { return rootWidget_; }
     bool LoadResourceFile(tb::TBWidget* widget, const String& filename);

+ 9 - 9
Source/Atomic/UI/UIViewInput.cpp → Source/Atomic/UI/UIStateInput.cpp

@@ -6,7 +6,7 @@ using namespace tb;
 #include "../Input/Input.h"
 #include "../Input/InputEvents.h"
 
-#include "UIView.h"
+#include "UIState.h"
 
 namespace Atomic
 {
@@ -30,7 +30,7 @@ static int toupr_ascii(int ascii)
     return ascii;
 }
 
-void UIView::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
+void UIState::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
 {
     if (inputDisabled_)
         return;
@@ -74,7 +74,7 @@ void UIView::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
 }
 
 
-void UIView::HandleMouseButtonUp(StringHash eventType, VariantMap& eventData)
+void UIState::HandleMouseButtonUp(StringHash eventType, VariantMap& eventData)
 {
     if (inputDisabled_)
         return;
@@ -104,7 +104,7 @@ void UIView::HandleMouseButtonUp(StringHash eventType, VariantMap& eventData)
 }
 
 
-void UIView::HandleMouseMove(StringHash eventType, VariantMap& eventData)
+void UIState::HandleMouseMove(StringHash eventType, VariantMap& eventData)
 {
     using namespace MouseMove;
 
@@ -119,7 +119,7 @@ void UIView::HandleMouseMove(StringHash eventType, VariantMap& eventData)
 }
 
 
-void UIView::HandleMouseWheel(StringHash eventType, VariantMap& eventData)
+void UIState::HandleMouseWheel(StringHash eventType, VariantMap& eventData)
 {
     if (inputDisabled_)
         return;
@@ -209,7 +209,7 @@ static bool InvokeKey(TBWidget* root, unsigned int key, SPECIAL_KEY special_key,
 }
 
 
-void UIView::HandleKey(bool keydown, int keycode, int scancode)
+void UIState::HandleKey(bool keydown, int keycode, int scancode)
 {
 
 #ifdef ATOMIC_PLATFORM_WINDOWS
@@ -323,7 +323,7 @@ void UIView::HandleKey(bool keydown, int keycode, int scancode)
 
 }
 
-void UIView::HandleKeyDown(StringHash eventType, VariantMap& eventData)
+void UIState::HandleKeyDown(StringHash eventType, VariantMap& eventData)
 {
     if (inputDisabled_ || keyboardDisabled_)
         return;
@@ -337,7 +337,7 @@ void UIView::HandleKeyDown(StringHash eventType, VariantMap& eventData)
 
 }
 
-void UIView::HandleKeyUp(StringHash eventType, VariantMap& eventData)
+void UIState::HandleKeyUp(StringHash eventType, VariantMap& eventData)
 {
     if (inputDisabled_ || keyboardDisabled_)
         return;
@@ -351,7 +351,7 @@ void UIView::HandleKeyUp(StringHash eventType, VariantMap& eventData)
 
 }
 
-void UIView::HandleTextInput(StringHash eventType, VariantMap& eventData)
+void UIState::HandleTextInput(StringHash eventType, VariantMap& eventData)
 {
     if (inputDisabled_ || keyboardDisabled_)
         return;