ReactOS 0.4.17-dev-470-gf9e3448
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 769 of file mouse.cpp.

Member Function Documentation

◆ draw()

void TextTool::draw ( HDC  hdc)
inline

Definition at line 803 of file mouse.cpp.

804 {
805 CStringW szText;
806 textEditWindow.GetWindowText(szText);
807
808 CRect rc;
811 rc.InflateRect(-GRIP_SIZE / 2, -GRIP_SIZE / 2);
812
813 // Draw the text
815 Text(hdc, rc.left, rc.top, rc.right, rc.bottom, toolsModel.GetFgBrush(), toolsModel.GetBgBrush(), szText,
817 }
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
HBRUSH GetFgBrush()
Definition: toolsmodel.cpp:357
HBRUSH GetBgBrush()
Definition: toolsmodel.cpp:362
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:282
char * Text
Definition: combotst.c:136
HDC hdc
Definition: main.c:9
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 789 of file mouse.cpp.

790 {
791 if (!textEditWindow.IsWindow())
793
794 UpdatePoint(x, y);
795 }
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:781

◆ OnButtonUp()

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

Reimplemented from ToolBase.

Definition at line 826 of file mouse.cpp.

827 {
828 POINT pt = { x, y };
831
832 BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);
833 if (bTextBoxShown)
834 {
835 if (textEditWindow.GetWindowTextLength() > 0)
836 {
838 draw(m_hdc);
839 }
841 {
842 quit();
843 return TRUE;
844 }
845 }
846
848 {
849 if (!fontsDialog.IsWindow())
850 fontsDialog.Create(mainWindow);
851
852 fontsDialog.ShowWindow(SW_SHOWNOACTIVATE);
853 }
854
856
857 // Enlarge if tool small
860 {
861 rc.SetRect(x, y, x + cxMin, y + cyMin);
862 }
863 else
864 {
865 if (rc.right - rc.left < cxMin)
866 rc.right = rc.left + cxMin;
867 if (rc.bottom - rc.top < cyMin)
868 rc.bottom = rc.top + cyMin;
869 }
870
871 if (!textEditWindow.IsWindow())
873
874 textEditWindow.SetWindowText(NULL);
877 textEditWindow.SetFocus();
878 return TRUE;
879 }
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:819
void draw(HDC hdc)
Definition: mouse.cpp:803
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 771 of file mouse.cpp.

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

◆ OnEndDraw()

void TextTool::OnEndDraw ( BOOL  bCancel)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 881 of file mouse.cpp.

882 {
883 if (!bCancel)
884 {
886 textEditWindow.GetWindowTextLength() > 0)
887 {
889 draw(m_hdc);
890 }
891 }
892 quit();
893 ToolBase::OnEndDraw(bCancel);
894 }
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 797 of file mouse.cpp.

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

◆ quit()

void TextTool::quit ( )
inline

Definition at line 819 of file mouse.cpp.

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

Referenced by OnButtonUp(), and OnEndDraw().

◆ UpdatePoint()

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

Definition at line 781 of file mouse.cpp.

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

Referenced by OnButtonDown(), and OnMouseMove().


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