ReactOS 0.4.17-dev-357-ga8f14ff
TextTool Struct Reference
Inheritance diagram for TextTool:
Collaboration diagram for TextTool:

Public Member Functions

void OnDrawOverlayOnImage (HDC hdc) override
 
void UpdatePoint (LONG x, LONG y)
 
void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
 
BOOL OnMouseMove (BOOL bLeftButton, LONG &x, LONG &y) override
 
void draw (HDC hdc)
 
void quit ()
 
BOOL OnButtonUp (BOOL bLeftButton, LONG &x, LONG &y) override
 
void OnEndDraw (BOOL bCancel) override
 
- Public Member Functions inherited from ToolBase
 ToolBase ()
 
virtual ~ToolBase ()
 
virtual void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
 
virtual BOOL OnMouseMove (BOOL bLeftButton, LONG &x, LONG &y)
 
virtual BOOL OnButtonUp (BOOL bLeftButton, LONG &x, LONG &y)
 
virtual void OnDrawOverlayOnImage (HDC hdc)
 
virtual void OnDrawOverlayOnCanvas (HDC hdc)
 
virtual void OnSpecialTweak (BOOL bMinus)
 
virtual void OnEndDraw (BOOL bCancel)
 
void beginEvent ()
 
void endEvent ()
 
void reset ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ToolBase
static ToolBasecreateToolObject (TOOLTYPE type)
 
- Public Attributes inherited from ToolBase
HDC m_hdc
 
COLORREF m_fg
 
COLORREF m_bg
 

Detailed Description

Definition at line 768 of file mouse.cpp.

Member Function Documentation

◆ draw()

void TextTool::draw ( HDC  hdc)
inline

Definition at line 802 of file mouse.cpp.

