Major Change: changed all Widget interfaces so that they no longer

descend from nsIWidget. This conforms better to our standard
of not having interfaces inherit from each other.

Changed many of the interfaces to be XPCOM complient i.e. all methods
return nsresult. Therefore the signature of many of the "getters"
changed.


git-svn-id: svn://10.0.0.236/trunk@9989 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kostello%netscape.com 1998-09-14 20:38:05 +00:00
parent 24c7cf4a57
commit 2bf19c7d8f
18 changed files with 601 additions and 95 deletions

View File

@ -26,7 +26,7 @@ EXPORTS=nsui.h nsIWidget.h nsIButton.h nsICheckButton.h nsIListWidget.h \
nsIListBox.h nsIFileWidget.h nsIScrollbar.h nsGUIEvent.h \
nsIRadioButton.h nsIRadioGroup.h nsIMouseListener.h \
nsIEventListener.h nsIToolkit.h nsWidgetsCID.h nsITabWidget.h \
nsITooltipWidget.h nsIAppShell.h nsStringUtil.h nsILookAndFeel.h nsIDialog.h nsILabel.h
nsITooltipWidget.h nsIAppShell.h nsStringUtil.h nsILookAndFeel.h nsIDialog.h nsILabel.h nsWidgetSupport.h
include <$(DEPTH)\config\rules.mak>

View File

