1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-04-14 00:24:54 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
#ifndef nsITextWidget_h__
|
|
|
|
#define nsITextWidget_h__
|
|
|
|
|
|
|
|
#include "nsIWidget.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
|
|
|
|
// {F8030011-C342-11d1-97F0-00609703C14E}
|
|
|
|
#define NS_ITEXTWIDGET_IID \
|
1999-01-06 21:49:37 +03:00
|
|
|
{ 0xf8030011, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-05-15 01:34:08 +04:00
|
|
|
|
|
|
|
struct nsTextWidgetInitData : public nsWidgetInitData {
|
1998-10-22 00:10:22 +04:00
|
|
|
nsTextWidgetInitData()
|
|
|
|
: mIsPassword(PR_FALSE),
|
|
|
|
mIsReadOnly(PR_FALSE)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1998-05-15 01:34:08 +04:00
|
|
|
PRBool mIsPassword;
|
1998-10-20 00:37:40 +04:00
|
|
|
PRBool mIsReadOnly;
|
1998-05-15 01:34:08 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-04-14 04:31:59 +04:00
|
|
|
/**
|
|
|
|
*
|
1998-04-14 00:24:54 +04:00
|
|
|
* Single line text editor.
|
1998-05-05 23:58:27 +04:00
|
|
|
* Unlike a nsIWidget, The text editor must automatically clear
|
|
|
|
* itself to the background color when paint messages are generated.
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
class nsITextWidget : public nsISupports
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
|
1998-04-14 04:31:59 +04:00
|
|
|
public:
|
1999-05-31 09:27:36 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTWIDGET_IID)
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the text of this component.
|
|
|
|
*
|
|
|
|
* @param aTextBuffer on return contains the text of this component
|
|
|
|
* @param aBufferSize the size of the buffer passed in
|
1998-09-15 00:38:05 +04:00
|
|
|
* @param aActualSize the number of char copied
|
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the text of this component.
|
|
|
|
*
|
1998-09-15 00:38:05 +04:00
|
|
|
* @param aText -- an object containing a copy of the text
|
1998-04-15 01:33:43 +04:00
|
|
|
* @return the number of chars in the text string
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert text into this component.
|
|
|
|
* When aStartPos and aEndPos are a valid range this function performs a replace.
|
|
|
|
* When aStartPos and aEndPos are equal this function performs an insert.
|
|
|
|
* When aStartPos and aEndPos are both -1 (0xFFFFFFFF) this function performs an append.
|
|
|
|
* If aStartPos and aEndPos are out of range they are rounded to the closest end.
|
|
|
|
*
|
|
|
|
* @param aText the text to set
|
|
|
|
* @param aStartPos starting position for inserting text
|
|
|
|
* @param aEndPos ending position for inserting text
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove any content from this text widget
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD RemoveText(void) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates a password will be entered.
|
|
|
|
*
|
|
|
|
* @param aIsPassword PR_TRUE shows contents as asterisks. PR_FALSE shows
|
|
|
|
* contents as normal text.
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD SetPassword(PRBool aIsPassword) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-04-24 00:21:24 +04:00
|
|
|
/**
|
|
|
|
* Sets the maximum number of characters the widget can hold
|
|
|
|
*
|
|
|
|
* @param aChars maximum number of characters for this widget. if 0 then there isn't any limit
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-24 00:21:24 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
|
1998-04-24 00:21:24 +04:00
|
|
|
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Set the text widget to be read-only
|
|
|
|
*
|
1998-09-15 00:38:05 +04:00
|
|
|
* @param aReadOnlyFlag PR_TRUE the widget is read-only,
|
|
|
|
* PR_FALSE indicates the widget is writable.
|
|
|
|
* @param PR_TRUE if it was read only. PR_FALSE if it was writable
|
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
|
1998-04-25 03:09:11 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Select all of the contents
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-25 03:09:11 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD SelectAll() = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the selection in this text component
|
|
|
|
* @param aStartSel starting selection position in characters
|
|
|
|
* @param aEndSel ending selection position in characters
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the selection in this text component
|
|
|
|
* @param aStartSel starting selection position in characters
|
|
|
|
* @param aEndSel ending selection position in characters
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the caret position
|
|
|
|
* @param aPosition caret position in characters
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the caret position
|
|
|
|
* @return caret position in characters
|
1998-09-15 00:38:05 +04:00
|
|
|
* @result NS_Ok if no errors
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-15 00:38:05 +04:00
|
|
|
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsITextWidget_h__
|
|
|
|
|