-
Notifications
You must be signed in to change notification settings - Fork 1
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
bho35
authored and
bho35
committed
Jun 11, 2023
1 parent
30cfcba
commit d7ddce8
Showing
17 changed files
with
571 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#include "stdafx.h" | ||
#include "CWinUINumberBox.h" | ||
|
||
using namespace EasyWinModernControl; | ||
|
||
LPCWSTR CWinUINumberBox::xml = LR"( | ||
<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
</StackPanel>)"; | ||
|
||
CWinUINumberBox::CWinUINumberBox(LPCWSTR controlName, LPCWSTR headerTitle, LPCWSTR textPlaceholder) { | ||
if (controlName) { | ||
this->_numBox.Name(controlName); | ||
} | ||
|
||
if (headerTitle) { | ||
this->_numBox.Header(winrt::box_value(headerTitle)); | ||
} | ||
|
||
if (textPlaceholder) { | ||
this->_numBox.PlaceholderText(textPlaceholder); | ||
} | ||
|
||
//fix normal control focus issue | ||
this->_numBox.GettingFocus([this](const winrt::Windows::Foundation::IInspectable& sender, const RoutedEventArgs& args) | ||
{ | ||
SendMessageW(this->GetParentHwnd(), WM_SETFOCUS, 0, 0); | ||
}); | ||
} | ||
|
||
CWinUINumberBox::~CWinUINumberBox() { | ||
|
||
} | ||
|
||
void CWinUINumberBox::SetButtonType(DWORD mode) { | ||
if (mode == 1) { | ||
this->_numBox.SpinButtonPlacementMode(Microsoft::UI::Xaml::Controls::NumberBoxSpinButtonPlacementMode::Compact); | ||
} | ||
else if (mode == 2) { | ||
this->_numBox.SpinButtonPlacementMode(Microsoft::UI::Xaml::Controls::NumberBoxSpinButtonPlacementMode::Inline); | ||
} | ||
else { | ||
this->_numBox.SpinButtonPlacementMode(Microsoft::UI::Xaml::Controls::NumberBoxSpinButtonPlacementMode::Hidden); | ||
} | ||
} | ||
|
||
void CWinUINumberBox::SetValue(DOUBLE value) { | ||
this->_numBox.Value(value); | ||
} | ||
|
||
|
||
void CWinUINumberBox::SetMinValue(DOUBLE val) { | ||
this->_numBox.Minimum(val); | ||
} | ||
|
||
void CWinUINumberBox::SetMaxValue(DOUBLE val) { | ||
this->_numBox.Maximum(val); | ||
} | ||
|
||
DOUBLE CWinUINumberBox::GetValue() { | ||
return this->_numBox.Value(); | ||
} | ||
|
||
void CWinUINumberBox::SetChangeStep(DOUBLE step) { | ||
this->_numBox.SmallChange(step); | ||
} | ||
|
||
void CWinUINumberBox::SetTemplate() { | ||
hstring str(xml); | ||
this->ins = XamlReader::Load(str); | ||
if (!this->ins) { | ||
return; | ||
} | ||
|
||
Windows::UI::Xaml::Controls::StackPanel panel = this->ins.as<Windows::UI::Xaml::Controls::StackPanel>(); | ||
|
||
panel.Children().InsertAt(0, this->_numBox); | ||
|
||
return; | ||
} | ||
|
||
void CWinUINumberBox::OnAdjustLayout() { | ||
this->_numBox.Height(this->_height); | ||
this->_numBox.Width(this->_width); | ||
} |
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,35 @@ | ||
#pragma once | ||
#include "CModernControl.h" | ||
|
||
namespace EasyWinModernControl { | ||
|
||
class CWinUINumberBox : public CModernControl | ||
{ | ||
public: | ||
CWinUINumberBox(LPCWSTR controlName, LPCWSTR headerTitle , LPCWSTR textPlaceholder); | ||
|
||
~CWinUINumberBox(); | ||
|
||
void SetButtonType(DWORD mode); | ||
|
||
void SetValue(DOUBLE value); | ||
|
||
void SetMinValue(DOUBLE val); | ||
|
||
void SetMaxValue(DOUBLE val); | ||
|
||
void SetChangeStep(DOUBLE step); | ||
|
||
DOUBLE GetValue(); | ||
|
||
protected: | ||
void SetTemplate(); | ||
void OnAdjustLayout(); | ||
|
||
private: | ||
Microsoft::UI::Xaml::Controls::NumberBox _numBox; | ||
|
||
static LPCWSTR xml; | ||
}; | ||
} | ||
|
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,39 @@ | ||
#include "stdafx.h" | ||
#include "CWinUIProgressRing.h" | ||
|
||
using namespace EasyWinModernControl; | ||
|
||
LPCWSTR CWinUIProgressRing::xml = LR"( | ||
<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
</StackPanel>)"; | ||
|
||
CWinUIProgressRing::CWinUIProgressRing(LPCWSTR controlName) { | ||
if (controlName) { | ||
this->_ring.Name(controlName); | ||
} | ||
} | ||
CWinUIProgressRing::~CWinUIProgressRing() { | ||
|
||
} | ||
|
||
void CWinUIProgressRing::SetTemplate() { | ||
hstring str(xml); | ||
this->ins = XamlReader::Load(str); | ||
if (!this->ins) { | ||
return; | ||
} | ||
|
||
this->_ring.IsActive(true); | ||
|
||
Windows::UI::Xaml::Controls::StackPanel panel = this->ins.as<Windows::UI::Xaml::Controls::StackPanel>(); | ||
|
||
panel.Children().InsertAt(0, this->_ring); | ||
|
||
return; | ||
} | ||
|
||
void CWinUIProgressRing::OnAdjustLayout() { | ||
this->_ring.Height(this->_height); | ||
this->_ring.Width(this->_width); | ||
} |
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,22 @@ | ||
#pragma once | ||
#include "CModernControl.h" | ||
|
||
namespace EasyWinModernControl { | ||
|
||
class CWinUIProgressRing : public CModernControl | ||
{ | ||
public: | ||
CWinUIProgressRing(LPCWSTR controlName); | ||
~CWinUIProgressRing(); | ||
|
||
protected: | ||
void SetTemplate(); | ||
void OnAdjustLayout(); | ||
|
||
private: | ||
Microsoft::UI::Xaml::Controls::ProgressRing _ring; | ||
|
||
static LPCWSTR xml; | ||
}; | ||
|
||
} |
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,50 @@ | ||
#include "stdafx.h" | ||
#include "CWinUIProgressbar.h" | ||
|
||
using namespace EasyWinModernControl; | ||
|
||
LPCWSTR CWinUIProgressbar::xml = LR"( | ||
<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
</StackPanel>)"; | ||
|
||
CWinUIProgressbar::CWinUIProgressbar(LPCWSTR controlName, DOUBLE minVal, DOUBLE maxVal) { | ||
if (controlName) { | ||
this->_progressbar.Name(controlName); | ||
} | ||
|
||
this->_progressbar.Minimum(minVal); | ||
this->_progressbar.Maximum(maxVal); | ||
} | ||
|
||
CWinUIProgressbar::~CWinUIProgressbar() { | ||
|
||
} | ||
|
||
void CWinUIProgressbar::SetValue(BOOL isIndeterminate, BOOL isPause, DOUBLE value) { | ||
this->_progressbar.IsIndeterminate(isIndeterminate); | ||
|
||
if (!isIndeterminate) { | ||
this->_progressbar.Value(value); | ||
} | ||
|
||
this->_progressbar.ShowPaused(isPause); | ||
} | ||
|
||
void CWinUIProgressbar::SetTemplate() { | ||
hstring str(xml); | ||
this->ins = XamlReader::Load(str); | ||
if (!this->ins) { | ||
return; | ||
} | ||
|
||
Windows::UI::Xaml::Controls::StackPanel panel = this->ins.as<Windows::UI::Xaml::Controls::StackPanel>(); | ||
|
||
panel.Children().InsertAt(0, this->_progressbar); | ||
|
||
} | ||
|
||
void CWinUIProgressbar::OnAdjustLayout() { | ||
this->_progressbar.Height(_height); | ||
this->_progressbar.Width(_width); | ||
} |
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 "CModernControl.h" | ||
|
||
namespace EasyWinModernControl { | ||
|
||
class CWinUIProgressbar : public CModernControl | ||
{ | ||
public: | ||
CWinUIProgressbar(LPCWSTR controlName, DOUBLE minVal, DOUBLE maxVal); | ||
~CWinUIProgressbar(); | ||
|
||
void SetValue(BOOL isIndeterminate, BOOL isPause, DOUBLE value); | ||
|
||
protected: | ||
void SetTemplate(); | ||
void OnAdjustLayout(); | ||
|
||
private: | ||
Microsoft::UI::Xaml::Controls::ProgressBar _progressbar; | ||
|
||
static LPCWSTR xml; | ||
}; | ||
|
||
} |
Oops, something went wrong.