XTPSyntaxEditCtrl.h
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:138k
- // XTPSyntaxEditCtrl.h : header file
- //
- // This file is a part of the XTREME TOOLKIT PRO MFC class library.
- // (c)1998-2008 Codejock Software, All Rights Reserved.
- //
- // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
- // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
- // CONSENT OF CODEJOCK SOFTWARE.
- //
- // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
- // IN THE XTREME SYNTAX EDIT LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
- // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
- // SINGLE COMPUTER.
- //
- // CONTACT INFORMATION:
- // support@codejock.com
- // http://www.codejock.com
- //
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_CODEJOCK_PRIVATE
- #if !defined(__XTPSYNTAXEDITSYNTAXEDITCTRL_H__)
- #define __XTPSYNTAXEDITSYNTAXEDITCTRL_H__
- //}}AFX_CODEJOCK_PRIVATE
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "XTPSyntaxEditDrawTextProcessor.h"
- #include "XTPSyntaxEditSelection.h"
- using namespace XTPSyntaxEditLexAnalyser;
- //{{AFX_CODEJOCK_PRIVATE
- typedef CMap<int,int,COLORREF,COLORREF> CXTPSyntaxEditRowColorMap;
- //}}AFX_CODEJOCK_PRIVATE
- // forwards
- class CXTPSyntaxEditBufferManager;
- class CXTPSyntaxEditConfigurationManager;
- class CXTPSyntaxEditToolTipCtrl;
- class CXTPSyntaxEditAutoCompleteWnd;
- class CXTPSyntaxEditLineMarksManager;
- typedef CList<XTP_EDIT_TEXTBLOCK, XTP_EDIT_TEXTBLOCK> CXTPSyntaxEditTextBlockList;
- typedef LPCTSTR XTP_EDIT_LINEMARKTYPE;
- struct XTP_EDIT_LMPARAM;
- //===========================================================================
- // Summary: This class is the main CWnd - based editor class. It is a rectangular
- // child window in which the user can enter and edit text.
- //
- // The control is also capable of enhance text coloring for a number
- // of specific input file types, e.c. C/C++ source files, HTML files, etc.
- // User can create and customize his own text files schemes - they are
- // independent of source files.
- // The control contains the main configuration file, which can contain
- // references to any specific configuration files. By default, this
- // file is placed in the same folder as the application executable and
- // is called <i>EditControl.ini</i>.
- // The main configuration file contains 2 blocks with references to
- // input file lexicographic schemes in the specific format (see below)
- // and color themes for the editor, which could be applied to the
- // control editing any file type. The format of the main configuration
- // file is the following:
- //<code>
- //[Schemas]
- //FileType1=SchemaFileName1.schclass
- //FileType2=SchemaFileName2.schclass
- //...
- //
- //[Themes]
- //ThemeName1=ThemeFileName1.ini
- //ThemeName2=ThemeFileName2.ini
- //...
- //</code>
- //
- // Example:
- // See also: <LINK XTPSyntaxEditLexSchemas.h, LexSchemas>
- //===========================================================================
- class _XTP_EXT_CLASS CXTPSyntaxEditCtrl : public CWnd
- {
- DECLARE_DYNAMIC(CXTPSyntaxEditCtrl)
- DECLARE_XTP_SINK(CXTPSyntaxEditCtrl, m_Sink)
- friend class CXTPSyntaxEditAutoCompleteWnd;
- friend class CXTPSyntaxEditView;
- friend class CXTPSyntaxEditCommand;
- friend class CXTPSyntaxEditPaintManager;
- friend class CXTPSyntaxEditSelection;
- friend class CSyntaxEditCtrl; // for AciveX implementation
- public:
- //-----------------------------------------------------------------------
- // Summary:
- // Default object constructor.
- //-----------------------------------------------------------------------
- CXTPSyntaxEditCtrl();
- //-----------------------------------------------------------------------
- // Summary:
- // Destroys a CXTPSyntaxEditCtrl object, handles cleanup and de- allocation
- //-----------------------------------------------------------------------
- virtual ~CXTPSyntaxEditCtrl();
- public:
- //-----------------------------------------------------------------------
- // Summary:
- // Determines if line numbering is enabled or not.
- // Returns:
- // TRUE if line numbering is enabled, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL GetLineNumbers() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Enables or disables line numbering.
- // Parameters:
- // bLineNumbers : [in] Pass TRUE to enable line numbering.
- // bUpdateReg : [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- //-----------------------------------------------------------------------
- BOOL SetLineNumbers(BOOL bLineNumbers, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Determines if Collapsible Nodes is enabled or not.
- // Returns:
- // TRUE if Collapsible Nodes area is enabled, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL GetCollapsibleNodes() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Enables or disables Collapsible Nodes area.
- // Parameters:
- // bDrawNodes : [in] Pass TRUE to show Collapsible Nodes area.
- // bUpdateReg : [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- //-----------------------------------------------------------------------
- void SetCollapsibleNodes(BOOL bDrawNodes, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Replaces all the tabs with blank spaces.
- // Returns:
- // TRUE if Untabify done successfully, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL UnTabifySelection();
- //-----------------------------------------------------------------------
- // Summary:
- // Replaces all the blank spaces with tabs.
- // Returns:
- // TRUE if Tabify done successfully, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL TabifySelection();
- //-----------------------------------------------------------------------
- // Summary:
- // Turns selected text to the lowercase.
- // Returns:
- // TRUE if performs successfully, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL LowercaseSelection();
- //-----------------------------------------------------------------------
- // Summary:
- // Turns selected text to the uppercase.
- // Returns:
- // TRUE if performs successfully, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL UppercaseSelection();
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to get current selection.
- // Returns:
- // A reference to CXTPSyntaxEditSelection object.
- // See Also: CXTPSyntaxEditSelection
- //-----------------------------------------------------------------------
- CXTPSyntaxEditSelection& GetSelection();
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to get Auto-Complete window.
- // Returns:
- // A pointer to CXTPSyntaxEditAutoCompleteWnd object.
- // See Also:
- // CXTPSyntaxEditAutoCompleteWnd
- //-----------------------------------------------------------------------
- CXTPSyntaxEditAutoCompleteWnd* GetAutoCompleteWnd();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the number of rows can be printed per page.
- // Returns:
- // int value determines the number of rows can be printed in current
- // settings.
- //-----------------------------------------------------------------------
- int GetRowPerPage();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns visibility status for given row.
- // Parameters:
- // iRow: [in] The document row number to be tested.
- // Remarks:
- // Call this member function to determine if a row of the document is
- // visible or not.
- // Returns:
- // TRUE if the row is visible, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL IsRowVisible(int iRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets right mouse button for dragging.
- // Parameters:
- // bRightButtonDrag: [in] Boolean state flag of right button drag mode.
- // Remarks:
- // Mainly used by <b>CXTPSyntaxEditView</b> for setting right button
- // drag mode. If parameter is TRUE function sets right button for
- // dragging, otherwise dragging mode is disabled for right mouse
- // button.
- // See also:
- // void CancelRightButtonDrag(), BOOL IsRightButtonDrag()
- //-----------------------------------------------------------------------
- void SetRightButtonDrag(BOOL bRightButtonDrag = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets scroll bars to enable/disable state.
- // Parameters:
- // bHorzSBar: [in] TRUE enables horizontal scroll bar; otherwise disables.
- // bVertSBar: [in] TRUE enables vertical scroll bar; otherwise disables.
- // bUpdateReg: [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- // Summary:
- // Call this member function to change state for scroll bars. This
- // function operates on either vertical and horizontal scroll bars
- // simultaneously. Disabled scroll bar is not visible.
- // Returns:
- // TRUE if scrollbars were updated, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL SetScrollBars(BOOL bHorzSBar, BOOL bVertSBar, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the if horizontal scrollbar is enabled.
- // Returns:
- // TRUE if horizontal scrollbar is enabled, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL GetHorzScrollBar() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the if vertical scrollbar is enabled.
- // Returns:
- // TRUE if vertical scrollbar is enabled, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL GetVertScrollBar() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Sets gutter to enable/disable state.
- // Parameters:
- // bSelMargin: [in] Boolean state flag of gutter.
- // bUpdateReg: [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- // Summary:
- // Call this member function to change state for gutter. Passing TRUE
- // you enable gutter. Otherwise gutter is disabled. Disabled gutter is
- // not visible.
- // See also:
- // BOOL GetSelMargin()
- //-----------------------------------------------------------------------
- BOOL SetSelMargin(BOOL bSelMargin, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns gutter state.
- // Remarks:
- // Call this member function to determine current state of gutter.
- // It may be enabled or disabled. Disabled gutter is not visible and
- // inactive.
- // Returns:
- // TRUE if gutter is enabled, FALSE otherwise
- // See also:
- // void SetSelMargin(BOOL bEnabled = TRUE)
- //-----------------------------------------------------------------------
- BOOL GetSelMargin() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Sets syntax colorization state.
- // Parameters:
- // bSyntaxColor: [in] Boolean flag determines if colorization is enabled
- // or disabled.
- // bUpdateReg: [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- // Returns:
- // Call this member function to change state syntax colorization.
- // Passing TRUE you enable syntax colorization, otherwise it is
- // disabled.
- // See also:
- // BOOL GetSyntaxColor()
- //-----------------------------------------------------------------------
- BOOL SetSyntaxColor(BOOL bSyntaxColor, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Return state of syntax colorization.
- // Summary:
- // Call this member function to determine current syntax colorization
- // state.
- // Returns:
- // TRUE if syntax colorization is enabled, FALSE otherwise.
- // See also:
- // void SetSyntaxColor(BOOL bEnable = TRUE)
- //-----------------------------------------------------------------------
- BOOL GetSyntaxColor() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Sets auto indentation state.
- // Parameters:
- // bAutoIndent: [in] boolean flag determines state auto indent.
- // bUpdateReg: [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- // Remarks:
- // Call this member function change state of auto indentation. Passing
- // TRUE you enable it, disable otherwise.
- // See also:
- // BOOL GetAutoIndent()
- //-----------------------------------------------------------------------
- BOOL SetAutoIndent(BOOL bAutoIndent, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns state of auto intend.
- // Remarks:
- // Call this member function to determine current auto intend state.
- // Returns:
- // TRUE if syntax auto indent is enabled, FALSE otherwise.
- // See also:
- // void SetAutoIndent(BOOL bEnable = TRUE)
- //-----------------------------------------------------------------------
- BOOL GetAutoIndent() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Sets the tab size.
- // Parameters:
- // nTabSize: [in] The tab size to set should be between 2 to 10.
- // bUpdateReg: [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- // Remarks:
- // Call this member function to set tab size. Size is measured in
- // space character and should be between 2 to 10.
- // See also:
- // int GetTabSize()
- //-----------------------------------------------------------------------
- BOOL SetTabSize(int nTabSize, BOOL bUpdateReg = FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the tab size.
- // Returns:
- // Actual tab size is number of character.
- // See also:
- // void SetTabSize(int iTabSize)
- //-----------------------------------------------------------------------
- int GetTabSize() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the status if tab should be replaced by space.
- // Returns:
- // Returns TRUE if tab is enabled, FALSE otherwise.
- // See also:
- // void SetTabWithSpace(BOOL bReplace = TRUE);
- //-----------------------------------------------------------------------
- BOOL GetTabWithSpace() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Enables/disables replacing tabs with spaces.
- // Parameters:
- // bTabWithSpace: [in] Boolean flag determines enable/disable state.
- // bUpdateReg: [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- // Remarks:
- // Call this member function to enable/disable replacing tabs with space
- // Pass TRUE if tab should be replaced with space, FALSE otherwise.
- // See also:
- // BOOL GetTabWithSpace()
- //-----------------------------------------------------------------------
- BOOL SetTabWithSpace(BOOL bTabWithSpace, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Set the text color of the specified row in the colors cache.
- // Parameters:
- // nRow : [in] A row identifier for changing the foreground color.
- // clrFront : [in] An actual text color foreground.
- // See also:
- // GetRowColor(int nRow);
- //-----------------------------------------------------------------------
- void SetRowColor(int nRow, COLORREF clrFront);
- //-----------------------------------------------------------------------
- // Summary:
- // Gets the text color of the specified row in the colors cache.
- // Parameters:
- // nRow : [in] A row identifier for getting the foreground color.
- // Returns:
- // The actual text color foreground as a COLORREF value.
- // See also:
- // SetRowColor(int nRow);
- //-----------------------------------------------------------------------
- COLORREF GetRowColor(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets the background color of a specified row in the colors cache.
- // Parameters:
- // nRow : [in] A row identifier to set the background color.
- // crBack : [in] A background color
- // See also:
- // COLORREF GetRowBkColor(int nRow);
- //-----------------------------------------------------------------------
- void SetRowBkColor(int nRow, COLORREF crBack);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the background color of the specified row in the colors cache.
- // Parameters:
- // nRow - Specifies the document row.
- // Returns:
- // COLORREF value of the current background color
- // See also:
- // void SetRowBkColor(int nRow, COLORREF crBack);
- //-----------------------------------------------------------------------
- COLORREF GetRowBkColor(int nRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the status if white space should be shown or not.
- // Remarks:
- // Call this member function to determine if currently white space
- // should be shown or not.
- // Returns:
- // TRUE if white space should be shown, FALSE otherwise.
- // See also:
- // void EnableWhiteSpace(BOOL bShow = TRUE)
- //-----------------------------------------------------------------------
- BOOL IsEnabledWhiteSpace();
- //-----------------------------------------------------------------------
- // Summary:
- // Enables/disables showing white spaces.
- // Parameters:
- // bShow: [in] Boolean flag determines if white space should be shown
- // or not
- // Summary:
- // Call tis member function to enable or disable showing white spaces
- // facility. Pass TRUE if white space should be shown, FALSE otherwise.
- // See also:
- // BOOL IsEnabledWhiteSpace()
- //-----------------------------------------------------------------------
- void EnableWhiteSpace(BOOL bShow = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the status of Virtual Space mode.
- // Returns:
- // TRUE if Virtual Space mode enabled, FALSE otherwise.
- // See also:
- // EnableVirtualSpace
- //-----------------------------------------------------------------------
- BOOL IsEnabledVirtualSpace() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Enables/disables a Virtual Space mode.
- // Parameters:
- // bEnable : [in] Set as TRUE to enable Virtual Space mode and as FALSE
- // to disable.
- // bUpdateReg : [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- // Summary:
- // Call tis member function to enable or disable showing white spaces
- // facility. Pass TRUE if white space should be shown, FALSE otherwise.
- // See also:
- // BOOL IsEnabledWhiteSpace()
- //-----------------------------------------------------------------------
- void EnableVirtualSpace(BOOL bEnable, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns state flag of mouse right button for drag or not.
- // Remarks:
- // Call this member function to determine if mouse right button is
- // currently enabled for dragging.
- // Returns:
- // TRUE if right button drag is enabled, FALSE otherwise.
- // See also:
- // void SetRightButtonDrag(BOOL bRightButtonDrag = TRUE)
- // void CancelRightButtonDrag();
- //-----------------------------------------------------------------------
- BOOL IsRightButtonDrag();
- //-----------------------------------------------------------------------
- // Summary:
- // Cancels right button drag.
- // Remarks:
- // Call this member function to cancel right button drag. It is mainly
- // by by CXTPSyntaxEditView class.
- // See also:
- // void SetRightButtonDrag(BOOL bRightButtonDrag = TRUE),
- // IsRightButtonDrag()
- // CXTPSyntaxEditView
- //-----------------------------------------------------------------------
- void CancelRightButtonDrag();
- //-----------------------------------------------------------------------
- // Summary:
- // Displays the default context menu.
- // Remarks:
- // This member function calls OnContextMenu().
- // See also:
- // OnContextMenu()
- //-----------------------------------------------------------------------
- void ShowDefaultContextMenu();
- //-----------------------------------------------------------------------
- // Summary:
- // Handle the drop operation within the same edit buffer.
- // Parameters:
- // bCopy: [in] TRUE if drag is to copy, FALSE to specify a move.
- //-----------------------------------------------------------------------
- void HandleDrop(BOOL bCopy);
- //-----------------------------------------------------------------------
- // Summary: Call this method to move to the row
- // Parameters:
- // iRow - [in] row index.
- // bSelectRow - [in] select row if TRUE.
- //-----------------------------------------------------------------------
- void GoToRow(int iRow, BOOL bSelectRow = FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Replaces a selection with the supplied text.
- // Parameters:
- // szNewText: [in] The text to be pasted into the selected part.
- // Returns:
- // TRUE if replaced, FALSE otherwise
- //-----------------------------------------------------------------------
- BOOL ReplaceSel(LPCTSTR szNewText);
- //-----------------------------------------------------------------------
- // Summary:
- // Replaces all occurrences of szFindText to szReplaceText.
- // Parameters:
- // szFindText : [in] Pointer to text to find.
- // szReplaceText: [in] Pointer to text which will replace.
- // bMatchWholeWord: [in] Boolean flag to match whole word.
- // bMatchCase: [in] Boolean flag to match case.
- // Returns:
- // The number of founded matches.
- //-----------------------------------------------------------------------
- int ReplaceAll(LPCTSTR szFindText, LPCTSTR szReplaceText, BOOL bMatchWholeWord, BOOL bMatchCase);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the selected text.
- // Parameters:
- // strText: [out] Reference to a CString object where returned text
- // will be placed.
- // Returns:
- // Number of character in the returned text.
- //-----------------------------------------------------------------------
- int GetSelectionText(CString& strText);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets the drop position.
- // Parameters:
- // iRow: [in] Row of the drop position.
- // iCol: [in] Col of the drop position.
- // Remarks:
- // Call this member function to set the drop position. Mainly used by
- // CXTPSyntaxEditView during OLE drag drop operation.
- // See also:
- // CXTPSyntaxEditView class
- //-----------------------------------------------------------------------
- void SetDropPos(int iRow, int iCol);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the current absolute horizontal text position.
- // Summary:
- // Call this member function to determine the current absolute text
- // position, mainly used in text insert or delete operations.
- // Treats tabs as one character.
- // Returns:
- // Return absolute column position.
- //-----------------------------------------------------------------------
- int GetCurAbsCol();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns a handle of selection buffer.
- // Parameters:
- // nFormat: [in] Determines clipboard format to be returned
- // (CF_TEXT or CF_UNICODETEXT)
- // Summary:
- // Call this member function get a handle of a selection buffer in the
- // global memory in one of the clipboard format of CF_TEXT or
- // CF_UNICODETEXT. Mainly used in OLE drag drop operation.
- // Returns:
- // Handle of a globally allocated memory.
- //-----------------------------------------------------------------------
- HGLOBAL GetSelectionBuffer(UINT nFormat);
- //-----------------------------------------------------------------------
- // Summary:
- // Enables or disables OLE drag drop mode.
- // Parameters:
- // bEnableDrag: [in] Determines state of OLE drag drop.
- // Remarks:
- // CAll this member function toenablr/disable OLE drag drop. Pass TRUE
- // to enable OLE drag drop, otherwise pass FALSE.
- //-----------------------------------------------------------------------
- void EnableOleDrag(BOOL bEnableDrag = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Validates and set the row column to a valid one.
- // Parameters:
- // nRow: [in] Document row to be validated.
- // nCol: [in out] Col to be validated.
- // nAbsCol: [in out] Absolute col to be validated.
- //-----------------------------------------------------------------------
- void ValidateCol(const int nRow, int& nCol, int& nAbsCol);
- //-----------------------------------------------------------------------
- // Summary:
- // Sends notification when current text position was changed.
- // Parameters:
- // nRow: [in] Row to be notified in document coordinates.
- // nCol: [in] Column to be notified.
- // Remarks:
- // Call this member function to send notification to the parent class
- // about the row col changes.
- //-----------------------------------------------------------------------
- void NotifyCurRowCol(int nRow, int nCol);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the row and col (Not validated) for a specific point. Use
- // CalcValidDispCol for validation.
- // Parameters:
- // pt : [in] The point in client co-ordinate.
- // pRow : [out] The out parameter contains the calculated
- // document row.
- // pCol : [out] The out parameter contains the calculated col.
- // pDispRow : [out] The out parameter contains the calculated
- // visible row.
- // pDispCol : [out] The out parameter contains the calculated
- // visible col.
- // bVirtualSpace : [in] Set TRUE if virtual space is enabled
- // (cursor can be paced in any place after line end).
- // Returns:
- // BOOL : True if point was out of bound and index was corrected
- //-----------------------------------------------------------------------
- BOOL RowColFromPoint(CPoint pt, int *pRow, int *pCol, int *pDispRow = NULL,
- int *pDispCol = NULL, BOOL bVirtualSpace = -1);
- //-----------------------------------------------------------------------
- // Summary:
- // Deletes tab from the front of a selection.
- // Returns:
- // BOOL : True if successful, false if not.
- //-----------------------------------------------------------------------
- BOOL DecreaseIndent();
- //-----------------------------------------------------------------------
- // Summary:
- // Inserts tab in front of a selection.
- // Returns:
- // BOOL - True if successful, false if not.
- //-----------------------------------------------------------------------
- BOOL IncreaseIndent();
- //-----------------------------------------------------------------------
- // Summary:
- // Deletes all the lines in a selection or a specific line in the case
- // if no selection exists.
- // Parameters:
- // iForceDeleteRow : [in] The document row to delete.
- //-----------------------------------------------------------------------
- void DeleteSelectedLines(int iForceDeleteRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Shows or hides the scroll bar.
- // Parameters:
- // bShow : [in] Determines if a horizontal scrollbar should be shown.
- // Pass TRUE to show FALSE otherwise. Default value is
- // TRUE.
- //-----------------------------------------------------------------------
- void ShowHScrollBar(BOOL bShow = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Copy or move text after dragging.
- // Parameters:
- // bCopy: [in] Set as TRUE to copy text, FALSE to move text.
- //-----------------------------------------------------------------------
- void CopyOrMoveText(BOOL bCopy);
- //-----------------------------------------------------------------------
- // Summary:
- // Finds a certain text with some parameters for find.
- // Parameters:
- // szText : [in] Pointer to a text string to be found.
- // bMatchWholeWord : [in] Find text matching the whole word.
- // bMatchCase : [in] Try to match case.
- // bSearchDown : [in] TRUE for searching downward.
- // bRedraw : [in] TRUE for redraw control after search.
- // nStartRow : [in] The row number to start search. Value -1 means start from current row.
- // nStartCol : [in] The column number to start search. Value -1 means start from current column.
- // Returns:
- // TRUE if found, FALSE if not
- //-----------------------------------------------------------------------
- BOOL Find(LPCTSTR szText, BOOL bMatchWholeWord, BOOL bMatchCase, BOOL bSearchDown,BOOL bRedraw = TRUE,
- int nStartRow = -1, int nStartCol = -1);
- //-----------------------------------------------------------------------
- // Summary:
- // Selects a text bounded by given coordinates.
- // Parameters:
- // nRow1 - Start row of the text.
- // nCol1 - Start visible column (character) of the text.
- // nRow2 - End row of the text.
- // nCol2 - End visible column (character) of the text.
- // bRedraw - TRUE for redraw control after search.
- // Returns:
- // TRUE if found, FALSE if not.
- //-----------------------------------------------------------------------
- BOOL Select(int nRow1, int nDispCol1, int nRow2, int nDispCol2, BOOL bRedraw = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Cancels the previously selected rectangle area.
- // See also:
- // void SetCurSel(int iRow1, int iCol1, int iRow2, int iCol2)
- //-----------------------------------------------------------------------
- void Unselect();
- //-----------------------------------------------------------------------
- // Summary:
- // Use this operator to copy control settings from other control.
- // Parameters:
- // src - A source syntax edit control.
- // Returns:
- // A reference to this object.
- //-----------------------------------------------------------------------
- const CXTPSyntaxEditCtrl& operator=(const CXTPSyntaxEditCtrl& src);
- //-----------------------------------------------------------------------
- // Summary:
- // Restores cursor, used mainly while changing font.
- //-----------------------------------------------------------------------
- void RestoreCursor();
- //-----------------------------------------------------------------------
- // Summary:
- // Turns on/off overwrite mode.
- // Parameters:
- // bOverwriteMode : [in] TRUE if INS is off, FALSE otherwise.
- //-----------------------------------------------------------------------
- void SetOverwriteMode(BOOL bOverwriteMode);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets caret for overwrite mode.
- // Parameters:
- // bWideCaret: [in] TRUE if thin caret, FALSE otherwise.
- // bUpdateReg: [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- //-----------------------------------------------------------------------
- BOOL SetWideCaret(BOOL bWideCaret, BOOL bUpdateReg = FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Determines if thin caret is set for overwrite mode.
- // Returns:
- // Boolean flag. TRUE if set, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL GetWideCaret() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Determines is the caret visible or not.
- // Returns:
- // TRUE if caret is hidden, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL IsHideCaret();
- //-----------------------------------------------------------------------
- // Summary:
- // Used to hide or show caret.
- // Remarks:
- // May be useful to hide caret in the read-only mode.
- //-----------------------------------------------------------------------
- void SetHideCaret(BOOL bHide);
- //-----------------------------------------------------------------------
- // Summary:
- // Selects the surrounding word of the point specified.
- // Parameters:
- // point : [in] A point about which a word will be searched.
- //-----------------------------------------------------------------------
- void SelectWord(CPoint point);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets the current caret position to the specified row and col.
- // Parameters:
- // nTextRow : [in] The text row number for the current
- // caret position.
- // nDispCol : [in] The col for the current caret position.
- // bRowColNotify : [in] Pass TRUE to send XTP_EDIT_NM_ROWCOLCHANGED
- // notification, FALSE otherwise.
- // bEnsureVisible : [in] Pass true if the set row col should be
- // forcefully made visible.
- //-----------------------------------------------------------------------
- void SetCurCaretPos(int nTextRow, int nDispCol, BOOL bRowColNotify = TRUE, BOOL bEnsureVisible = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns a buffer manager which maintains a buffer of a smart edit
- // control.
- // Returns:
- // Pointer to the CXTPSyntaxEditBufferManager object.
- //-----------------------------------------------------------------------
- CXTPSyntaxEditBufferManager* GetEditBuffer();
- //-----------------------------------------------------------------------
- // Summary:
- // Use this method to get associated configuration manager.
- // Returns:
- // Returns pointer to configuration manager.
- //-----------------------------------------------------------------------
- CXTPSyntaxEditConfigurationManager* GetLexConfigurationManager() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Use this method to get paint manager object.
- // Returns:
- // Returns pointer to associated CXTPSyntaxEditPaintManager object.
- //-----------------------------------------------------------------------
- virtual CXTPSyntaxEditPaintManager* GetPaintManager();
- //-----------------------------------------------------------------------
- // Summary:
- // Use this method to sett paint manager object.
- // Parameters:
- // pPaintManager : [in] A pointer CXTPSyntaxEditPaintManager object.
- //-----------------------------------------------------------------------
- virtual void SetPaintManager(CXTPSyntaxEditPaintManager* pPaintManager);
- //-----------------------------------------------------------------------
- // Summary:
- // Use this method to get draw text processor object.
- // Returns:
- // Returns pointer to CXTPSyntaxEditDrawTextProcessor object.
- //-----------------------------------------------------------------------
- CXTPSyntaxEditDrawTextProcessor& GetDrawTextProcessor();
- //-----------------------------------------------------------------------
- // Summary:
- // Inserts a string at specified row and col.
- // Parameters:
- // szText : [in] A pointer to a text string to be inserted.
- // iRow : [in] A row identifier where text will be inserted.
- // iCol : [in] A column identifier where text will be inserted.
- // bDeleteSelection : [in] If TRUE selected text will be deleted at insertion.
- // Default is TRUE.
- // bRedraw : [in] If TRUE document will be redrawn.
- //-----------------------------------------------------------------------
- void InsertString(LPCTSTR szText, int iRow, int iCol, BOOL bDeleteSelection = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Inserts a vertical text block at specified row and col.
- // Parameters:
- // szText : [in] A pointer to a text string to be inserted.
- // iRow : [in] A row identifier where text will be inserted.
- // iCol : [in] A column identifier where text will be inserted.
- // bDeleteSelection : [in] If TRUE selected text will be deleted at insertion.
- // Default is TRUE.
- // bRedraw : [in] If TRUE document will be redrawn.
- //-----------------------------------------------------------------------
- void InsertTextBlock(LPCTSTR szText, int iRow, int iCol, BOOL bDeleteSelection = TRUE);
- //--------------------------------------------------------------------
- // Summary:
- // Returns main configuration file name.
- // Remarks:
- // Return configuration file name previously stored by SetConfigFile().
- // Returns:
- // CString object contains main configuration file name.
- // See also:
- // CXTPSyntaxEditCtrl::SetConfigFile().
- //--------------------------------------------------------------------
- CString GetConfigFile();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns a path of the executable file module.
- // Returns:
- // CString objects with path.
- //-----------------------------------------------------------------------
- static CString AFX_CDECL GetModulePath();
- //-----------------------------------------------------------------------
- // Summary:
- // Sets the path to the main configuration file.
- // Parameters:
- // szPath : [in] A pointer to a string containing a valid path for
- // searching the control's .ini files.
- // Remarks:
- // Configuration will be reloaded.
- // Returns:
- // TRUE if path is found, FALSE otherwise
- // See also:
- // CXTPSyntaxEditCtrl::GetConfigFile().
- //-----------------------------------------------------------------------
- BOOL SetConfigFile(LPCTSTR szPath);
- //-----------------------------------------------------------------------
- // Summary:
- // Creates and applies the font for the edit control
- // Parameters:
- // pLogFont : [in] A pointer to LOGFONT structure.
- // bUpdateReg : [in] Set this parameter as TRUE to update this setting
- // in the registry. It is FALSE by default.
- //-----------------------------------------------------------------------
- void SetFontIndirect(LPLOGFONT pLogfont, BOOL bUpdateReg=FALSE);
- //-----------------------------------------------------------------------
- // Summary:
- // Sets the current cursor position to the specified row and col.
- // Parameters:
- // iRow : [in] A Row to set as the current cursor position document
- // coordinates.
- // iCol : [in] A Col to set as the current cursor position in
- // document coordinates.
- // bRemainSelected : [in] FALSE determines to unselect the selected text.
- // bForceVisible : [in] Set TRUE to make current pos visible.
- // See also:
- // int GetCurCol(), int GetCurRow()
- //-----------------------------------------------------------------------
- void SetCurPos(int nTextRow, int nDispCol, BOOL bRemainSelected = FALSE, BOOL bForceVisible = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the current column.
- // Returns:
- // An integer value of current document column identifier.
- //-----------------------------------------------------------------------
- int GetCurCol();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the current document row
- // Returns:
- // An integer value of current document row identifier.
- //-----------------------------------------------------------------------
- int GetCurRow() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the number of rows in the current document.
- // Returns:
- // Number of rows in the document.
- //-----------------------------------------------------------------------
- int GetRowCount() const;
- //-----------------------------------------------------------------------
- // Summary:
- // Selects all the text.
- //-----------------------------------------------------------------------
- void SelectAll();
- //-----------------------------------------------------------------------
- // Summary:
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to draw the edit control client area.
- // Parameters:
- // pDC : [in] A pointer to device context to print.
- // rcRect : [in] A rectangle to draw control.
- // See Also: PrintPage
- //-----------------------------------------------------------------------
- virtual void Draw(CDC *pDC, const CRect& rcRect);
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to print the edit control page.
- // Parameters:
- // pDC : [in] A pointer to device context to print.
- // rcRect : [in] A rectangle to draw control.
- // nFlags : [in] Additional printing options. The folowing are supported:
- // DT_CALCRECT, DT_SINGLELINE, DT_WORDBREAK
- // Remarks:
- // The TopRow is used as the first page line.
- // Returns:
- // Returns count of the printed rows.
- // See Also: Draw
- //-----------------------------------------------------------------------
- virtual int PrintPage(CDC *pDC, const CRect& rcRect, int nFlags = 0);
- //-----------------------------------------------------------------------
- // Summary:
- // This method used to calculate the edit control regions.
- // Parameters:
- // prcBookMarks : [out] A pointer to CRect object to receive a Bookmarks
- // area rectangle. May be NULL.
- // prcLineNum : [out] A pointer to CRect object to receive a Line Numbers
- // area rectangle. May be NULL.
- // prcNodes : [out] A pointer to CRect object to receive a Line Nodes
- // area rectangle. May be NULL.
- // prcText : [out] A pointer to CRect object to receive a Text
- // area rectangle. May be NULL.
- // prcClient : [in] A pointer to CRect object which contains a base edit
- // control rectangle to calculate other rectangles.
- // Pass NULL to use edit control's window client rect.
- // Remarks:
- // For invisible(diabled) areas - the empty rectangles returned.
- // Returns:
- // Returns a base rectangle for which other rectangless where calculated
- // (this is a window client rect or value from prcClient parameter).
- //-----------------------------------------------------------------------
- virtual CRect CalcEditRects(CRect* prcBookMarks = NULL, CRect* prcLineNum = NULL,
- CRect* prcNodes = NULL, CRect* prcText = NULL,
- const CRect* prcClient = NULL);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns boolean selection existence flag.
- // Returns:
- // TRUE if selection exist, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL IsSelectionExist();
- //-----------------------------------------------------------------------
- // Summary:
- // Call this member function to paste from clipboard to the current
- // document.
- //-----------------------------------------------------------------------
- void Paste();
- //-----------------------------------------------------------------------
- // Summary:
- // Copies the selected text to clipboard.
- //-----------------------------------------------------------------------
- void Copy();
- //-----------------------------------------------------------------------
- // Summary:
- // Copies the selected text to clipboard and deletes it from document.
- //-----------------------------------------------------------------------
- void Cut();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns flag which determines if Redo can be made.
- // Remarks:
- // Call this member function to determine if redo can be made.
- // Returns:
- // TRUE if redo can be made, FALSE otherwise.
- // See also:
- // BOOL Redo(int nActionsCount = 1);
- //-----------------------------------------------------------------------
- BOOL CanRedo();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns flag which determines if Undo can be made.
- // Remarks:
- // Call this member function to determine if undo can be made.
- // Returns:
- // TRUE if any undo action pending, FALSE otherwise
- // See also:
- // BOOL Undo(int nActionsCount = 1);
- //-----------------------------------------------------------------------
- BOOL CanUndo();
- //-----------------------------------------------------------------------
- // Summary:
- // Re-does the last undone operation.
- // Parameters:
- // nActionsCount : [in] Specifies the number of actions to be redone
- // simultaneously.
- // Returns:
- // TRUE if success, FALSE otherwise.
- // See also:
- // BOOL CanRedo();
- //-----------------------------------------------------------------------
- BOOL Redo(int nActionsCount = 1);
- //-----------------------------------------------------------------------
- // Summary:
- // Un-does the current action.
- // Parameters:
- // nActionsCount : [in] Specifies the number of actions to be undone
- // simultaneously.
- // Returns:
- // TRUE if success, FALSE otherwise.
- // See also:
- // BOOL CanUndo();
- //-----------------------------------------------------------------------
- BOOL Undo(int nActionsCount = 1);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the list of text for undo operations.
- // Returns:
- // A reference to CStringList with strings of text for undo.
- //-----------------------------------------------------------------------
- const CStringList& GetUndoTextList();
- //-----------------------------------------------------------------------
- // Summary:
- // Returns the list of text for redo operations.
- // Returns:
- // A reference to CStringList with strings of text for redo.
- //-----------------------------------------------------------------------
- const CStringList& GetRedoTextList();
- //-----------------------------------------------------------------------
- // Summary:
- // Deletes a character at specified location.
- // Parameters:
- // iRow : [in] A row identifier in document coordinates.
- // iCol : [in] A column identifier in document coordinates.
- // pos : [in] A position qualifier.
- // Returns:
- // TRUE if deleted, FALSE otherwise;
- // See also:
- // XTPSyntaxEditDeletePos enum.
- //-----------------------------------------------------------------------
- BOOL DeleteChar(int iRow, int iCol, XTPSyntaxEditDeletePos pos);
- //-----------------------------------------------------------------------
- // Summary:
- // Deletes a given range of text.
- // Parameters:
- // iRowFrom : [in] Specifies start row in document coordinates.
- // iColFrom : [in] Specifies start col in document coordinates.
- // iRowTo : [in] Specifies end row in document coordinates.
- // iColTo : [in] Specifies end col in document coordinates.
- // nFlags : [in] mode flag, possible values : smfRedraw,
- // smfForceRedraw, smfTextAsBlock.
- // Returns:
- // TRUE if deleted, FALSE otherwise.
- // See also:
- // enum XTPSyntaxEditFlags.
- //-----------------------------------------------------------------------
- BOOL DeleteBuffer(int iRowFrom, int iColFrom, int iRowTo, int iColTo, int nFlags = 0);
- //-----------------------------------------------------------------------
- // Summary:
- // Deletes the currently selected text.
- // Parameters:
- // bRedraw : [in] If TRUE document should be redrawn. Default value
- // is TRUE.
- // Returns:
- // TRUE if deleted, FALSE otherwise.
- //-----------------------------------------------------------------------
- BOOL DeleteSelection();
- //-----------------------------------------------------------------------
- // Summary:
- // Use this method to get editor text.
- // Parameters:
- // nMaxLen : [in] The maximum text length to get (in TCHARs). Set as -1
- // to get all text. Default value -1.
- // memFile : [out] A reference to CMemFile object to receive a text.
- // Remarks:
- // Also CWnd::GetWindowText can be used to get editor text.
- // Returns:
- // First function returns a CString object wich contains an editor text
- // (or empty string).
- // Second function returns TRUE if succeeded, FALSE otherwise.
- // See Also: SetText, CWnd::SetWindowText
- //-----------------------------------------------------------------------
- virtual CString GetText(int nMaxLen = -1);
- virtual BOOL GetText(CMemFile& memFile, int nMaxLen = -1); //<COMBINE GetText@int>
- //-----------------------------------------------------------------------
- // Summary:
- // Use this method to set editor text.
- // Parameters:
- // pcszText : [in] Pointer to a text string.
- // Remarks:
- // Also CWnd::SetWindowText can be used to set editor text.
- // See Also: GetText, CWnd::GetWindowText
- //-----------------------------------------------------------------------
- virtual void SetText(LPCTSTR pcszText);
- //-----------------------------------------------------------------------
- // Summary:
- // Set the top row of the visible window.
- // Parameters:
- // iRow : [in] An identifier of the top visible row in document
- // coordinates.
- // See also:
- // int GetTopRow();
- //-----------------------------------------------------------------------
- void SetTopRow(int iRow);
- //-----------------------------------------------------------------------
- // Summary:
- // Returns top row identifier.
- // Returns:
- // An integer value of the current top row identifier.
- // See also:
- // SetTopRow(int iRow);
- //-----------------------------------------------------------------------
- int GetTopRow();
- //-----------------------------------------------------------------------
- // Summary:
- // Recalculates and set the scroll bars and other related areas
- // depending on the text size and current position.
- //-----------------------------------------------------------------------
- void RecalcScrollBars();
- //-----------------------------------------------------------------------
- // Summary: Repositions and resizes control bars in the client area of a
- // window.
- // Parameters:
- // nIDFirst : [in] The ID of the first in a range of control bars
- // to reposition and resize.
- // nIDLast : [in] The ID of the last in a range of control bars
- // to reposition and resize.
- // nIDLeftOver : [in] Specifies ID of pane that fills the rest of the
- // client area.
- // nFlag : [in] Can have one of the following values:
- // [ul]
- // [li]CWnd::reposDefault - Performs the layout of
- // the control bars. lpRectParam is not used and
- // can be NULL.[/li]
- // [li]CWnd::reposQuery - The layout of the control
- // bars is not done; instead lpRectParam is
- // initialized with the size of the client area,
- // as if the layout had actually been done.[/li]
- // [li]CWnd::reposExtra Adds the values of lpRectParam
- // to the client area of nIDLast and also performs
- // the layout.[/li]
- // [/ul]
- // lpRectParam : [in] Points to a RECT structure; the usage of which
- // depends on the value of nFlag.
- // lpRectClient : [in] Points to a RECT structure containing the available
- // client area. If NULL, the window's client area will
- // be used.
- // bStretch : [in] Indicates whether the bar should be stretched to
- // the size of the frame.
- // Remarks: The nIDFirst and nIDLast parameters define a range of control-bar
- // IDs to be repositioned in the client area. The nIDLeftOver parameter
- // specifies the ID of the child window (normally the view) which
- // is repositioned and resized to fill the rest of the client area
- // not filled by control bars.
- //-----------------------------------------------------------------------
- void RepositionBars(UINT nIDFirst, UINT nIDLast, UINT nIDLeftOver, UINT nFlag = CWnd::reposDefault, LPRECT lpRectParam = NULL, LPCRECT lpRectClient = NULL, BOOL bStretch = TRUE);
- //-----------------------------------------------------------------------
- // Summary:
- // Return pointer to the specified CScrollBar object.
- // Parameters:
- // nBar : [in] Specifies the type of scroll bar. The parameter can take
- // one of the following values:
- // [ul]
- // [li]SB_HORZ - Retrieves the position of the horizontal scroll bar[/li]
- // [li]SB_VERT - Retrieves the position of the vertical scroll bar[/li]
- // [/ul]
- // Remarks:
- // Call this member function to obtain a pointer to the specified sibling
- // scroll bar. This member function does not operate on scroll bars created
- // when the WS_HSCROLL or WS_VSCROLL bits are set during the creation
- // of a window. The CWnd implementation of this function simply returns
- // NULL. Derived classes, such as CView, implement the described
- // functionality.
- // Returns:
- // A pointer to sibling scroll-bar control, or NULL if none.
- //-----------------------------------------------------------------------
- virtual CScrollBar* GetScrollBarCtrl( int nBar ) const;
- //-----------------------------------------------------------------------
- // Summary:
- // Enables or disables the scroll bar.
- // Parameters:
- // nBar : [in] The scroll-bar identifier.
- // bEnable : [in] Specifies whether the scroll bar is to be enabled
- // or disabled.
- // Remarks:
- // If the window has a sibling scroll-bar control, that scroll bar
- // is used; otherwise the window's own scroll bar is used.
- // See also:
- // void ShowScrollBar(UINT nBar, BOOL bShow = TRUE );
- //-----------------------------------------------------------------------
- void EnableScrollBarCtrl(int nBar, BOOL bEnable = TRUE );
- //-----------------------------------------------------------------------
- // Summary:
- // Shows or hides a scroll bar.
- // Parameters:
- // nBar : [in] Specifies whether the scroll bar is a control or part
- // of a window's non-client area. If it is part of the
- // non-client area, nBar also indicates whether the scroll
- // bar is positioned horizontally, vertically, or both.
- // It must be one of the following:
- // [ul]
- // [li]SB_BOTH - Specifies the horizontal and vertical
- // scroll bars of the window.[/li]
- // [li]SB_HORZ - Specifies that the window is a horizontal
- // scroll bar.[/li]
- // [li]SB_VERT - Specifies that the window is a vertical
- // scroll bar.[/li]
- // bShow: [in] Specifies whether Windows shows or hides the scroll bar.
- // If this parameter is TRUE, the scroll bar is shown;
- // otherwise the scroll bar is hidden.
- // Remarks:
- // An application should not call ShowScrollBar to hide a scroll
- // bar while processing a scroll-bar notification message.
- // See also:
- // void EnableScrollBarCtrl( int nBar, BOOL bEnable = TRUE );
- //-----------------------------------------------------------------------
- void ShowScrollBar(UINT nBar, BOOL bShow = TRUE );
- //-----------------------------------------------------------------------
- // Summary:
- // Sets minimum and maximum position values for the given scroll bar.
- // Parameters:
- // nBar : [in] Specifies the scroll bar to be set. This parameter
- // can be either of the following values:
- // [ul]
- // [li]SB_HORZ - Sets the range of the horizontal scroll
- // bar of the window.[/li]
- // [li]SB_VERT - Sets the range of the vertical scroll
- // bar of the window.[/li]
- // [/ul]
- // nMinPos : [in] Specifies the minimum scrolling position.
- // nMaxPos : [in] Specifies the maximum scrolling position.
- // bRedraw : [in] Specifies whether the scroll bar should be redrawn to
- // reflect the change. If bRedraw is TRUE, the scroll bar
- // is redrawn; if FALSE, the scroll bar is not redrawn.
- // Remarks: It can also be used to hide or show standard scroll bars.
- //
- // An application should not call this function to hide a scroll
- // bar while processing a scroll-bar notification message.
- //
- // If the call to SetScrollRange immediately follows a call to
- // the SetScrollPos member function, the bRedraw parameter in the
- // SetScrollPos member function should be 0 to prevent the scroll
- // bar from being drawn twice.
- //
- // The default range for a standard scroll bar is 0 through 100.
- // The default range for a scroll bar control is empty (both the
- // nMinPos and nMaxPos values are 0). The difference between the
- // values specified by nMinPos and nMaxPos must not be greater
- // than INT_MAX.
- //-----------------------------------------------------------------------
- void SetScrollRange( int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE );
- //-----------------------------------------------------------------------
- // Summary:
- // Sets the current position of a scroll box and, if requested, redraws
- // the scroll bar to reflect the new position of the scroll box
- // Parameters:
- // nBar : [in] Specifies the scroll bar to be set. This parameter
- // can be either of the following:
- // [ul]
- // [li]SB_HORZ - Sets the position of the scroll box
- // in the horizontal scroll bar of the
- // window.[/li]
- // [li]SB_VERT - Sets the position of the scroll box in
- // the vertical scroll bar of the
- // window.[/li]
- // [/ul]
- // nPos : [in] Specifies the new position of the scroll box. It must
- // be within the scrolling range.
- // bRedraw : [in] Specifies whether the scroll bar should be repainted
- // to reflect the new scroll-box position. If this parameter
- // is TRUE, the scroll bar is repainted; if FALSE, the
- // scroll bar is not repainted.
- // Remarks:
- // Setting bRedraw to FALSE is useful whenever the scroll bar will
- // be redrawn by a subsequent call to another function.
- // Returns:
- // The previous position of the scroll box.
- //-----------------------------------------------------------------------
- int SetScrollPos( int nBar, int nPos, BOOL bRedraw = TRUE );
- //-----------------------------------------------------------------------
- // Summary:
- // Sets the information that the SCROLLINFO structure maintains about
- // a scroll bar.
- // Parameters:
- // nBar : [in] Specifies the scroll bar to be set. This parameter
- // can be either of the following:
- // [ul]
- // [li]SB_HORZ - Sets the position of the scroll box
- // in the horizontal scroll bar of the window.[/li]
- // [li]SB_VERT Sets the position of the scroll box in
- // the vertical scroll bar of the window.[/li]
- // [/ul]
- // lpScrollInfo : [in] A pointer to a SCROLLINFO structure.
- // bRedraw : [in] Specifies whether the scroll bar should be redrawn
- // to reflect the new information. If bRedraw is TRUE,
- // the scroll bar is redrawn. If it is FALSE, it is
- // not redrawn. The scroll bar is redrawn by default.
- // Remarks:
- // You must provide the values required by the SCROLLINFO structure
- // parameters, including the flag values.
- //
- // The SCROLLINFO structure contains information about a scroll bar,
- // including the minimum and maximum scrolling positions, the page
- // size, and the position of the scroll box (the thumb). See the
- // SCROLLINFO structure topic in the Platform SDK for more information
- // about changing the structure defaults.
- // Returns:
- // If successful, the return is TRUE. Otherwise, it is FALSE.
- // See also:
- // BOOL GetScrollInfo( int nBar, LPSCROLLINFO lpScrollInfo, UINT nMask = SIF_ALL )
- // int GetScrollLimit( int nBar )
- //-----------------------------------------------------------------------
- BOOL SetScrollInfo( int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE );
- //-----------------------------------------------------------------------
- // Summary:
- // Returns max scroll position identifier.
- // Parameters:
- // nBar : [in] Specifies the type of scroll bar. The parameter can take
- // one of the following values:
- // [ul]
- // [li]SB_HORZ - Retrieves the scroll limit of the horizontal
- // scroll bar.[/li]
- // [li]SB_VERT Retrieves the scroll limit of the vertical
- // scroll bar.[/li]
- // [/ul]
- // Remarks:
- // Call this member function to retrieve the maximum scrolling
- // position of the scroll bar.
- // Returns:
- // An integer value which specifies the maximum position of a scroll
- // bar if successful; otherwise 0.
- //-----------------------------------------------------------------------
- int GetScrollLimit( int nBar );
- //-----------------------------------------------------------------------
- // Summary: Retrieves the scrollbar information
- // Parameters:
- // nBar : [in] Specifies whether the scroll bar is a control
- // or part of a window's non-client area. If it is
- // part of the non-client area, nBar also indicates
- // whether the scroll bar is positioned horizontally,
- // vertically, or both. It must be one of the following:
- // [ul]
- // [li]SB_CTL - Contains the parameters for a scroll
- // bar control. The m_hWnd data member must be
- // the handle of the scroll bar control.[/li]
- // [li]SB_HORZ - Specifies that the window is a
- // horizontal scroll bar.[/li]
- // [li]SB_VERT Specifies that the window is a
- // vertical scroll bar.
- // lpScrollInfo : [out] A pointer to a SCROLLINFO structure. See the
- // Platform SDK for more information about this
- // structure.
- // nMask : [in] Specifies the scroll bar parameters to retrieve.
- // The default specifies a combination of SIF_PAGE,
- // SIF_POS, SIF_TRACKPOS, and SIF_RANGE. See SCROLLINFO
- // for more information on the nMask values.
- // Remarks:
- // Call this member function to retrieve the information that the
- // SCROLLINFO structure maintains about a scroll bar.
- // GetScrollInfo enables applications to use 32-bit scroll positions.
- //
- // The SCROLLINFO structure contains information about a scroll bar,
- // including the minimum and maximum scrolling positions, the page
- // size, and the position of the scroll box (the thumb). See the
- // SCROLLINFO structure topic in the Platform SDK for more information
- // about changing the structure defaults.
- //
- // The MFC Windows message handlers that indicate scroll-bar position,
- // CWnd::OnHScroll and CWnd::OnVScroll, provide only 16 bits of position
- // data. GetScrollInfo and SetScrollInfo provide 32 bits of scroll-bar
- // position data. Thus, an application can call GetScrollInfo while
- // processing either CWnd::OnHScroll or CWnd::OnVScroll to obtain 32-bit
- // scroll-bar position data.
- // Returns:
- // If the message retrieved any values, the return is TRUE. Otherwise,
- // it is FALSE.
- // See also:
- // BOOL SetScrollInfo( int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE );
- //-----------------------------------------------------------------------
- BOOL GetScrollInfo( int nBar, LPSCROLLINFO lpScrollInfo, UINT nMask = SIF_ALL );
- //-----------------------------------------------------------------------
- // Summary:
- // Scrolls the specified client area with additional features.
- // Parameters:
- // dx : [in] Specifies the amount, in device units, of horizontal scrolling.
- // This parameter must have a negative value to scroll to the left.
- // dy : [in] Specifies the amount, in device units, of vertical scrolling.
- // This parameter must have a negative value to scroll up.
- // lpRectScroll : [in] Points to a RECT structure that specifies the portion
- // of the client area to be scrolled. If this parameter
- // is NULL, the entire client area is scrolled.
- // lpRectClip : [in] Points to a RECT structure that specifies the clipping
- // rectangle to scroll. This structure takes precedence
- // over the rectangle pointed to by lpRectScroll. Only
- // bits inside this rectangle are scrolled. Bits outside
- // this rectangle are not affected even if they are in
- // the lpRectScroll rectangle. If this parameter is NULL,
- // no clipping is performed on the scroll rectangle.
- // prgnUpdate : [in] Identifies the region that is modified to hold the
- // region invalidated by scrolling. This parameter
- // may be NULL.
- // lpRectUpdate : [out] Points to a RECT structure that will receive the
- // boundaries of the rectangle invalidated by scrolling.
- // This parameter may be NULL.