@ -31,25 +31,27 @@
* Push button widget.
* Automatically shows itself as depressed when clicked on.
*/
class nsIButton : public nsIWidget {
class nsIButton : public nsISupports {
public:
public:
/**
* Set the button label
* Set the label
*
* @param aText button label
* @param Set the label to aText
* @result NS_Ok if no errors
*/
virtual void SetLabel(const nsString &aText) = 0;
NS_IMETHOD SetLabel(const nsString &aText) = 0;
/**
* Get the button label
*
* @param aBuffer contains label upon return
* @result NS_Ok if no errors
*/
virtual void GetLabel(nsString &aBuffer) = 0;
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
};

View File

@ -19,34 +19,56 @@
#ifndef nsICheckButton_h__
#define nsICheckButton_h__
#include "nsIButton.h"
// {961085F5-BD28-11d1-97EF-00609703C14E}
#define NS_ICHECKBUTTON_IID \
{ 0x961085f5, 0xbd28, 0x11d1, { 0x97, 0xef, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } };
#include "nsISupports.h"
#include "nsIWidget.h"
/**
* Checkbox widget.
* Can show itself in a checked or unchecked state.
* The checkbox widget does not automatically show itself checked or unchecked when clicked on.
*/
class nsICheckButton : public nsIButton {
class nsICheckButton : public nsISupports {
public:
/**
* Set the button label
*
* @param aText button label
* @result set to NS_OK if method successful
*/
NS_IMETHOD SetLabel(const nsString &aText) = 0;
/**
* Get the button label
*
* @param aBuffer contains label upon return
* @result set to NS_OK if method successful
*/
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
/**
* Set the check state.
* @param aState PR_TRUE show as checked. PR_FALSE show unchecked.
* @result set to NS_OK if method successful
*/
virtual void SetState(PRBool aState) = 0;
NS_IMETHOD SetState(const PRBool aState) = 0;
/**
* Get the check state.
* @return PR_TRUE if checked. PR_FALSE if unchecked.
* @param aState PR_TRUE if checked. PR_FALSE if unchecked.
* @result set to NS_OK if method successful
*/
virtual PRBool GetState() = 0;
NS_IMETHOD GetState(PRBool& aState) = 0;
};

View File

@ -39,7 +39,88 @@ struct nsComboBoxInitData : public nsWidgetInitData {
* Single selection drop down list. See nsIListWidget for capabilities
*/
class nsIComboBox : public nsIListWidget {
class nsIComboBox : public nsISupports {
public:
/**
* Set an item at the specific position
*
* @param aItem the item name. The item has to be null terminated
* @param aPosition the position the item should be inserted at
* 0 is at the top of the list
* -1 is at the end of the list
*/
virtual void AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
/**
* Finds the first occurrence of the specified item
*
* @param aItem the string to be filled
* @param aStartPos the starting position (index)
* @return PR_TRUE if successful, PR_FALSE otherwise
*
*/
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
/**
* Returns the number of items in the list
*
* @return the number of items
*
*/
virtual PRInt32 GetItemCount() = 0;
/**
* Remove the first occurrence of the specified item
*
* @param aPosition the item position
* 0 is at the top of the list
* -1 is at the end of the list
*
* @return PR_TRUE if successful, PR_FALSE otherwise
*
*/
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
/**
* Gets an item at a specific location
*
* @param anItem on return contains the string of the item at that position
* @param aPosition the Position of the item
*
*/
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
/**
* Gets the selected item for a single selection list
*
* @param aItem on return contains the string of the selected item
*
*/
virtual void GetSelectedItem(nsString &aItem) = 0;
/**
* Returns with the index of the selected item
*
* @return PRInt32, index of selected item
*
*/
virtual PRInt32 GetSelectedIndex() = 0;
/**
* Select the item at the specified position
*
* @param PRInt32, the item position
* 0 is at the top of the list
* -1 is at the end of the list
*
*/
virtual void SelectItem(PRInt32 aPosition) = 0;
/**
* Deselects all the items in the list
*
*/
virtual void Deselect() = 0;
};

View File

@ -31,25 +31,25 @@
* The base class for all the widgets. It provides the interface for
* all basic and necessary functionality.
*/
class nsIDialog : public nsIWidget {
class nsIDialog : public nsISupports {
public:
/**
* Set the button label
* Set the dialog label
*
* @param aText button label
*/
virtual void SetLabel(const nsString &aText) = 0;
NS_IMETHOD SetLabel(const nsString &aText) = 0;
/**
* Get the button label
* Get the dialog label
*
* @param aBuffer contains label upon return
*/
virtual void GetLabel(nsString &aBuffer) = 0;
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;

View File

@ -46,23 +46,25 @@ class nsIFileWidget : public nsISupports
public:
/**
* Creates a file widget with the specified title and mode.
* @param aParent the owner of the widget
* @param aTitle the title of the widget
* @param aMode the mode of the widget
* @param aContext context for displaying widget
* @param aToolkit toolkit associated with file widget
* @param aInitData data that is used for widget initialization
*/
* Create the file filter. This differs from the standard
* widget Create method because it passes in the mode
*
* @param aParent the parent to place this widget into
* @param aTitle The title for the file widget
* @param aMode load or save
* @return void
*
*/
virtual void Create(nsIWidget *aParent,
nsString& aTitle,
nsMode aMode,
nsIDeviceContext *aContext = nsnull,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
void *aInitData = nsnull) = 0;
virtual void Create( nsIWidget *aParent,
nsString& aTitle,
nsMode aMode,
nsIDeviceContext *aContext = nsnull,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
void *aInitData = 0) = 0;
/**
* Set the list of file filters

View File

@ -45,33 +45,36 @@ struct nsLabelInitData : public nsWidgetInitData {
* Label widget.
* Automatically shows itself as depressed when clicked on.
*/
class nsILabel : public nsIWidget {
class nsILabel : public nsISupports {
public:
/**
* Set the button label
/**
* Set the label
*
* @param aText button label
* @param Set the label to aText
* @result NS_Ok if no errors
*/
virtual void SetLabel(const nsString &aText) = 0;
NS_IMETHOD SetLabel(const nsString &aText) = 0;
/**
* Get the button label
*
* @param aBuffer contains label upon return
* @result NS_Ok if no errors
*/
virtual void GetLabel(nsString &aBuffer) = 0;
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
/**
* Set the Label Alignemnt for creation
*
* @param aAlignment the alignment
* @result NS_Ok if no errors
*/
virtual void SetAlignment(nsLabelAlignment aAlignment) = 0;
NS_IMETHOD SetAlignment(nsLabelAlignment aAlignment) = 0;
};

View File

@ -43,10 +43,92 @@ struct nsListBoxInitData : public nsWidgetInitData {
* horizontal scrollbar.
*/
class nsIListBox : public nsIListWidget {
class nsIListBox : public nsISupports {
public:
/**
* Set an item at the specific position
*
* @param aItem the item name. The item has to be null terminated
* @param aPosition the position the item should be inserted at
* 0 is at the top of the list
* -1 is at the end of the list
*/
virtual void AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
/**
* Finds the first occurrence of the specified item
*
* @param aItem the string to be filled
* @param aStartPos the starting position (index)
* @return PR_TRUE if successful, PR_FALSE otherwise
*
*/
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
/**
* Returns the number of items in the list
*
* @return the number of items
*
*/
virtual PRInt32 GetItemCount() = 0;
/**
* Remove the first occurrence of the specified item
*
* @param aPosition the item position
* 0 is at the top of the list
* -1 is at the end of the list
*
* @return PR_TRUE if successful, PR_FALSE otherwise
*
*/
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
/**
* Gets an item at a specific location
*
* @param anItem on return contains the string of the item at that position
* @param aPosition the Position of the item
*
*/
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
/**
* Gets the selected item for a single selection list
*
* @param aItem on return contains the string of the selected item
*
*/
virtual void GetSelectedItem(nsString &aItem) = 0;
/**
* Returns with the index of the selected item
*
* @return PRInt32, index of selected item
*
*/
virtual PRInt32 GetSelectedIndex() = 0;
/**
* Select the item at the specified position
*
* @param PRInt32, the item position
* 0 is at the top of the list
* -1 is at the end of the list
*
*/
virtual void SelectItem(PRInt32 aPosition) = 0;
/**
* Deselects all the items in the list
*
*/
virtual void Deselect() = 0;
/**
* Set the listbox to be multi-select.
* @param aMultiple PR_TRUE can have multiple selections. PR_FALSE single

View File

@ -32,7 +32,7 @@
*
*/
class nsIListWidget : public nsIWidget {
class nsIListWidget : public nsISupports {
public:

View File

@ -48,7 +48,7 @@ public:
eMetric_WindowBorderWidth,
eMetric_WindowBorderHeight,
eMetric_Widget3DBorder,
eMetric_TextFieldHeight,
eMetric_TextFieldHeight
} nsMetricID;
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor) = 0;

View File

@ -32,24 +32,43 @@ class nsIRadioGroup;
* The RadioButton widget automatically shows itself checked or unchecked when clicked on.
*/
class nsIRadioButton : public nsIButton {
class nsIRadioButton : public nsISupports {
public:
public:
/**
* Set the button label
*
* @param aText button label
* @result set to NS_OK if method successful
*/
NS_IMETHOD SetLabel(const nsString &aText) = 0;
/**
* Get the button label
*
* @param aBuffer contains label upon return
* @result set to NS_OK if method successful
*/
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
/**
* Set the radio state.
* @param aState PR_TRUE sets the RadioButton and unsets all siblings, PR_FALSE unsets it
*
* Set the check state.
* @param aState PR_TRUE show as checked. PR_FALSE show unchecked.
* @result set to NS_OK if method successful
*/
virtual void SetState(PRBool aState) = 0;
NS_IMETHOD SetState(const PRBool aState) = 0;
/**
* Gets the state the RadioButton
*
* @return PR_TRUE if set, PR_FALSE if unset
*
* Get the check state.
* @param aState PR_TRUE if checked. PR_FALSE if unchecked.
* @result set to NS_OK if method successful
*/
virtual PRBool GetState() = 0;
NS_IMETHOD GetState(PRBool& aState) = 0;
};

View File

@ -41,31 +41,35 @@ public:
/**
* Adds a RadioButton to the group
* @param aRadioBtn the radio button to be added
* @result NS_Ok if no errors
*
*/
virtual void Add(nsIRadioButton * aRadioBtn) = 0;
NS_IMETHOD Add(nsIRadioButton * aRadioBtn) = 0;
/**
* Removes a RadioButton from the group
* @param aRadioBtn the radio button to be removed
* @result NS_Ok if no errors
*
*/
virtual void Remove(nsIRadioButton * aRadioBtn) = 0;
NS_IMETHOD Remove(nsIRadioButton * aRadioBtn) = 0;
/**
* Sets the name of the RadioGroup
* @param aName The new name of the radio group
* @result NS_Ok if no errors
*
*/
virtual void SetName(const nsString &aName) = 0;
NS_IMETHOD SetName(const nsString &aName) = 0;
/**
* Tells the RadioGroup that a child RadioButton has been clicked and it should set
* the approproate state on the other buttons
* @param aChild The RadioButton that was clicked
* @result NS_Ok if no errors
*
*/
virtual void Clicked(nsIRadioButton * aChild) = 0;
NS_IMETHOD Clicked(nsIRadioButton * aChild) = 0;
/**
* Gets the enumeration of children

View File

@ -35,64 +35,72 @@
*/
class nsIScrollbar : public nsIWidget
class nsIScrollbar : public nsISupports
{
public:
/**
* Set the scrollbar range
* @param aEndRange set range for scrollbar from 0 to aEndRange
* @result NS_Ok if no errors
*
*/
virtual void SetMaxRange(PRUint32 aEndRange) = 0;
NS_IMETHOD SetMaxRange(PRUint32 aEndRange) = 0;
/**
* Get the scrollbar range
* @return the upper end of the scrollbar range
* @result NS_Ok if no errors
*/
virtual PRUint32 GetMaxRange() = 0;
NS_IMETHOD GetMaxRange(PRUint32& aMaxRange) = 0;
/**
* Set the thumb position.
* @param aPos a value between (startRange) and (endRange - thumbSize)
* @result NS_Ok if no errors
*
*/
virtual void SetPosition(PRUint32 aPos) = 0;
NS_IMETHOD SetPosition(PRUint32 aPos) = 0;
/**
* Get the thumb position.
* @return a value between (startRange) and (endRange - thumbSize)
* @result NS_Ok if no errors
*
*/
virtual PRUint32 GetPosition() = 0;
NS_IMETHOD GetPosition(PRUint32& aPos) = 0;
/**
* Set the thumb size.
* @param aSize size of the thumb. Must be a value between
* startRange and endRange
* @result NS_Ok if no errors
*/
virtual void SetThumbSize(PRUint32 aSize) = 0;
NS_IMETHOD SetThumbSize(PRUint32 aSize) = 0;
/**
* Get the thumb size.
* @return size of the thumb. The value is between
* startRange and endRange
* @result NS_Ok if no errors
*/
virtual PRUint32 GetThumbSize() = 0;
NS_IMETHOD GetThumbSize(PRUint32& aSize) = 0;
/**
* Set the line increment.
* @param aSize size of the line increment. The value must
* be between startRange and endRange
*/
virtual void SetLineIncrement(PRUint32 aSize) = 0;
* @result NS_Ok if no errors
*/
NS_IMETHOD SetLineIncrement(PRUint32 aSize) = 0;
/**
* Get the line increment.
* @return size of the line increment. The value is
* between startRange and endRange
* @result NS_Ok if no errors
*/
virtual PRUint32 GetLineIncrement() = 0;
NS_IMETHOD GetLineIncrement(PRUint32& aSize) = 0;
/**
* Set all scrollbar parameters at once
@ -102,8 +110,9 @@ public:
* @param aPosition a value between (startRange) and (endRange - thumbSize)
* @param aLineIncrement size of the line increment. The value must
* be between startRange and endRange
* @result NS_Ok if no errors
*/
virtual void SetParameters(PRUint32 aMaxRange, PRUint32 aThumbSize,
NS_IMETHOD SetParameters(PRUint32 aMaxRange, PRUint32 aThumbSize,
PRUint32 aPosition, PRUint32 aLineIncrement) = 0;
};

View File

@ -29,7 +29,7 @@
* Tab widget.
* Presents a lists of tabs to be clicked on.
*/
class nsITabWidget : public nsIWidget {
class nsITabWidget : public nsISupports {
public:
@ -38,17 +38,19 @@ class nsITabWidget : public nsIWidget {
*
* @param aNumberOfTabs The number of tabs in aTabLabels and aTabID
* @param aTabLabels title displayed in the tab
* @result NS_Ok if no errors
*/
virtual void SetTabs(PRUint32 aNumberOfTabs, const nsString aTabLabels[]) = 0;
NS_IMETHOD SetTabs(PRUint32 aNumberOfTabs, const nsString aTabLabels[]) = 0;
/**
* Get selected tab
*
* @return the index of the selected tab. Index ranges between 0 and (NumberOfTabs - 1)
* @result NS_Ok if no errors
*/
virtual PRUint32 GetSelectedTab() = 0;
NS_IMETHOD GetSelectedTab(PRUint32& aTab) = 0;
};

View File

@ -36,8 +36,117 @@
* itself to the background color when paint messages are generated.
*/
class nsITextAreaWidget : public nsITextWidget
class nsITextAreaWidget : public nsISupports
{
public:
/**
* 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
* @param aActualSize the number of char copied
* @result NS_Ok if no errors
*
*/
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
/**
* Set the text of this component.
*
* @param aText -- an object containing a copy of the text
* @return the number of chars in the text string
* @result NS_Ok if no errors
*
*/
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
/**
* 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
* @result NS_Ok if no errors
*/
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
/**
* Remove any content from this text widget
* @result NS_Ok if no errors
*/
NS_IMETHOD RemoveText(void) = 0;
/**
* 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
* @result NS_Ok if no errors
*/
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
/**
* Set the text widget to be read-only
*
* @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
*/
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
/**
* Select all of the contents
* @result NS_Ok if no errors
*/
NS_IMETHOD SelectAll() = 0;
/**
* Set the selection in this text component
* @param aStartSel starting selection position in characters
* @param aEndSel ending selection position in characters
* @result NS_Ok if no errors
*/
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
/**
* Get the selection in this text component
* @param aStartSel starting selection position in characters
* @param aEndSel ending selection position in characters
* @result NS_Ok if no errors
*/
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
/**
* Set the caret position
* @param aPosition caret position in characters
* @result NS_Ok if no errors
*/
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
/**
* Get the caret position
* @return caret position in characters
* @result NS_Ok if no errors
*/
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
};
#endif // nsITextAreaWidget_h__

View File

@ -39,7 +39,7 @@ struct nsTextWidgetInitData : public nsWidgetInitData {
*
*/
class nsITextWidget : public nsIWidget
class nsITextWidget : public nsISupports
{
public:
@ -49,21 +49,23 @@ class nsITextWidget : public nsIWidget
*
* @param aTextBuffer on return contains the text of this component
* @param aBufferSize the size of the buffer passed in
* @return the number of char copied
* @param aActualSize the number of char copied
* @result NS_Ok if no errors
*
*/
virtual PRUint32 GetText(nsString &aTextBuffer, PRUint32 aBufferSize) = 0;
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
/**
* Set the text of this component.
*
* @param aTextBuffer on return it contains the text contents.
* @param aText -- an object containing a copy of the text
* @return the number of chars in the text string
* @result NS_Ok if no errors
*
*/
virtual PRUint32 SetText(const nsString &aText) = 0;
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
/**
* Insert text into this component.
@ -75,79 +77,89 @@ class nsITextWidget : public nsIWidget
* @param aText the text to set
* @param aStartPos starting position for inserting text
* @param aEndPos ending position for inserting text
* @result NS_Ok if no errors
*/
virtual PRUint32 InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos) = 0;
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
/**
* Remove any content from this text widget
* @result NS_Ok if no errors
*/
virtual void RemoveText() = 0;
NS_IMETHOD RemoveText(void) = 0;
/**
* Indicates a password will be entered.
*
* @param aIsPassword PR_TRUE shows contents as asterisks. PR_FALSE shows
* contents as normal text.
* @result NS_Ok if no errors
*/
virtual void SetPassword(PRBool aIsPassword) = 0;
NS_IMETHOD SetPassword(PRBool aIsPassword) = 0;
/**
* 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
* @result NS_Ok if no errors
*/
virtual void SetMaxTextLength(PRUint32 aChars) = 0;
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
/**
* Set the text widget to be read-only
*
* @param aReadOnlyFlag PR_TRUE the widget is read-only,
* PR_FALSE indicates the widget is writable.
* @return PR_TRUE if it was read only. PR_FALSE if it was writable
* @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
*/
virtual PRBool SetReadOnly(PRBool aReadOnlyFlag) = 0;
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
/**
* Select all of the contents
* @result NS_Ok if no errors
*/
virtual void SelectAll() = 0;
NS_IMETHOD SelectAll() = 0;
/**
* Set the selection in this text component
* @param aStartSel starting selection position in characters
* @param aEndSel ending selection position in characters
* @result NS_Ok if no errors
*/
virtual void SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
/**
* Get the selection in this text component
* @param aStartSel starting selection position in characters
* @param aEndSel ending selection position in characters
* @result NS_Ok if no errors
*/
virtual void GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
/**
* Set the caret position
* @param aPosition caret position in characters
* @result NS_Ok if no errors
*/
virtual void SetCaretPosition(PRUint32 aPosition) = 0;
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
/**
* Get the caret position
* @return caret position in characters
* @result NS_Ok if no errors
*/
virtual PRUint32 GetCaretPosition() = 0;
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
};

View File

@ -30,10 +30,8 @@
*
*/
class nsITooltipWidget : public nsIWidget
class nsITooltipWidget : public nsISupports
{
public:
};
#endif // nsITooltipWidget_h__

View File

@ -0,0 +1,161 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsWidgetSupport_h__
#define nsWidgetSupport_h__
#include "nscore.h"
#include "nsISupports.h"
#include "nsIWidget.h"
struct nsRect;
class nsITextAreaWidget;
class nsIFileWidget;
class nsIAppShell;
class nsIButton;
class nsIComboBox;
class nsIEventListener;
class nsILabel;
class nsIListBox;
class nsIListWidget;
class nsILookAndFeel;
class nsIMouseListener;
class nsIRadioGroup;
class nsITabWidget;
class nsIToolkit;
class nsIWidget;
class nsIDialog;
class nsICheckButton;
class nsIScrollbar;
class nsIRadioButton;
class nsITooltipWidget;
class nsITextWidget;
// These are a series of support methods which help in the creation
// of widgets. They are not needed, but are provided as a convenience
// mechanism when creating widgets
extern NS_WIDGET nsresult
NS_CreateDialog(nsISupports* aParent,
nsIDialog* aDialog,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateButton( nsISupports* aParent,
nsIButton* aButton,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateCheckButton( nsISupports* aParent,
nsICheckButton* aCheckButton,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateRadioButton( nsISupports* aParent,
nsIRadioButton* aButton,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateLabel( nsISupports* aParent,
nsILabel* aLabel,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateTextWidget(nsISupports* aParent,
nsITextWidget* aWidget,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateTextAreaWidget(nsISupports* aParent,
nsITextAreaWidget* aWidget,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateTooltipWidget(nsISupports* aParent,
nsITooltipWidget* aWidget,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateListBox(nsISupports* aParent,
nsIListBox* aWidget,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateComboBox(nsISupports* aParent,
nsIComboBox* aWidget,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateTabWidget(nsISupports* aParent,
nsITabWidget* aWidget,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction,
const nsFont* aFont = nsnull);
extern NS_WIDGET nsresult
NS_CreateScrollBar(nsISupports* aParent,
nsIScrollbar* aWidget,
const nsRect& aRect,
EVENT_CALLBACK aHandleEventFunction);
extern NS_WIDGET nsresult
NS_ShowWidget(nsISupports* aWidget, PRBool aShow);
extern NS_WIDGET nsresult
NS_MoveWidget(nsISupports* aWidget, PRUint32 aX, PRUint32 aY);
extern NS_WIDGET nsresult
NS_EnableWidget(nsISupports* aWidget, PRBool aEnable);
extern NS_WIDGET nsresult
NS_SetFocusToWidget(nsISupports* aWidget);
extern NS_WIDGET nsresult
NS_GetWidgetNativeData(nsISupports* aWidget, void** aNativeData);
#endif