File Index
Symbol Index
/*********************************************************************** Vczh Library++ 3.0 Developer: Zihan Chen(vczh) GacUI::Control System Interfaces: ***********************************************************************/
#ifndef VCZH_PRESENTATION_CONTROLS_GUITEXTCONTROLS
#define VCZH_PRESENTATION_CONTROLS_GUITEXTCONTROLS
#include "GuiTextCommonInterface.h"
#include "../GuiContainerControls.h"
namespace
vl
{
namespace
presentation
{
namespace
controls
{
/*********************************************************************** MultilineTextBox ***********************************************************************/
/// <summary>Multiline text box control.</summary>
class
GuiMultilineTextBox
:
public
GuiScrollView
,
public
GuiTextBoxCommonInterface
,
public
Description
<
GuiMultilineTextBox
> {
GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(MultilineTextBoxTemplate, GuiScrollView)
public
:
using
ControlTemplateType
=
templates
::
GuiMultilineTextBoxTemplate
;
private
:
templates
::
GuiMultilineTextBoxTemplate
*
controlTemplateObject29
=
nullptr
;
void
BeforeControlTemplateUninstalled_
();
void
AfterControlTemplateInstalled_
(
bool
initialize
);
protected
:
void
BeforeControlTemplateUninstalled
()
override
{
BeforeControlTemplateUninstalled_
();
GuiScrollView
::
BeforeControlTemplateUninstalled
(); }
void
AfterControlTemplateInstalled
(
bool
initialize
)
override
{
GuiScrollView
::
AfterControlTemplateInstalled
(
initialize
);
AfterControlTemplateInstalled_
(
initialize
); }
void
CheckAndStoreControlTemplate
(
templates
::
GuiControlTemplate
*
value
)
override
{
auto
ct
=
dynamic_cast
<
templates
::
GuiMultilineTextBoxTemplate
*>(
value
);
do
{
if
(!(
ct
))
throw
Error
(
L"The assigned control template is not vl::presentation::templates::Gui"
L"MultilineTextBoxTemplate"
L"."
);}
while
(
0
);
controlTemplateObject29
=
ct
;
GuiScrollView
::
CheckAndStoreControlTemplate
(
value
); }
public
:
templates
::
GuiMultilineTextBoxTemplate
*
TypedControlTemplateObject
(
bool
ensureExists
) {
if
(
ensureExists
) {
EnsureControlTemplateExists
(); }
return
controlTemplateObject29
; }
private
:
public
:
static
const
vint
TextMargin
=
3
;
class
CommandExecutor
:
public
Object
,
public
ITextBoxCommandExecutor
{
protected
:
GuiMultilineTextBox
*
textBox
;
public
:
CommandExecutor
(
GuiMultilineTextBox
*
_textBox
);
~
CommandExecutor
();
void
UnsafeSetText
(
const
WString
&
value
)
override
; };
protected
:
class
TextElementOperatorCallback
:
public
GuiTextBoxCommonInterface
::
DefaultCallback
,
public
Description
<
TextElementOperatorCallback
> {
protected
:
GuiMultilineTextBox
*
textControl
;
public
:
TextElementOperatorCallback
(
GuiMultilineTextBox
*
_textControl
);
void
AfterModify
(
TextPos
originalStart
,
TextPos
originalEnd
,
const
WString
&
originalText
,
TextPos
inputStart
,
TextPos
inputEnd
,
const
WString
&
inputText
)
override
;
void
ScrollToView
(
Point
point
)
override
;
vint
GetTextMargin
()
override
; };
protected
:
Ptr
<
TextElementOperatorCallback
>
callback
;
Ptr
<
CommandExecutor
>
commandExecutor
;
elements
::
GuiColorizedTextElement
*
textElement
=
nullptr
;
compositions
::
GuiBoundsComposition
*
textComposition
=
nullptr
;
void
UpdateVisuallyEnabled
()
override
;
void
UpdateDisplayFont
()
override
;
void
OnRenderTargetChanged
(
elements
::
IGuiGraphicsRenderTarget
*
renderTarget
)
override
;
Size
QueryFullSize
()
override
;
void
UpdateView
(
Rect
viewBounds
)
override
;
void
CalculateViewAndSetScroll
();
void
OnBoundsMouseButtonDown
(
compositions
::
GuiGraphicsComposition
*
sender
,
compositions
::
GuiMouseEventArgs
&
arguments
);
public
:
/// <summary>Create a control with a specified style provider.</summary>
/// <param name="themeName">The theme name for retriving a default control template.</param>
GuiMultilineTextBox
(
theme
::
ThemeName
themeName
);
~
GuiMultilineTextBox
();
const
WString
&
GetText
()
override
;
void
SetText
(
const
WString
&
value
)
override
; };
/*********************************************************************** SinglelineTextBox ***********************************************************************/
/// <summary>Single text box control.</summary>
class
GuiSinglelineTextBox
:
public
GuiControl
,
public
GuiTextBoxCommonInterface
,
public
Description
<
GuiSinglelineTextBox
> {
GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(SinglelineTextBoxTemplate, GuiControl)
public
:
using
ControlTemplateType
=
templates
::
GuiSinglelineTextBoxTemplate
;
private
:
templates
::
GuiSinglelineTextBoxTemplate
*
controlTemplateObject88
=
nullptr
;
void
BeforeControlTemplateUninstalled_
();
void
AfterControlTemplateInstalled_
(
bool
initialize
);
protected
:
void
BeforeControlTemplateUninstalled
()
override
{
BeforeControlTemplateUninstalled_
();
GuiControl
::
BeforeControlTemplateUninstalled
(); }
void
AfterControlTemplateInstalled
(
bool
initialize
)
override
{
GuiControl
::
AfterControlTemplateInstalled
(
initialize
);
AfterControlTemplateInstalled_
(
initialize
); }
void
CheckAndStoreControlTemplate
(
templates
::
GuiControlTemplate
*
value
)
override
{
auto
ct
=
dynamic_cast
<
templates
::
GuiSinglelineTextBoxTemplate
*>(
value
);
do
{
if
(!(
ct
))
throw
Error
(
L"The assigned control template is not vl::presentation::templates::Gui"
L"SinglelineTextBoxTemplate"
L"."
);}
while
(
0
);
controlTemplateObject88
=
ct
;
GuiControl
::
CheckAndStoreControlTemplate
(
value
); }
public
:
templates
::
GuiSinglelineTextBoxTemplate
*
TypedControlTemplateObject
(
bool
ensureExists
) {
if
(
ensureExists
) {
EnsureControlTemplateExists
(); }
return
controlTemplateObject88
; }
private
:
public
:
static
const
vint
TextMargin
=
2
;
protected
:
class
TextElementOperatorCallback
:
public
GuiTextBoxCommonInterface
::
DefaultCallback
,
public
Description
<
TextElementOperatorCallback
> {
public
:
TextElementOperatorCallback
(
GuiSinglelineTextBox
*
_textControl
);
bool
BeforeModify
(
TextPos
start
,
TextPos
end
,
const
WString
&
originalText
,
WString
&
inputText
)
override
;
void
AfterModify
(
TextPos
originalStart
,
TextPos
originalEnd
,
const
WString
&
originalText
,
TextPos
inputStart
,
TextPos
inputEnd
,
const
WString
&
inputText
)
override
;
void
ScrollToView
(
Point
point
)
override
;
vint
GetTextMargin
()
override
; };
protected
:
Ptr
<
TextElementOperatorCallback
>
callback
;
elements
::
GuiColorizedTextElement
*
textElement
=
nullptr
;
compositions
::
GuiTableComposition
*
textCompositionTable
=
nullptr
;
compositions
::
GuiCellComposition
*
textComposition
=
nullptr
;
void
UpdateVisuallyEnabled
()
override
;
void
UpdateDisplayFont
()
override
;
void
RearrangeTextElement
();
void
OnRenderTargetChanged
(
elements
::
IGuiGraphicsRenderTarget
*
renderTarget
)
override
;
void
OnBoundsMouseButtonDown
(
compositions
::
GuiGraphicsComposition
*
sender
,
compositions
::
GuiMouseEventArgs
&
arguments
);
public
:
/// <summary>Create a control with a specified style provider.</summary>
/// <param name="themeName">The theme name for retriving a default control template.</param>
GuiSinglelineTextBox
(
theme
::
ThemeName
themeName
);
~
GuiSinglelineTextBox
();
const
WString
&
GetText
()
override
;
void
SetText
(
const
WString
&
value
)
override
;
/// <summary>
/// Get the password mode displaying character.
/// </summary>
/// <returns>The password mode displaying character. Returns L'\0' means the password mode is not activated.</returns>
wchar_t
GetPasswordChar
();
/// <summary>
/// Set the password mode displaying character.
/// </summary>
/// <param name="value">The password mode displaying character. Set to L'\0' to deactivate the password mode.</param>
void
SetPasswordChar
(
wchar_t
value
); }; } } }
#endif