-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
324 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <Geometry.h> | ||
|
||
namespace NXKit { | ||
|
||
enum class UIUserInterfaceStyle { | ||
unspecified, | ||
light, | ||
dark | ||
}; | ||
|
||
class UITraitCollection { | ||
public: | ||
std::shared_ptr<UITraitCollection> copy(); | ||
|
||
UIUserInterfaceStyle userInterfaceStyle() const { return _userInterfaceStyle; } | ||
NXFloat displayScale() const { return _displayScale; } | ||
|
||
static std::shared_ptr<UITraitCollection> current() { return _current; } | ||
static void setCurrent(std::shared_ptr<UITraitCollection> current) { _current = current; } | ||
|
||
private: | ||
friend bool applicationRunLoop(); | ||
|
||
static std::shared_ptr<UITraitCollection> _current; | ||
|
||
UIUserInterfaceStyle _userInterfaceStyle = UIUserInterfaceStyle::unspecified; | ||
NXFloat _displayScale = 1; | ||
}; | ||
|
||
} |
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,24 @@ | ||
#pragma once | ||
|
||
#include <UITraitCollection.h> | ||
|
||
namespace NXKit { | ||
|
||
class UITraitEnvironment { | ||
public: | ||
std::shared_ptr<UITraitCollection> traitCollection() const { return _traitCollection; } | ||
|
||
virtual void traitCollectionDidChange(std::shared_ptr<UITraitCollection> previousTraitCollection); | ||
|
||
protected: | ||
friend bool applicationRunLoop(); | ||
friend class UIWindow; | ||
friend class UIViewController; | ||
friend class UIView; | ||
|
||
std::shared_ptr<UITraitCollection> _traitCollection; | ||
|
||
virtual void invalidateTraitCollection() {} | ||
}; | ||
|
||
} |
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
Oops, something went wrong.