ReactOS 0.4.15-dev-7924-g5949c20
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 764 of file mouse.cpp.

Member Function Documentation

◆ draw()

void TextTool::draw ( HDC  hdc)
inline

Definition at line 798 of file mouse.cpp.

799 {
800 CStringW szText;
801 textEditWindow.GetWindowText(szText);
802
803 CRect rc;
806 rc.InflateRect(-GRIP_SIZE / 2, -GRIP_SIZE / 2);
807
808 // Draw the text
810 Text(hdc, rc.left, rc.top, rc.right, rc.bottom, m_fg, m_bg, szText,
812 }
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:249
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:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
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 784 of file mouse.cpp.

785 {
786 if (!textEditWindow.IsWindow())
788
789 UpdatePoint(x, y);
790 }
CCanvasWindow canvasWindow
Definition: canvas.cpp:10
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:776

◆ OnButtonUp()

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

Reimplemented from ToolBase.

Definition at line 821 of file mouse.cpp.

822 {
823 POINT pt = { x, y };
826
827 BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);
828 if (bTextBoxShown)
829 {
830 if (textEditWindow.GetWindowTextLength() > 0)
831 {
833 draw(m_hdc);
834 }
836 {
837 quit();
838 return TRUE;
839 }
840 }
841
843 {
844 if (!fontsDialog.IsWindow())
845 fontsDialog.Create(mainWindow);
846
847 fontsDialog.ShowWindow(SW_SHOWNOACTIVATE);
848 }
849
851
852 // Enlarge if tool small
855 {
856 rc.SetRect(x, y, x + cxMin, y + cyMin);
857 }
858 else
859 {
860 if (rc.right - rc.left < cxMin)
861 rc.right = rc.left + cxMin;
862 if (rc.bottom - rc.top < cyMin)
863 rc.bottom = rc.top + cyMin;
864 }
865
866 if (!textEditWindow.IsWindow())
868
869 textEditWindow.SetWindowText(NULL);
872 textEditWindow.SetFocus();
873 return TRUE;
874 }
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:127
void Clamp(POINT &pt) const
Definition: history.cpp:314
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:4312
static INT cyMin
Definition: eventvwr.c:4312
unsigned int BOOL
Definition: ntddk_ex.h:94
ImageModel imageModel
Definition: history.cpp:11
void quit()
Definition: mouse.cpp:814
void draw(HDC hdc)
Definition: mouse.cpp:798
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:774
BOOL WINAPI IsWindowVisible(_In_ HWND)

◆ OnDrawOverlayOnImage()

void TextTool::OnDrawOverlayOnImage ( HDC  hdc)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 766 of file mouse.cpp.

767 {
769 {
771 if (!rc.IsRectEmpty())
772 RectSel(hdc, rc.left, rc.top, rc.right, rc.bottom);
773 }
774 }
BOOL m_drawing
Definition: canvas.h:43
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 876 of file mouse.cpp.

877 {
878 if (!bCancel)
879 {
881 textEditWindow.GetWindowTextLength() > 0)
882 {
884 draw(m_hdc);
885 }
886 }
887 quit();
888 ToolBase::OnEndDraw(bCancel);
889 }
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 792 of file mouse.cpp.

793 {
794 UpdatePoint(x, y);
795 return TRUE;
796 }

◆ quit()

void TextTool::quit ( )
inline

Definition at line 814 of file mouse.cpp.

815 {
816 if (textEditWindow.IsWindow())
817 textEditWindow.ShowWindow(SW_HIDE);
819 }
#define SW_HIDE
Definition: winuser.h:768

Referenced by OnButtonUp(), and OnEndDraw().

◆ UpdatePoint()

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

Definition at line 776 of file mouse.cpp.

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

Referenced by OnButtonDown(), and OnMouseMove().


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