803 {
804 CStringW szText;
805 textEditWindow.GetWindowText(szText);
806
807 CRect rc;
810 rc.InflateRect(-GRIP_SIZE / 2, -GRIP_SIZE / 2);
811
812 // Draw the text
814 Text(hdc, rc.left, rc.top, rc.right, rc.bottom, m_fg, m_bg, szText,
816 }
Arabic default style
Definition: afstyles.h:94
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
#define GRIP_SIZE
Definition: precomp.h:43
CTextEditWindow textEditWindow
Definition: textedit.cpp:12
void InflateRect(int x, int y) noexcept
Definition: atltypes.h:323
BOOL GetEditRect(LPRECT prc) const
Definition: textedit.cpp:377
void InvalidateEditRect()
Definition: textedit.cpp:281
HFONT GetFont() const
Definition: textedit.h:25
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:258
char * Text
Definition: combotst.c:136
HDC hdc
Definition: main.c:9
COLORREF m_fg
Definition: toolsmodel.h:44
COLORREF m_bg
Definition: toolsmodel.h:44
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
int32_t INT
Definition: typedefs.h:58

Referenced by OnButtonUp(), and OnEndDraw().

◆ OnButtonDown()

void TextTool::OnButtonDown ( BOOL  bLeftButton,
LONG  x,
LONG  y,
BOOL  bDoubleClick 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 788 of file mouse.cpp.

789 {
790 if (!textEditWindow.IsWindow())
792
793 UpdatePoint(x, y);
794 }
CCanvasWindow canvasWindow
Definition: canvas.cpp:11
HWND Create(HWND hwndParent)
Definition: textedit.cpp:224
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
void UpdatePoint(LONG x, LONG y)
Definition: mouse.cpp:780

◆ OnButtonUp()

BOOL TextTool::OnButtonUp ( BOOL  bLeftButton,
LONG x,
LONG y 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 825 of file mouse.cpp.

826 {
827 POINT pt = { x, y };
830
831 BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);
832 if (bTextBoxShown)
833 {
834 if (textEditWindow.GetWindowTextLength() > 0)
835 {
837 draw(m_hdc);
838 }
840 {
841 quit();
842 return TRUE;
843 }
844 }
845
847 {
848 if (!fontsDialog.IsWindow())
849 fontsDialog.Create(mainWindow);
850
851 fontsDialog.ShowWindow(SW_SHOWNOACTIVATE);
852 }
853
855
856 // Enlarge if tool small
859 {
860 rc.SetRect(x, y, x + cxMin, y + cyMin);
861 }
862 else
863 {
864 if (rc.right - rc.left < cxMin)
865 rc.right = rc.left + cxMin;
866 if (rc.bottom - rc.top < cyMin)
867 rc.bottom = rc.top + cyMin;
868 }
869
870 if (!textEditWindow.IsWindow())
872
873 textEditWindow.SetWindowText(NULL);
876 textEditWindow.SetFocus();
877 return TRUE;
878 }
CFontsDialog fontsDialog
Definition: dialogs.cpp:16
CMainWindow mainWindow
Definition: main.cpp:25
static POINT g_ptStart
Definition: mouse.cpp:17
RegistrySettings registrySettings
Definition: registry.cpp:14
SelectionModel selectionModel
void SetRect(int x1, int y1, int x2, int y2) noexcept
Definition: atltypes.h:423
BOOL IsRectEmpty() const noexcept
Definition: atltypes.h:351
void ValidateEditRect(LPCRECT prc OPTIONAL)
Definition: textedit.cpp:383
void PushImageForUndo()
Definition: history.cpp:125
void Clamp(POINT &pt) const
Definition: history.cpp:315
DWORD ShowTextTool
Definition: registry.h:41
void SetRectFromPoints(const POINT &ptFrom, const POINT &ptTo)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
static INT cxMin
Definition: eventvwr.c:4340
static INT cyMin
Definition: eventvwr.c:4340
unsigned int BOOL
Definition: ntddk_ex.h:94
ImageModel imageModel
Definition: history.cpp:11
void quit()
Definition: mouse.cpp:818
void draw(HDC hdc)
Definition: mouse.cpp:802
HDC m_hdc
Definition: toolsmodel.h:43
#define CY_MINTEXTEDIT
Definition: textedit.h:11
#define CX_MINTEXTEDIT
Definition: textedit.h:10
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
BOOL WINAPI IsWindowVisible(_In_ HWND)

◆ OnDrawOverlayOnImage()

void TextTool::OnDrawOverlayOnImage ( HDC  hdc)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 770 of file mouse.cpp.

771 {
773 {
775 if (!rc.IsRectEmpty())
776 RectSel(hdc, rc.left, rc.top, rc.right, rc.bottom);
777 }
778 }
BOOL m_drawing
Definition: canvas.h:76
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
Definition: drawing.cpp:233

◆ OnEndDraw()

void TextTool::OnEndDraw ( BOOL  bCancel)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 880 of file mouse.cpp.

881 {
882 if (!bCancel)
883 {
885 textEditWindow.GetWindowTextLength() > 0)
886 {
888 draw(m_hdc);
889 }
890 }
891 quit();
892 ToolBase::OnEndDraw(bCancel);
893 }
virtual void OnEndDraw(BOOL bCancel)
Definition: mouse.cpp:125

◆ OnMouseMove()

BOOL TextTool::OnMouseMove ( BOOL  bLeftButton,
LONG x,
LONG y 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 796 of file mouse.cpp.

797 {
798 UpdatePoint(x, y);
799 return TRUE;
800 }

◆ quit()

void TextTool::quit ( )
inline

Definition at line 818 of file mouse.cpp.

819 {
820 if (textEditWindow.IsWindow())
821 textEditWindow.ShowWindow(SW_HIDE);
823 }
#define SW_HIDE
Definition: winuser.h:779

Referenced by OnButtonUp(), and OnEndDraw().

◆ UpdatePoint()

void TextTool::UpdatePoint ( LONG  x,
LONG  y 
)
inline

Definition at line 780 of file mouse.cpp.

781 {
782 POINT pt = { x, y };
786 }
void NotifyImageChanged()
Definition: history.cpp:23

Referenced by OnButtonDown(), and OnMouseMove().


The documentation for this struct was generated from the following file: