ReactOS 0.4.15-dev-6679-g945ee4b
TextTool Struct Reference
Inheritance diagram for TextTool:
Collaboration diagram for TextTool:

Public Member Functions

 TextTool ()
 
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 OnFinishDraw () override
 
void OnCancelDraw () override
 
- Public Member Functions inherited from ToolBase
 ToolBase (TOOLTYPE tool)
 
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 OnCancelDraw ()
 
virtual void OnFinishDraw ()
 
virtual void OnDrawOverlayOnImage (HDC hdc)
 
virtual void OnDrawOverlayOnCanvas (HDC hdc)
 
virtual void OnSpecialTweak (BOOL bMinus)
 
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
TOOLTYPE m_tool
 
HDC m_hdc
 
COLORREF m_fg
 
COLORREF m_bg
 
- Static Public Attributes inherited from ToolBase
static INT s_pointSP = 0
 
static POINT s_pointStack [256] = { { 0 } }
 
- Protected Member Functions inherited from ToolBase
void OnDrawSelectionOnCanvas (HDC hdc)
 

Detailed Description

Definition at line 647 of file mouse.cpp.

Constructor & Destructor Documentation

◆ TextTool()

TextTool::TextTool ( )
inline

Definition at line 649 of file mouse.cpp.

650 {
651 }
@ TOOL_TEXT
Definition: toolsmodel.h:21

Member Function Documentation

◆ draw()

void TextTool::draw ( HDC  hdc)
inline

Definition at line 685 of file mouse.cpp.

686 {
687 CString szText;
688 textEditWindow.GetWindowText(szText);
689
690 RECT rc;
693 ::InflateRect(&rc, -GRIP_SIZE / 2, -GRIP_SIZE / 2);
694
695 // Draw the text
697 Text(hdc, rc.left, rc.top, rc.right, rc.bottom, m_fg, m_bg, szText,
699 }
Arabic default style
Definition: afstyles.h:94
#define GRIP_SIZE
Definition: common.h:12
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:207
char * Text
Definition: combotst.c:136
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
CTextEditWindow textEditWindow
Definition: textedit.cpp:12
HDC hdc
Definition: main.c:9
COLORREF m_fg
Definition: toolsmodel.h:45
COLORREF m_bg
Definition: toolsmodel.h:45
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
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)

Referenced by OnButtonUp(), and OnFinishDraw().

◆ OnButtonDown()

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

Reimplemented from ToolBase.

Definition at line 671 of file mouse.cpp.

672 {
673 if (!textEditWindow.IsWindow())
675
676 UpdatePoint(x, y);
677 }
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:663

◆ OnButtonUp()

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

Reimplemented from ToolBase.

Definition at line 708 of file mouse.cpp.

709 {
710 POINT pt = { x, y };
713
714 BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);
715 if (bTextBoxShown)
716 {
717 if (textEditWindow.GetWindowTextLength() > 0)
718 {
720 draw(m_hdc);
721 }
723 {
724 quit();
725 return TRUE;
726 }
727 }
728
730 {
731 if (!fontsDialog.IsWindow())
732 fontsDialog.Create(mainWindow);
733
734 fontsDialog.ShowWindow(SW_SHOWNOACTIVATE);
735 }
736
738
739 // Enlarge if tool small
742 {
743 SetRect(&rc, x, y, x + cxMin, y + cyMin);
744 }
745 else
746 {
747 if (rc.right - rc.left < cxMin)
748 rc.right = rc.left + cxMin;
749 if (rc.bottom - rc.top < cyMin)
750 rc.bottom = rc.top + cyMin;
751 }
752
753 if (!textEditWindow.IsWindow())
755
756 textEditWindow.SetWindowText(NULL);
759 textEditWindow.SetFocus();
760 return TRUE;
761 }
CFontsDialog fontsDialog
Definition: dialogs.cpp:21
BOOL IsRectEmpty() const
Definition: atltypes.h:351
void ValidateEditRect(LPCRECT prc OPTIONAL)
Definition: textedit.cpp:383
void Clamp(POINT &pt) const
Definition: history.cpp:256
void PushImageForUndo(HBITMAP hbm=NULL)
Definition: history.cpp:106
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
RegistrySettings registrySettings
Definition: registry.cpp:14
SelectionModel selectionModel
CMainWindow mainWindow
Definition: main.cpp:22
POINT g_ptStart
Definition: main.cpp:13
void quit()
Definition: mouse.cpp:701
void draw(HDC hdc)
Definition: mouse.cpp:685
HDC m_hdc
Definition: toolsmodel.h:44
#define CY_MINTEXTEDIT
Definition: textedit.h:11
#define CX_MINTEXTEDIT
Definition: textedit.h:10
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

◆ OnCancelDraw()

void TextTool::OnCancelDraw ( )
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 774 of file mouse.cpp.

775 {
776 quit();
778 }
virtual void OnCancelDraw()
Definition: mouse.cpp:65

◆ OnDrawOverlayOnImage()

void TextTool::OnDrawOverlayOnImage ( HDC  hdc)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 653 of file mouse.cpp.

654 {
656 {
658 if (!::IsRectEmpty(&rc))
659 RectSel(hdc, rc.left, rc.top, rc.right, rc.bottom);
660 }
661 }
BOOL m_drawing
Definition: canvas.h:41
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
Definition: drawing.cpp:235

◆ OnFinishDraw()

void TextTool::OnFinishDraw ( )
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 763 of file mouse.cpp.

764 {
765 if (textEditWindow.GetWindowTextLength() > 0)
766 {
768 draw(m_hdc);
769 }
770 quit();
772 }
virtual void OnFinishDraw()
Definition: mouse.cpp:71

◆ OnMouseMove()

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

Reimplemented from ToolBase.

Definition at line 679 of file mouse.cpp.

680 {
681 UpdatePoint(x, y);
682 return TRUE;
683 }

◆ quit()

void TextTool::quit ( )
inline

Definition at line 701 of file mouse.cpp.

702 {
703 if (textEditWindow.IsWindow())
704 textEditWindow.ShowWindow(SW_HIDE);
706 }
#define SW_HIDE
Definition: winuser.h:762

Referenced by OnButtonUp(), OnCancelDraw(), and OnFinishDraw().

◆ UpdatePoint()

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

Definition at line 663 of file mouse.cpp.

664 {
665 POINT pt = { x, y };
669 }
void NotifyImageChanged()
Definition: history.cpp:15

Referenced by OnButtonDown(), and OnMouseMove().


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