-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SUTK] Various fixes; Added PassiveLabel derived from Label; Increase…
… test coverage in Label test
- Loading branch information
Showing
33 changed files
with
563 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <sutk/Label.hpp> | ||
|
||
namespace SUTK | ||
{ | ||
class TextGroupContainer; | ||
|
||
// A PassiveLabel is slightly different from the typical Label in the sense that upon instantiation it first searches up the Container Hierarhcy (recursively) | ||
// for a Text Group object, if it finds then it uses that Text Group object to create a SmallText instance internally. | ||
// If it doesn't find then it creates a Text Group object internally and then creates a SmallText instance from this Text Group object. | ||
// When this PassiveLabel object is destroyed then it also destroys the (if any) created Text Group object. | ||
class SUTK_API PassiveLabel : public Label | ||
{ | ||
private: | ||
com::Bool m_isReassociateOnParentChange; | ||
void tryReassociate() noexcept; | ||
protected: | ||
// Override of Label::onAnscestorChange() | ||
virtual void onAnscestorChange(Container* anscestor) noexcept override; | ||
public: | ||
// If no textGroup is provided, then it creates a new text group internally only for this PassiveLabel | ||
// PERF: It is recommened to specify a valid text group if possible to avoid creating separate text group for each label which is inefficient | ||
PassiveLabel(UIDriver& driver, Container* parent = nullptr, GfxDriverObjectHandleType textGroup = GFX_DRIVER_OBJECT_NULL_HANDLE) noexcept; | ||
~PassiveLabel() noexcept; | ||
|
||
void setReassociateOnParentChange(com::Bool isReassociate, com::Bool isApplyNow = com::False) noexcept; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#pragma once | ||
|
||
#include <sutk/ITest.hpp> | ||
|
||
#include <sge-cpp/sge.hpp> | ||
|
||
#include <sutk/UIDriver.hpp> | ||
|
||
namespace SUTK | ||
{ | ||
class IGfxDriver; | ||
class Label; | ||
class TextGroupContainer; | ||
|
||
class LabelTest : public ITest | ||
{ | ||
private: | ||
UIDriver* m_uiDriver; | ||
IGfxDriver* m_gfxDriver; | ||
IInputDriver* m_inputDriver; | ||
FullWindowContainer* m_rootContainer { }; | ||
Container* m_auxContainer { }; | ||
TextGroupContainer* m_txtGrpContainer1 { }; | ||
TextGroupContainer* m_txtGrpContainer2 { }; | ||
Label* m_label { }; | ||
Label* m_label2 { }; | ||
Label* m_label3 { }; | ||
UIDriver::FontReference m_font { }; | ||
|
||
public: | ||
LabelTest() : m_uiDriver(NULL), m_gfxDriver(NULL), m_inputDriver(NULL) { } | ||
|
||
TestInitializationData getInitializationData() override; | ||
|
||
void initialize(SGE::Driver& driver) override; | ||
|
||
void terminate(SGE::Driver& driver) override; | ||
|
||
void render(SGE::Driver& driver) override; | ||
|
||
void update(SGE::Driver& driver, float deltaTime) override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#pragma once | ||
|
||
#include <sutk/ITest.hpp> | ||
|
||
#include <sge-cpp/sge.hpp> | ||
|
||
#include <sutk/UIDriver.hpp> | ||
|
||
namespace SUTK | ||
{ | ||
class IGfxDriver; | ||
class PassiveLabel; | ||
class TextGroupContainer; | ||
|
||
class PassiveLabelTest : public ITest | ||
{ | ||
private: | ||
UIDriver* m_uiDriver; | ||
IGfxDriver* m_gfxDriver; | ||
IInputDriver* m_inputDriver; | ||
FullWindowContainer* m_rootContainer { }; | ||
Container* m_auxContainer { }; | ||
TextGroupContainer* m_txtGrpContainer1 { }; | ||
TextGroupContainer* m_txtGrpContainer2 { }; | ||
PassiveLabel* m_label { }; | ||
PassiveLabel* m_label2 { }; | ||
PassiveLabel* m_label3 { }; | ||
UIDriver::FontReference m_font { }; | ||
|
||
public: | ||
PassiveLabelTest() : m_uiDriver(NULL), m_gfxDriver(NULL), m_inputDriver(NULL) { } | ||
|
||
TestInitializationData getInitializationData() override; | ||
|
||
void initialize(SGE::Driver& driver) override; | ||
|
||
void terminate(SGE::Driver& driver) override; | ||
|
||
void render(SGE::Driver& driver) override; | ||
|
||
void update(SGE::Driver& driver, float deltaTime) override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.