mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
fix for 12501 and make the rest of the widgets use NS_* macros
This commit is contained in:
parent
a07a03cc31
commit
e9a4611715
@ -25,6 +25,7 @@
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsButton, nsWidget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsButton, nsWidget)
|
||||
NS_IMPL_QUERY_INTERFACE2(nsButton, nsIButton, nsIWidget)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
@ -40,7 +41,7 @@ nsButton::nsButton() : nsWidget() , nsIButton()
|
||||
// Create the native Button widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsButton::CreateNative(GtkWidget *parentWindow)
|
||||
NS_IMETHODIMP nsButton::CreateNative(GtkWidget *parentWindow)
|
||||
{
|
||||
mWidget = gtk_button_new_with_label("");
|
||||
gtk_widget_set_name(mWidget, "nsButton");
|
||||
@ -77,36 +78,12 @@ void nsButton::InitCallbacks(char * aName)
|
||||
GDK_POINTER_MOTION_MASK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the standard QueryInterface for NS_IWIDGET_IID and NS_ISUPPORTS_IID
|
||||
* @modify gpk 8/4/98
|
||||
* @param aIID The name of the class implementing the method
|
||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||
*
|
||||
*/
|
||||
nsresult nsButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsIButton::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIButton*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsButton::SetLabel(const nsString& aText)
|
||||
NS_IMETHODIMP nsButton::SetLabel(const nsString& aText)
|
||||
{
|
||||
NS_ALLOC_STR_BUF(label, aText, 256);
|
||||
|
||||
@ -121,7 +98,7 @@ NS_METHOD nsButton::SetLabel(const nsString& aText)
|
||||
// Get this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsButton::GetLabel(nsString& aBuffer)
|
||||
NS_IMETHODIMP nsButton::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
char * text;
|
||||
|
||||
|
@ -33,22 +33,14 @@ public:
|
||||
nsButton();
|
||||
virtual ~nsButton();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIButton part
|
||||
NS_IMETHOD SetLabel(const nsString& aText);
|
||||
NS_IMETHOD GetLabel(nsString& aBuffer);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY) { return PR_FALSE; }
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent) { return PR_FALSE; }
|
||||
virtual PRBool OnResize(nsRect &aRect) { return PR_FALSE; }
|
||||
|
||||
virtual void SetFontNative(GdkFont *aFont);
|
||||
|
||||
|
||||
protected:
|
||||
NS_METHOD CreateNative(GtkWidget *parentWindow);
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsCheckButton, nsWidget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsCheckButton, nsWidget)
|
||||
NS_IMPL_QUERY_INTERFACE2(nsCheckButton, nsICheckButton, nsIWidget)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
@ -108,28 +109,6 @@ void nsCheckButton::InitCallbacks(char * aName)
|
||||
GTK_SIGNAL_FUNC(nsCheckButton::ToggledSignal));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the standard QueryInterface for NS_IWIDGET_IID and NS_ISUPPORTS_IID
|
||||
* @modify gpk 8/4/98
|
||||
* @param aIID The name of the class implementing the method
|
||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||
*
|
||||
*/
|
||||
nsresult nsCheckButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsICheckButton::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICheckButton*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return nsWidget::QueryInterface(aIID,aInstancePtr);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
|
@ -35,10 +35,7 @@ public:
|
||||
nsCheckButton();
|
||||
virtual ~nsCheckButton();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||
NS_IMETHOD_(nsrefcnt) Release();
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsICheckButton part
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
@ -46,10 +43,6 @@ public:
|
||||
NS_IMETHOD SetState(const PRBool aState);
|
||||
NS_IMETHOD GetState(PRBool& aState);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY) { return PR_FALSE; }
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent) { return PR_FALSE; }
|
||||
virtual PRBool OnResize(nsRect &aRect) { return PR_FALSE; }
|
||||
|
||||
virtual void OnToggledSignal(const gboolean aState);
|
||||
|
||||
protected:
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsComboBox, nsWidget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsComboBox, nsWidget)
|
||||
NS_IMPL_QUERY_INTERFACE3(nsComboBox, nsIComboBox, nsIListWidget, nsIWidget)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
@ -269,28 +270,6 @@ NS_METHOD nsComboBox::Deselect()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsComboBox::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(nsIComboBox::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIComboBox*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(nsIListWidget::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIListWidget*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsWidget::QueryInterface(aIID,aInstancePtr);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Create the native GtkCombo widget
|
||||
|
@ -33,11 +33,9 @@ class nsComboBox : public nsWidget,
|
||||
|
||||
public:
|
||||
nsComboBox();
|
||||
~nsComboBox();
|
||||
virtual ~nsComboBox();
|
||||
|
||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||
NS_IMETHOD_(nsrefcnt) Release();
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIComboBox interface
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition);
|
||||
@ -50,10 +48,6 @@ public:
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition);
|
||||
NS_IMETHOD Deselect() ;
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY) { return PR_FALSE; }
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent) { return PR_FALSE; }
|
||||
virtual PRBool OnResize(nsRect &aRect) { return PR_FALSE; }
|
||||
|
||||
// nsIComboBox interface
|
||||
NS_IMETHOD SetMultipleSelection(PRBool aMultipleSelections);
|
||||
PRInt32 GetSelectedCount();
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "nsFileWidget.h"
|
||||
#include "nsIToolkit.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsFileWidget, nsIFileWidget::GetIID());
|
||||
NS_IMPL_ISUPPORTS1(nsFileWidget, nsIFileWidget)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
@ -42,16 +42,19 @@ nsFileWidget::nsFileWidget() : nsIFileWidget()
|
||||
//-------------------------------------------------------------------------
|
||||
nsFileWidget::~nsFileWidget()
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
GList *list = g_list_first(GTK_MENU_SHELL(mFilterMenu)->children);
|
||||
|
||||
for (;list; list = list->next)
|
||||
if (mFilterMenu)
|
||||
{
|
||||
menu_item = GTK_WIDGET(list->data);
|
||||
gchar *data = (gchar*)gtk_object_get_data(GTK_OBJECT(menu_item), "filters");
|
||||
GtkWidget *menu_item;
|
||||
GList *list = g_list_first(GTK_MENU_SHELL(mFilterMenu)->children);
|
||||
|
||||
if (data)
|
||||
delete[] data;
|
||||
for (;list; list = list->next)
|
||||
{
|
||||
menu_item = GTK_WIDGET(list->data);
|
||||
gchar *data = (gchar*)gtk_object_get_data(GTK_OBJECT(menu_item), "filters");
|
||||
|
||||
if (data)
|
||||
delete[] data;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_destroy(mWidget);
|
||||
@ -72,6 +75,13 @@ static void file_cancel_clicked(GtkWidget *w, PRBool *ret)
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static void filter_item_activated(GtkWidget *w, gpointer data)
|
||||
{
|
||||
nsFileWidget *f = (nsFileWidget*)data;
|
||||
gchar *foo = (gchar*)gtk_object_get_data(GTK_OBJECT(w), "filters");
|
||||
g_print("filter_item_activated(): %s\n", foo);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Show - Display the file dialog
|
||||
@ -84,7 +94,12 @@ PRBool nsFileWidget::Show()
|
||||
// make things shorter
|
||||
GtkFileSelection *fs = GTK_FILE_SELECTION(mWidget);
|
||||
|
||||
gtk_option_menu_set_menu(GTK_OPTION_MENU(mOptionMenu), mFilterMenu);
|
||||
if (mNumberOfFilters != 0)
|
||||
{
|
||||
gtk_option_menu_set_menu(GTK_OPTION_MENU(mOptionMenu), mFilterMenu);
|
||||
}
|
||||
else
|
||||
gtk_widget_hide(mOptionMenu);
|
||||
|
||||
// gtk_window_set_modal(GTK_WINDOW(mWidget), PR_TRUE);
|
||||
gtk_widget_show(mWidget);
|
||||
@ -111,9 +126,9 @@ PRBool nsFileWidget::Show()
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,
|
||||
const nsString aTitles[],
|
||||
const nsString aFilters[])
|
||||
NS_IMETHODIMP nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,
|
||||
const nsString aTitles[],
|
||||
const nsString aFilters[])
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
|
||||
@ -134,6 +149,11 @@ NS_METHOD nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,
|
||||
|
||||
gtk_object_set_data(GTK_OBJECT(menu_item), "filters", filters);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(menu_item),
|
||||
"activate",
|
||||
GTK_SIGNAL_FUNC(filter_item_activated),
|
||||
this);
|
||||
|
||||
gtk_menu_append(GTK_MENU(mFilterMenu), menu_item);
|
||||
gtk_widget_show(menu_item);
|
||||
|
||||
@ -143,7 +163,7 @@ NS_METHOD nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::GetFile(nsFileSpec& aFile)
|
||||
NS_IMETHODIMP nsFileWidget::GetFile(nsFileSpec& aFile)
|
||||
{
|
||||
if (mWidget) {
|
||||
gchar *fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION(mWidget));
|
||||
@ -155,7 +175,7 @@ NS_METHOD nsFileWidget::GetFile(nsFileSpec& aFile)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::GetSelectedType(PRInt16& theType)
|
||||
NS_IMETHODIMP nsFileWidget::GetSelectedType(PRInt16& theType)
|
||||
{
|
||||
theType = mSelectedType;
|
||||
return NS_OK;
|
||||
@ -166,7 +186,7 @@ NS_METHOD nsFileWidget::GetSelectedType(PRInt16& theType)
|
||||
// Get the file + path
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::SetDefaultString(const nsString& aString)
|
||||
NS_IMETHODIMP nsFileWidget::SetDefaultString(const nsString& aString)
|
||||
{
|
||||
if (mWidget) {
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(mWidget),
|
||||
@ -181,7 +201,7 @@ NS_METHOD nsFileWidget::SetDefaultString(const nsString& aString)
|
||||
// Set the display directory
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::SetDisplayDirectory(const nsFileSpec& aDirectory)
|
||||
NS_IMETHODIMP nsFileWidget::SetDisplayDirectory(const nsFileSpec& aDirectory)
|
||||
{
|
||||
mDisplayDirectory = aDirectory;
|
||||
return NS_OK;
|
||||
@ -192,7 +212,7 @@ NS_METHOD nsFileWidget::SetDisplayDirectory(const nsFileSpec& aDirectory)
|
||||
// Get the display directory
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::GetDisplayDirectory(nsFileSpec& aDirectory)
|
||||
NS_IMETHODIMP nsFileWidget::GetDisplayDirectory(nsFileSpec& aDirectory)
|
||||
{
|
||||
aDirectory = mDisplayDirectory;
|
||||
return NS_OK;
|
||||
@ -200,13 +220,13 @@ NS_METHOD nsFileWidget::GetDisplayDirectory(nsFileSpec& aDirectory)
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::Create(nsIWidget *aParent,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
void *aInitData)
|
||||
NS_IMETHODIMP nsFileWidget::Create(nsIWidget *aParent,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
void *aInitData)
|
||||
{
|
||||
mMode = aMode;
|
||||
mTitle.SetLength(0);
|
||||
|
@ -276,6 +276,7 @@ void InitKeyPressEvent(GdkEventKey *aGEK,
|
||||
if (aGEK!=nsnull) {
|
||||
anEvent.keyCode = nsConvertKey(aGEK->keyval) & 0x00FF;
|
||||
anEvent.charCode = nsConvertCharCodeToUnicode(aGEK->string);
|
||||
g_print("%s\n", aGEK->string);
|
||||
anEvent.time = aGEK->time;
|
||||
anEvent.isShift = (aGEK->state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
anEvent.isControl = (aGEK->state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE;
|
||||
@ -562,7 +563,6 @@ gint handle_key_press_event(GtkWidget *w, GdkEventKey* event, gpointer p)
|
||||
{
|
||||
nsKeyEvent kevent;
|
||||
nsWindow* win = (nsWindow*)p;
|
||||
int isModifier;
|
||||
|
||||
// work around for annoying things.
|
||||
if (event->keyval == GDK_Tab)
|
||||
@ -591,10 +591,6 @@ gint handle_key_press_event(GtkWidget *w, GdkEventKey* event, gpointer p)
|
||||
// character code. Note we have to check for modifier keys, since
|
||||
// gtk returns a character value for them
|
||||
//
|
||||
isModifier = event->state &(GDK_CONTROL_MASK|GDK_MOD1_MASK);
|
||||
#ifdef DEBUG_EVENTS
|
||||
if (isModifier) printf("isModifier\n");
|
||||
#endif
|
||||
if (event->length) {
|
||||
InitKeyPressEvent(event,p,kevent);
|
||||
win->OnKey(kevent);
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsLabel, nsWidget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsLabel, nsWidget)
|
||||
NS_IMPL_QUERY_INTERFACE2(nsLabel, nsILabel, nsIWidget)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
@ -50,7 +51,7 @@ nsLabel::~nsLabel()
|
||||
// Create the nativeLabel widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::CreateNative(GtkWidget *parentWindow)
|
||||
NS_IMETHODIMP nsLabel::CreateNative(GtkWidget *parentWindow)
|
||||
{
|
||||
unsigned char alignment = GetNativeAlignment();
|
||||
|
||||
@ -65,7 +66,7 @@ NS_METHOD nsLabel::CreateNative(GtkWidget *parentWindow)
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
NS_IMETHODIMP nsLabel::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
if (nsnull != aInitData) {
|
||||
nsLabelInitData* data = (nsLabelInitData *) aInitData;
|
||||
@ -79,7 +80,7 @@ NS_METHOD nsLabel::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
// Set alignment
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::SetAlignment(nsLabelAlignment aAlignment)
|
||||
NS_IMETHODIMP nsLabel::SetAlignment(nsLabelAlignment aAlignment)
|
||||
{
|
||||
GtkJustification align;
|
||||
|
||||
@ -90,26 +91,6 @@ NS_METHOD nsLabel::SetAlignment(nsLabelAlignment aAlignment)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsLabel::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(nsILabel::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsILabel*)this);
|
||||
AddRef();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -34,10 +34,7 @@ public:
|
||||
nsLabel();
|
||||
virtual ~nsLabel();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||
NS_IMETHOD_(nsrefcnt) Release();
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsILabel part
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsListBox, nsWidget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsListBox, nsWidget)
|
||||
NS_IMPL_QUERY_INTERFACE3(nsListBox, nsIListBox, nsIListWidget, nsIWidget)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
@ -66,39 +67,13 @@ void nsListBox::InitCallbacks(char * aName)
|
||||
GDK_POINTER_MOTION_MASK);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsListBox::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
if (result == NS_NOINTERFACE) {
|
||||
if (aIID.Equals(nsIListBox::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIListBox*)this);
|
||||
AddRef();
|
||||
result = NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(nsIListWidget::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIListWidget*)this);
|
||||
AddRef();
|
||||
result = NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// initializer
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsListBox::SetMultipleSelection(PRBool aMultipleSelections)
|
||||
NS_IMETHODIMP nsListBox::SetMultipleSelection(PRBool aMultipleSelections)
|
||||
{
|
||||
mMultiSelect = aMultipleSelections;
|
||||
if (mCList) {
|
||||
@ -117,7 +92,7 @@ NS_METHOD nsListBox::SetMultipleSelection(PRBool aMultipleSelections)
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsListBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
|
||||
NS_IMETHODIMP nsListBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
|
||||
{
|
||||
if (mCList) {
|
||||
gchar *text[2];
|
||||
@ -204,7 +179,7 @@ PRBool nsListBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
|
||||
// Gets the selected of selected item
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::GetSelectedItem(nsString& aItem)
|
||||
NS_IMETHODIMP nsListBox::GetSelectedItem(nsString& aItem)
|
||||
{
|
||||
aItem.Truncate();
|
||||
if (mCList) {
|
||||
@ -256,7 +231,7 @@ PRInt32 nsListBox::GetSelectedIndex()
|
||||
// SelectItem
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::SelectItem(PRInt32 aPosition)
|
||||
NS_IMETHODIMP nsListBox::SelectItem(PRInt32 aPosition)
|
||||
{
|
||||
if (mCList) {
|
||||
gtk_clist_select_row(GTK_CLIST(mCList), aPosition, 0);
|
||||
@ -287,7 +262,7 @@ PRInt32 nsListBox::GetSelectedCount()
|
||||
// GetSelectedIndices
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
NS_IMETHODIMP nsListBox::GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
{
|
||||
if (mCList) {
|
||||
PRInt32 i=0, num = 0;
|
||||
@ -313,7 +288,7 @@ NS_METHOD nsListBox::GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
// SetSelectedIndices
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
NS_IMETHODIMP nsListBox::SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
{
|
||||
if (mCList) {
|
||||
gtk_clist_unselect_all(GTK_CLIST(mCList));
|
||||
@ -330,7 +305,7 @@ NS_METHOD nsListBox::SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
// Deselect
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::Deselect()
|
||||
NS_IMETHODIMP nsListBox::Deselect()
|
||||
{
|
||||
if (mCList) {
|
||||
gtk_clist_unselect_all(GTK_CLIST(mCList));
|
||||
@ -343,7 +318,7 @@ NS_METHOD nsListBox::Deselect()
|
||||
// Set initial parameters
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
NS_IMETHODIMP nsListBox::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
if (nsnull != aInitData) {
|
||||
nsListBoxInitData* data = (nsListBoxInitData *) aInitData;
|
||||
@ -357,7 +332,7 @@ NS_METHOD nsListBox::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
// Create the native widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::CreateNative(GtkWidget *parentWindow)
|
||||
NS_IMETHODIMP nsListBox::CreateNative(GtkWidget *parentWindow)
|
||||
{
|
||||
// to handle scrolling
|
||||
mWidget = gtk_scrolled_window_new (nsnull, nsnull);
|
||||
|
@ -34,14 +34,7 @@ public:
|
||||
nsListBox();
|
||||
virtual ~nsListBox();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||
NS_IMETHOD_(nsrefcnt) Release();
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY) { return PR_FALSE; }
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent) { return PR_FALSE; }
|
||||
virtual PRBool OnResize(nsRect &aRect) { return PR_FALSE; }
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIListBox interface
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
@ -23,8 +23,9 @@
|
||||
|
||||
#include "nsGtkEventHandler.h"
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsScrollbar, nsWidget);
|
||||
NS_IMPL_RELEASE_INHERITED(nsScrollbar, nsWidget);
|
||||
NS_IMPL_ADDREF_INHERITED(nsScrollbar, nsWidget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsScrollbar, nsWidget)
|
||||
NS_IMPL_QUERY_INTERFACE2(nsScrollbar, nsIScrollbar, nsIWidget)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
@ -53,7 +54,7 @@ nsScrollbar::~nsScrollbar ()
|
||||
// Create the native scrollbar widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::CreateNative (GtkWidget * parentWindow)
|
||||
NS_IMETHODIMP nsScrollbar::CreateNative (GtkWidget * parentWindow)
|
||||
{
|
||||
// Create scrollbar, random default values
|
||||
mAdjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 25, 25));
|
||||
@ -93,30 +94,12 @@ nsScrollbar::OnDestroySignal(GtkWidget* aGtkWidget)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsScrollbar::QueryInterface (const nsIID & aIID, void **aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(nsIScrollbar::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIScrollbar*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Define the range settings
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::SetMaxRange (PRUint32 aEndRange)
|
||||
NS_IMETHODIMP nsScrollbar::SetMaxRange (PRUint32 aEndRange)
|
||||
{
|
||||
if (mAdjustment) {
|
||||
GTK_ADJUSTMENT (mAdjustment)->upper = (float) aEndRange;
|
||||
@ -131,7 +114,7 @@ NS_METHOD nsScrollbar::SetMaxRange (PRUint32 aEndRange)
|
||||
// Return the range settings
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::GetMaxRange (PRUint32 & aMaxRange)
|
||||
NS_IMETHODIMP nsScrollbar::GetMaxRange (PRUint32 & aMaxRange)
|
||||
{
|
||||
if (mAdjustment)
|
||||
aMaxRange = (PRUint32) GTK_ADJUSTMENT (mAdjustment)->upper;
|
||||
@ -147,7 +130,7 @@ NS_METHOD nsScrollbar::GetMaxRange (PRUint32 & aMaxRange)
|
||||
// Set the thumb position
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::SetPosition (PRUint32 aPos)
|
||||
NS_IMETHODIMP nsScrollbar::SetPosition (PRUint32 aPos)
|
||||
{
|
||||
// if (mAdjustment)
|
||||
// gtk_adjustment_set_value (GTK_ADJUSTMENT (mAdjustment), (float) aPos);
|
||||
@ -197,7 +180,7 @@ NS_METHOD nsScrollbar::SetPosition (PRUint32 aPos)
|
||||
// Get the current thumb position.
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::GetPosition (PRUint32 & aPos)
|
||||
NS_IMETHODIMP nsScrollbar::GetPosition (PRUint32 & aPos)
|
||||
{
|
||||
if (mAdjustment)
|
||||
aPos = (PRUint32) GTK_ADJUSTMENT (mAdjustment)->value;
|
||||
@ -213,7 +196,7 @@ NS_METHOD nsScrollbar::GetPosition (PRUint32 & aPos)
|
||||
// Set the thumb size
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::SetThumbSize (PRUint32 aSize)
|
||||
NS_IMETHODIMP nsScrollbar::SetThumbSize (PRUint32 aSize)
|
||||
{
|
||||
if (aSize > 0)
|
||||
{
|
||||
@ -232,7 +215,7 @@ NS_METHOD nsScrollbar::SetThumbSize (PRUint32 aSize)
|
||||
// Get the thumb size
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::GetThumbSize (PRUint32 & aThumbSize)
|
||||
NS_IMETHODIMP nsScrollbar::GetThumbSize (PRUint32 & aThumbSize)
|
||||
{
|
||||
if (mAdjustment)
|
||||
aThumbSize = (PRUint32) GTK_ADJUSTMENT (mAdjustment)->page_size;
|
||||
@ -248,7 +231,7 @@ NS_METHOD nsScrollbar::GetThumbSize (PRUint32 & aThumbSize)
|
||||
// Set the line increment for this scrollbar
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::SetLineIncrement (PRUint32 aLineIncrement)
|
||||
NS_IMETHODIMP nsScrollbar::SetLineIncrement (PRUint32 aLineIncrement)
|
||||
{
|
||||
if (aLineIncrement > 0)
|
||||
{
|
||||
@ -266,7 +249,7 @@ NS_METHOD nsScrollbar::SetLineIncrement (PRUint32 aLineIncrement)
|
||||
// Get the line increment for this scrollbar
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::GetLineIncrement (PRUint32 & aLineInc)
|
||||
NS_IMETHODIMP nsScrollbar::GetLineIncrement (PRUint32 & aLineInc)
|
||||
{
|
||||
if (mAdjustment) {
|
||||
aLineInc = (PRUint32) GTK_ADJUSTMENT (mAdjustment)->step_increment;
|
||||
@ -283,7 +266,7 @@ NS_METHOD nsScrollbar::GetLineIncrement (PRUint32 & aLineInc)
|
||||
// Set all scrolling parameters
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsScrollbar::SetParameters (PRUint32 aMaxRange, PRUint32 aThumbSize,
|
||||
NS_IMETHODIMP nsScrollbar::SetParameters (PRUint32 aMaxRange, PRUint32 aThumbSize,
|
||||
PRUint32 aPosition, PRUint32 aLineIncrement)
|
||||
{
|
||||
if (mAdjustment) {
|
||||
|
@ -33,10 +33,7 @@ public:
|
||||
nsScrollbar(PRBool aIsVertical);
|
||||
virtual ~nsScrollbar();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||
NS_IMETHOD_(nsrefcnt) Release();
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIScrollBar implementation
|
||||
NS_IMETHOD SetMaxRange(PRUint32 aEndRange);
|
||||
@ -51,11 +48,6 @@ public:
|
||||
PRUint32 aPosition, PRUint32 aLineIncrement);
|
||||
virtual PRBool OnScroll (nsScrollbarEvent & aEvent, PRUint32 cPos);
|
||||
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY) { return PR_FALSE; }
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent) { return PR_FALSE; }
|
||||
virtual PRBool OnResize(nsRect &aRect) { return PR_FALSE; }
|
||||
|
||||
protected:
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow);
|
||||
virtual void OnDestroySignal(GtkWidget* aGtkWidget);
|
||||
|
@ -21,7 +21,9 @@
|
||||
#include "nsTextAreaWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define DBG 0
|
||||
NS_IMPL_ADDREF_INHERITED(nsTextAreaWidget, nsWidget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsTextAreaWidget, nsWidget)
|
||||
NS_IMPL_QUERY_INTERFACE2(nsTextAreaWidget, nsITextAreaWidget, nsIWidget)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
@ -70,25 +72,6 @@ NS_METHOD nsTextAreaWidget::CreateNative(GtkWidget *parentWindow)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsTextAreaWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(nsITextAreaWidget::GetIID())) {
|
||||
nsITextAreaWidget* textArea = this;
|
||||
*aInstancePtr = (void*) (textArea);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(nsIWidget::GetIID()))
|
||||
{
|
||||
nsIWidget* widget = this;
|
||||
*aInstancePtr = (void*) (widget);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// set font for textarea
|
||||
|
@ -33,13 +33,7 @@ public:
|
||||
nsTextAreaWidget();
|
||||
virtual ~nsTextAreaWidget();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY) { return PR_FALSE; }
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent) { return PR_FALSE; }
|
||||
virtual PRBool OnResize(nsRect &aRect) { return PR_FALSE; }
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
virtual void SetFontNative(GdkFont *aFont);
|
||||
|
||||
|
@ -51,7 +51,7 @@ nsTextHelper::~nsTextHelper()
|
||||
// Set initial parameters
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
NS_IMETHODIMP nsTextHelper::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
if (nsnull != aInitData) {
|
||||
nsTextWidgetInitData* data = (nsTextWidgetInitData *) aInitData;
|
||||
@ -62,7 +62,7 @@ NS_METHOD nsTextHelper::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::SetMaxTextLength(PRUint32 aChars)
|
||||
NS_IMETHODIMP nsTextHelper::SetMaxTextLength(PRUint32 aChars)
|
||||
{
|
||||
// This is a normal entry only thing, not a text box
|
||||
gtk_entry_set_max_length(GTK_ENTRY(mTextWidget), (int)aChars);
|
||||
@ -70,7 +70,7 @@ NS_METHOD nsTextHelper::SetMaxTextLength(PRUint32 aChars)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::GetText(nsString& aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize)
|
||||
NS_IMETHODIMP nsTextHelper::GetText(nsString& aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize)
|
||||
{
|
||||
char *str = nsnull;
|
||||
if (GTK_IS_ENTRY(mTextWidget))
|
||||
@ -91,7 +91,7 @@ NS_METHOD nsTextHelper::GetText(nsString& aTextBuffer, PRUint32 aBufferSize, PR
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::SetText(const nsString& aText, PRUint32& aActualSize)
|
||||
NS_IMETHODIMP nsTextHelper::SetText(const nsString& aText, PRUint32& aActualSize)
|
||||
{
|
||||
if (GTK_IS_ENTRY(mTextWidget)) {
|
||||
gtk_entry_set_text(GTK_ENTRY(mTextWidget),
|
||||
@ -111,7 +111,7 @@ NS_METHOD nsTextHelper::SetText(const nsString& aText, PRUint32& aActualSize)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::InsertText(const nsString &aText,
|
||||
NS_IMETHODIMP nsTextHelper::InsertText(const nsString &aText,
|
||||
PRUint32 aStartPos,
|
||||
PRUint32 aEndPos,
|
||||
PRUint32& aActualSize)
|
||||
@ -126,7 +126,7 @@ NS_METHOD nsTextHelper::InsertText(const nsString &aText,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::RemoveText()
|
||||
NS_IMETHODIMP nsTextHelper::RemoveText()
|
||||
{
|
||||
if (GTK_IS_ENTRY(mTextWidget)) {
|
||||
gtk_entry_set_text(GTK_ENTRY(mTextWidget), "");
|
||||
@ -138,7 +138,7 @@ NS_METHOD nsTextHelper::RemoveText()
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::SetPassword(PRBool aIsPassword)
|
||||
NS_IMETHODIMP nsTextHelper::SetPassword(PRBool aIsPassword)
|
||||
{
|
||||
mIsPassword = aIsPassword?PR_FALSE:PR_TRUE;
|
||||
if (GTK_IS_ENTRY(mTextWidget)) {
|
||||
@ -149,7 +149,7 @@ NS_METHOD nsTextHelper::SetPassword(PRBool aIsPassword)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::SetReadOnly(PRBool aReadOnlyFlag, PRBool& aOldReadOnlyFlag)
|
||||
NS_IMETHODIMP nsTextHelper::SetReadOnly(PRBool aReadOnlyFlag, PRBool& aOldReadOnlyFlag)
|
||||
{
|
||||
NS_ASSERTION(nsnull != mTextWidget,
|
||||
"SetReadOnly - Widget is NULL, Create may not have been called!");
|
||||
@ -161,7 +161,7 @@ NS_METHOD nsTextHelper::SetReadOnly(PRBool aReadOnlyFlag, PRBool& aOldReadOnlyF
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::SelectAll()
|
||||
NS_IMETHODIMP nsTextHelper::SelectAll()
|
||||
{
|
||||
nsString text;
|
||||
PRUint32 actualSize = 0;
|
||||
@ -172,7 +172,7 @@ NS_METHOD nsTextHelper::SelectAll()
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::SetSelection(PRUint32 aStartSel, PRUint32 aEndSel)
|
||||
NS_IMETHODIMP nsTextHelper::SetSelection(PRUint32 aStartSel, PRUint32 aEndSel)
|
||||
{
|
||||
gtk_editable_select_region(GTK_EDITABLE(mTextWidget), aStartSel, aEndSel);
|
||||
return NS_OK;
|
||||
@ -180,7 +180,7 @@ NS_METHOD nsTextHelper::SetSelection(PRUint32 aStartSel, PRUint32 aEndSel)
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel)
|
||||
NS_IMETHODIMP nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel)
|
||||
{
|
||||
#if 0
|
||||
XmTextPosition left;
|
||||
@ -198,14 +198,14 @@ NS_METHOD nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::SetCaretPosition(PRUint32 aPosition)
|
||||
NS_IMETHODIMP nsTextHelper::SetCaretPosition(PRUint32 aPosition)
|
||||
{
|
||||
gtk_editable_set_position(GTK_EDITABLE(mTextWidget), aPosition);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextHelper::GetCaretPosition(PRUint32& aPosition)
|
||||
NS_IMETHODIMP nsTextHelper::GetCaretPosition(PRUint32& aPosition)
|
||||
{
|
||||
aPosition = (PRUint32)GTK_EDITABLE(mTextWidget)->current_pos;
|
||||
return NS_OK;
|
||||
|
@ -26,6 +26,12 @@
|
||||
|
||||
extern int mIsPasswordCallBacksInstalled;
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsTextWidget, nsWidget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsTextWidget, nsWidget)
|
||||
NS_IMPL_QUERY_INTERFACE2(nsTextWidget, nsITextWidget, nsIWidget)
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsTextWidget constructor
|
||||
@ -51,7 +57,7 @@ nsTextWidget::~nsTextWidget()
|
||||
// Create the native Entry widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextWidget::CreateNative(GtkWidget *parentWindow)
|
||||
NS_IMETHODIMP nsTextWidget::CreateNative(GtkWidget *parentWindow)
|
||||
{
|
||||
PRBool oldIsReadOnly;
|
||||
mWidget = gtk_entry_new();
|
||||
@ -86,21 +92,3 @@ NS_METHOD nsTextWidget::CreateNative(GtkWidget *parentWindow)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsTextWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(nsITextWidget::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsITextWidget*)this);
|
||||
AddRef();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -34,12 +34,7 @@ public:
|
||||
nsTextWidget();
|
||||
virtual ~nsTextWidget();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY) { return PR_FALSE; }
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent) { return PR_FALSE; }
|
||||
virtual PRBool OnResize(nsRect &aRect) { return PR_FALSE; }
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
protected:
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow);
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
|
||||
|
||||
nsILookAndFeel *nsWidget::sLookAndFeel = nsnull;
|
||||
PRUint32 nsWidget::sWidgetCount = 0;
|
||||
|
||||
@ -62,6 +64,7 @@ nsWidget::nsWidget()
|
||||
sLookAndFeel->GetColor(nsILookAndFeel::eColor_WindowBackground,
|
||||
mBackground);
|
||||
|
||||
mGrabTime = 0;
|
||||
mWidget = nsnull;
|
||||
mParent = nsnull;
|
||||
mPreferredWidth = 0;
|
||||
@ -94,7 +97,7 @@ nsWidget::~nsWidget()
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::GetAbsoluteBounds(nsRect &aRect)
|
||||
NS_IMETHODIMP nsWidget::GetAbsoluteBounds(nsRect &aRect)
|
||||
{
|
||||
gint x;
|
||||
gint y;
|
||||
@ -120,7 +123,7 @@ NS_METHOD nsWidget::GetAbsoluteBounds(nsRect &aRect)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
|
||||
NS_IMETHODIMP nsWidget::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
|
||||
{
|
||||
gint x;
|
||||
gint y;
|
||||
@ -147,7 +150,7 @@ NS_METHOD nsWidget::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
|
||||
NS_IMETHODIMP nsWidget::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
|
||||
{
|
||||
#ifdef DEBUG_pavlov
|
||||
g_print("nsWidget::ScreenToWidget\n");
|
||||
@ -258,7 +261,7 @@ nsIWidget* nsWidget::GetParent(void)
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsWidget::Show(PRBool bState)
|
||||
NS_IMETHODIMP nsWidget::Show(PRBool bState)
|
||||
{
|
||||
if (!mWidget)
|
||||
return NS_OK; // Will be null durring printing
|
||||
@ -279,7 +282,7 @@ NS_METHOD nsWidget::Show(PRBool bState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::SetModal(void)
|
||||
NS_IMETHODIMP nsWidget::SetModal(void)
|
||||
{
|
||||
GtkWindow *toplevel;
|
||||
|
||||
@ -297,18 +300,31 @@ NS_METHOD nsWidget::SetModal(void)
|
||||
// grab mouse events for this widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWidget::CaptureMouse(PRBool aCapture)
|
||||
NS_IMETHODIMP nsWidget::CaptureMouse(PRBool aCapture)
|
||||
{
|
||||
if (aCapture)
|
||||
{
|
||||
mGrabTime = gdk_time_get();
|
||||
|
||||
GdkCursor *cursor = gdk_cursor_new (GDK_ARROW);
|
||||
gdk_pointer_grab (mWidget->window, TRUE,
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
|
||||
GDK_POINTER_MOTION_MASK,
|
||||
NULL, cursor, mGrabTime);
|
||||
gtk_grab_add(mWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_pointer_ungrab(mGrabTime);
|
||||
gtk_grab_remove(mWidget);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD nsWidget::IsVisible(PRBool &aState)
|
||||
NS_IMETHODIMP nsWidget::IsVisible(PRBool &aState)
|
||||
{
|
||||
if (mWidget) {
|
||||
aState = GTK_WIDGET_VISIBLE(mWidget);
|
||||
@ -325,7 +341,7 @@ NS_METHOD nsWidget::IsVisible(PRBool &aState)
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsWidget::Move(PRInt32 aX, PRInt32 aY)
|
||||
NS_IMETHODIMP nsWidget::Move(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
if (mWidget)
|
||||
{
|
||||
@ -371,7 +387,7 @@ NS_METHOD nsWidget::Move(PRInt32 aX, PRInt32 aY)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
|
||||
NS_IMETHODIMP nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
|
||||
{
|
||||
#if 0
|
||||
printf("nsWidget::Resize %s (%p) to %d %d\n",
|
||||
@ -392,7 +408,7 @@ NS_METHOD nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
|
||||
NS_IMETHODIMP nsWidget::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
|
||||
PRInt32 aHeight, PRBool aRepaint)
|
||||
{
|
||||
Resize(aWidth,aHeight,aRepaint);
|
||||
@ -458,7 +474,7 @@ PRBool nsWidget::OnMove(PRInt32 aX, PRInt32 aY)
|
||||
// Enable/disable this component
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWidget::Enable(PRBool bState)
|
||||
NS_IMETHODIMP nsWidget::Enable(PRBool bState)
|
||||
{
|
||||
if (mWidget) {
|
||||
::gtk_widget_set_sensitive(mWidget, bState);
|
||||
@ -471,7 +487,7 @@ NS_METHOD nsWidget::Enable(PRBool bState)
|
||||
// Give the focus to this component
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWidget::SetFocus(void)
|
||||
NS_IMETHODIMP nsWidget::SetFocus(void)
|
||||
{
|
||||
if (mWidget) {
|
||||
::gtk_widget_grab_focus(mWidget);
|
||||
@ -479,7 +495,7 @@ NS_METHOD nsWidget::SetFocus(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::GetBounds(nsRect &aRect)
|
||||
NS_IMETHODIMP nsWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
aRect = mBounds;
|
||||
return NS_OK;
|
||||
@ -501,7 +517,7 @@ nsIFontMetrics *nsWidget::GetFont(void)
|
||||
// Set this component font
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWidget::SetFont(const nsFont &aFont)
|
||||
NS_IMETHODIMP nsWidget::SetFont(const nsFont &aFont)
|
||||
{
|
||||
nsIFontMetrics* mFontMetrics;
|
||||
mContext->GetMetricsFor(aFont, mFontMetrics);
|
||||
@ -530,7 +546,7 @@ NS_METHOD nsWidget::SetFont(const nsFont &aFont)
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsWidget::SetBackgroundColor(const nscolor &aColor)
|
||||
NS_IMETHODIMP nsWidget::SetBackgroundColor(const nscolor &aColor)
|
||||
{
|
||||
nsBaseWidget::SetBackgroundColor(aColor);
|
||||
|
||||
@ -568,7 +584,7 @@ NS_METHOD nsWidget::SetBackgroundColor(const nscolor &aColor)
|
||||
// Set this component cursor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWidget::SetCursor(nsCursor aCursor)
|
||||
NS_IMETHODIMP nsWidget::SetCursor(nsCursor aCursor)
|
||||
{
|
||||
if (!mWidget || !mWidget->window)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -633,7 +649,7 @@ NS_METHOD nsWidget::SetCursor(nsCursor aCursor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous)
|
||||
NS_IMETHODIMP nsWidget::Invalidate(PRBool aIsSynchronous)
|
||||
{
|
||||
if (mWidget == nsnull) {
|
||||
return NS_OK; // mWidget will be null during printing.
|
||||
@ -658,7 +674,7 @@ NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
||||
NS_IMETHODIMP nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
||||
{
|
||||
if (mWidget == nsnull) {
|
||||
return NS_OK; // mWidget is null during printing
|
||||
@ -687,7 +703,7 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::Update(void)
|
||||
NS_IMETHODIMP nsWidget::Update(void)
|
||||
{
|
||||
if (! mWidget)
|
||||
return NS_OK;
|
||||
@ -783,49 +799,49 @@ void nsWidget::ReleaseNativeData(PRUint32 aDataType)
|
||||
// Set the colormap of the window
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWidget::SetColorMap(nsColorMap *aColorMap)
|
||||
NS_IMETHODIMP nsWidget::SetColorMap(nsColorMap *aColorMap)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
|
||||
NS_IMETHODIMP nsWidget::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsWidget::Scroll");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::BeginResizingChildren(void)
|
||||
NS_IMETHODIMP nsWidget::BeginResizingChildren(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::EndResizingChildren(void)
|
||||
NS_IMETHODIMP nsWidget::EndResizingChildren(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
|
||||
NS_IMETHODIMP nsWidget::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
|
||||
{
|
||||
aWidth = mPreferredWidth;
|
||||
aHeight = mPreferredHeight;
|
||||
return (mPreferredWidth != 0 && mPreferredHeight != 0)?NS_OK:NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
|
||||
NS_IMETHODIMP nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
mPreferredWidth = aWidth;
|
||||
mPreferredHeight = aHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::SetMenuBar(nsIMenuBar * aMenuBar)
|
||||
NS_IMETHODIMP nsWidget::SetMenuBar(nsIMenuBar * aMenuBar)
|
||||
{
|
||||
g_print("bleh\n");
|
||||
NS_NOTYETIMPLEMENTED("nsWidget::SetMenuBar");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsWidget::ShowMenuBar(PRBool aShow)
|
||||
NS_IMETHODIMP nsWidget::ShowMenuBar(PRBool aShow)
|
||||
{
|
||||
g_print("bleh\n");
|
||||
NS_NOTYETIMPLEMENTED("nsWidget::ShowMenuBar");
|
||||
@ -951,7 +967,7 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsWidget::Create(nsIWidget *aParent,
|
||||
NS_IMETHODIMP nsWidget::Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
@ -969,7 +985,7 @@ NS_METHOD nsWidget::Create(nsIWidget *aParent,
|
||||
// create with a native parent
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWidget::Create(nsNativeWidget aParent,
|
||||
NS_IMETHODIMP nsWidget::Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
|
@ -60,122 +60,122 @@ class nsIToolkit;
|
||||
|
||||
class nsWidget : public nsBaseWidget
|
||||
{
|
||||
public:
|
||||
nsWidget();
|
||||
virtual ~nsWidget();
|
||||
public:
|
||||
nsWidget();
|
||||
virtual ~nsWidget();
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
NS_IMETHOD Destroy(void);
|
||||
nsIWidget* GetParent(void);
|
||||
NS_IMETHOD Destroy(void);
|
||||
nsIWidget* GetParent(void);
|
||||
|
||||
NS_IMETHOD SetModal(void);
|
||||
NS_IMETHOD Show(PRBool state);
|
||||
NS_IMETHOD IsVisible(PRBool &aState);
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
||||
NS_IMETHOD SetModal(void);
|
||||
NS_IMETHOD Show(PRBool state);
|
||||
NS_IMETHOD IsVisible(PRBool &aState);
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
||||
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
|
||||
PRInt32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
|
||||
PRInt32 aHeight, PRBool aRepaint);
|
||||
|
||||
NS_IMETHOD Enable(PRBool aState);
|
||||
NS_IMETHOD SetFocus(void);
|
||||
NS_IMETHOD Enable(PRBool aState);
|
||||
NS_IMETHOD SetFocus(void);
|
||||
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
PRBool OnResize(nsSizeEvent event);
|
||||
virtual PRBool OnResize(nsRect &aRect);
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
PRBool OnResize(nsSizeEvent event);
|
||||
virtual PRBool OnResize(nsRect &aRect);
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
|
||||
nsIFontMetrics *GetFont(void);
|
||||
NS_IMETHOD SetFont(const nsFont &aFont);
|
||||
nsIFontMetrics *GetFont(void);
|
||||
NS_IMETHOD SetFont(const nsFont &aFont);
|
||||
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
||||
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
||||
|
||||
void* GetNativeData(PRUint32 aDataType);
|
||||
void* GetNativeData(PRUint32 aDataType);
|
||||
#ifdef NS_GTK_REF
|
||||
void ReleaseNativeData(PRUint32 aDataType);
|
||||
void ReleaseNativeData(PRUint32 aDataType);
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHOD GetAbsoluteBounds(nsRect &aRect);
|
||||
NS_IMETHOD WidgetToScreen(const nsRect &aOldRect, nsRect &aNewRect);
|
||||
NS_IMETHOD ScreenToWidget(const nsRect &aOldRect, nsRect &aNewRect);
|
||||
NS_IMETHOD GetAbsoluteBounds(nsRect &aRect);
|
||||
NS_IMETHOD WidgetToScreen(const nsRect &aOldRect, nsRect &aNewRect);
|
||||
NS_IMETHOD ScreenToWidget(const nsRect &aOldRect, nsRect &aNewRect);
|
||||
|
||||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY);
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY);
|
||||
|
||||
// the following are nsWindow specific, and just stubbed here
|
||||
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar *aMenuBar);
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow);
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar *aMenuBar);
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow);
|
||||
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update(void);
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update(void);
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
||||
|
||||
void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull);
|
||||
void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull);
|
||||
|
||||
// Utility functions
|
||||
|
||||
PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
PRBool DispatchMouseEvent(nsMouseEvent& aEvent);
|
||||
PRBool DispatchStandardEvent(PRUint32 aMsg);
|
||||
PRBool DispatchFocus(nsGUIEvent &aEvent);
|
||||
PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
PRBool DispatchMouseEvent(nsMouseEvent& aEvent);
|
||||
PRBool DispatchStandardEvent(PRUint32 aMsg);
|
||||
PRBool DispatchFocus(nsGUIEvent &aEvent);
|
||||
|
||||
// are we a "top level" widget?
|
||||
PRBool mIsToplevel;
|
||||
PRBool mIsToplevel;
|
||||
|
||||
#ifdef DEBUG
|
||||
void IndentByDepth(FILE* out);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
virtual void OnDestroy();
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
virtual void OnDestroy();
|
||||
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow) { return NS_OK; }
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow) { return NS_OK; }
|
||||
|
||||
nsresult CreateWidget(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData,
|
||||
nsNativeWidget aNativeParent = nsnull);
|
||||
nsresult CreateWidget(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData,
|
||||
nsNativeWidget aNativeParent = nsnull);
|
||||
|
||||
|
||||
PRBool DispatchWindowEvent(nsGUIEvent* event);
|
||||
PRBool DispatchWindowEvent(nsGUIEvent* event);
|
||||
|
||||
// Return the Gdk window whose background should change
|
||||
virtual GdkWindow * GetWindowForSetBackground();
|
||||
virtual GdkWindow *GetWindowForSetBackground();
|
||||
|
||||
// Sets font for widgets
|
||||
virtual void SetFontNative(GdkFont *aFont);
|
||||
@ -340,16 +340,17 @@ protected:
|
||||
GtkWidget * aGtkWidget);
|
||||
#endif
|
||||
|
||||
GtkWidget *mWidget;
|
||||
nsIWidget *mParent;
|
||||
guint32 mGrabTime;
|
||||
GtkWidget *mWidget;
|
||||
nsIWidget *mParent;
|
||||
|
||||
// This is the composite update area (union of all the calls to
|
||||
// Invalidate)
|
||||
nsRect mUpdateArea;
|
||||
// This is the composite update area (union of all the calls to
|
||||
// Invalidate)
|
||||
nsRect mUpdateArea;
|
||||
|
||||
PRBool mShown;
|
||||
PRBool mShown;
|
||||
|
||||
PRUint32 mPreferredWidth, mPreferredHeight;
|
||||
PRUint32 mPreferredWidth, mPreferredHeight;
|
||||
private:
|
||||
PRBool mIsDragDest;
|
||||
static nsILookAndFeel *sLookAndFeel;
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsWindow constructor
|
||||
@ -599,7 +598,6 @@ NS_METHOD nsWindow::Show(PRBool bState)
|
||||
#endif
|
||||
|
||||
gtk_widget_show(mShell);
|
||||
|
||||
}
|
||||
}
|
||||
// hide
|
||||
@ -871,6 +869,9 @@ nsWindow::OnRealize()
|
||||
// we were just realized, so we better have a window, but we will make sure...
|
||||
if (mShell->window)
|
||||
{
|
||||
// XXX bug 8002
|
||||
// gdk_window_raise(mShell->window);
|
||||
|
||||
gint wmd = ConvertBorderStyles(mBorderStyle);
|
||||
if (wmd != -1)
|
||||
gdk_window_set_decorations(mShell->window, (GdkWMDecoration)wmd);
|
||||
|
@ -15,8 +15,8 @@
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef Window_h__
|
||||
#define Window_h__
|
||||
#ifndef nsWindow_h__
|
||||
#define nsWindow_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
@ -27,10 +27,6 @@
|
||||
class nsFont;
|
||||
class nsIAppShell;
|
||||
|
||||
#define NSRGB_2_COLOREF(color) \
|
||||
RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color))
|
||||
|
||||
|
||||
/**
|
||||
* Native GTK++ window wrapper.
|
||||
*/
|
||||
@ -41,58 +37,58 @@ class nsWindow : public nsWidget
|
||||
public:
|
||||
// nsIWidget interface
|
||||
|
||||
nsWindow();
|
||||
virtual ~nsWindow();
|
||||
nsWindow();
|
||||
virtual ~nsWindow();
|
||||
|
||||
NS_IMETHOD WidgetToScreen(const nsRect &aOldRect, nsRect &aNewRect);
|
||||
NS_IMETHOD ScreenToWidget(const nsRect &aOldRect, nsRect &aNewRect);
|
||||
NS_IMETHOD WidgetToScreen(const nsRect &aOldRect, nsRect &aNewRect);
|
||||
NS_IMETHOD ScreenToWidget(const nsRect &aOldRect, nsRect &aNewRect);
|
||||
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY);
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY);
|
||||
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aWidgetInitData);
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aWidgetInitData);
|
||||
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
|
||||
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle);
|
||||
nsresult SetIcon(GdkPixmap *window_pixmap,
|
||||
GdkBitmap *window_mask);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
|
||||
NS_IMETHOD Show(PRBool aShow);
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow);
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle);
|
||||
nsresult SetIcon(GdkPixmap *window_pixmap,
|
||||
GdkBitmap *window_mask);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
|
||||
NS_IMETHOD Show(PRBool aShow);
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow);
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
||||
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
|
||||
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
|
||||
PRInt32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
|
||||
PRInt32 aHeight, PRBool aRepaint);
|
||||
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
|
||||
|
||||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
NS_IMETHOD Destroy(void);
|
||||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
NS_IMETHOD Destroy(void);
|
||||
|
||||
gint ConvertBorderStyles(nsBorderStyle bs);
|
||||
gint ConvertBorderStyles(nsBorderStyle bs);
|
||||
|
||||
virtual PRBool IsChild() const;
|
||||
virtual PRBool IsChild() const;
|
||||
|
||||
void SetIsDestroying(PRBool val) {
|
||||
mIsDestroyingWindow = val;
|
||||
}
|
||||
void SetIsDestroying(PRBool val) {
|
||||
mIsDestroyingWindow = val;
|
||||
}
|
||||
|
||||
PRBool IsDestroying() const {
|
||||
return mIsDestroyingWindow;
|
||||
}
|
||||
PRBool IsDestroying() const {
|
||||
return mIsDestroyingWindow;
|
||||
}
|
||||
|
||||
// Utility methods
|
||||
virtual PRBool OnPaint(nsPaintEvent &event);
|
||||
PRBool OnKey(nsKeyEvent &aEvent);
|
||||
virtual PRBool OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos);
|
||||
// Utility methods
|
||||
virtual PRBool OnPaint(nsPaintEvent &event);
|
||||
PRBool OnKey(nsKeyEvent &aEvent);
|
||||
virtual PRBool OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos);
|
||||
// in nsWidget now
|
||||
// virtual PRBool OnResize(nsSizeEvent &aEvent);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user