remove my last commit. these caused more bugs than they were intended to

catch
This commit is contained in:
pavlov%pavlov.net 1998-11-25 12:51:53 +00:00
Родитель 8dc8b7f46a
Коммит 2eefc27dbf
5 изменённых файлов: 8 добавлений и 69 удалений

Просмотреть файл

@ -92,8 +92,6 @@ nsresult nsButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
//-------------------------------------------------------------------------
NS_METHOD nsButton::SetLabel(const nsString& aText)
{
g_return_val_if_fail(GTK_IS_BUTTON(mWidget), NS_ERROR_FAILURE);
NS_ALLOC_STR_BUF(label, aText, 256);
gtk_label_set(GTK_LABEL(GTK_BIN (mWidget)->child), label);
@ -109,9 +107,6 @@ NS_METHOD nsButton::SetLabel(const nsString& aText)
//-------------------------------------------------------------------------
NS_METHOD nsButton::GetLabel(nsString& aBuffer)
{
g_return_val_if_fail(GTK_IS_BUTTON(mWidget), NS_ERROR_FAILURE);
g_return_val_if_fail(GTK_IS_LABEL(GTK_BIN (mWidget)->child), NS_ERROR_FAILURE);
char * text;
gtk_label_get(GTK_LABEL(GTK_BIN (mWidget)->child), &text);

Просмотреть файл

@ -83,8 +83,6 @@ NS_METHOD nsComboBox::SetMultipleSelection(PRBool aMultipleSelections)
NS_METHOD nsComboBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
{
g_return_val_if_fail(GTK_IS_COMBO(mWidget), NS_ERROR_FAILURE);
NS_ALLOC_STR_BUF(val, aItem, 256);
mItems = g_list_insert( mItems, g_strdup(val), aPosition );
gtk_combo_set_popdown_strings( GTK_COMBO( mWidget ), mItems );
@ -100,8 +98,6 @@ NS_METHOD nsComboBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
//-------------------------------------------------------------------------
PRInt32 nsComboBox::FindItem(nsString &aItem, PRInt32 aStartPos)
{
g_return_val_if_fail(GTK_IS_COMBO(mWidget), NS_ERROR_FAILURE);
NS_ALLOC_STR_BUF(val, aItem, 256);
int i;
PRInt32 index = -1;
@ -135,8 +131,6 @@ PRInt32 nsComboBox::GetItemCount()
//-------------------------------------------------------------------------
PRBool nsComboBox::RemoveItemAt(PRInt32 aPosition)
{
g_return_val_if_fail(GTK_IS_COMBO(mWidget), NS_ERROR_FAILURE);
if (aPosition >= 0 && aPosition < mNumItems) {
g_free(g_list_nth(mItems, aPosition)->data);
@ -156,8 +150,6 @@ PRBool nsComboBox::RemoveItemAt(PRInt32 aPosition)
//-------------------------------------------------------------------------
PRBool nsComboBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
{
g_return_val_if_fail(GTK_IS_COMBO(mWidget), NS_ERROR_FAILURE);
PRBool result = PR_FALSE;
if (aPosition >= 0 && aPosition < mNumItems) {
anItem = (gchar *) g_list_nth(mItems, aPosition)->data;
@ -174,8 +166,6 @@ PRBool nsComboBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
//-------------------------------------------------------------------------
NS_METHOD nsComboBox::GetSelectedItem(nsString& aItem)
{
g_return_val_if_fail(GTK_IS_COMBO(mWidget), NS_ERROR_FAILURE);
aItem = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(mWidget)->entry));
return NS_OK;
}
@ -199,8 +189,6 @@ PRInt32 nsComboBox::GetSelectedIndex()
//-------------------------------------------------------------------------
NS_METHOD nsComboBox::SelectItem(PRInt32 aPosition)
{
g_return_val_if_fail(GTK_IS_COMBO(mWidget), NS_ERROR_FAILURE);
GList *pos;
if (!mItems)
return NS_ERROR_FAILURE;

Просмотреть файл

@ -85,8 +85,6 @@ nsresult nsListBox::QueryInterface(const nsIID& aIID, void** aInstancePtr)
NS_METHOD nsListBox::SetMultipleSelection(PRBool aMultipleSelections)
{
g_return_val_if_fail(GTK_IS_CLIST(mCList), NS_ERROR_FAILURE);
mMultiSelect = aMultipleSelections;
if (mMultiSelect)
@ -125,8 +123,6 @@ NS_METHOD nsListBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
//-------------------------------------------------------------------------
PRInt32 nsListBox::FindItem(nsString &aItem, PRInt32 aStartPos)
{
g_return_val_if_fail(GTK_IS_CLIST(mCList), NS_ERROR_FAILURE);
int index = gtk_clist_find_row_from_data(GTK_CLIST(mCList), aItem);
if (index < aStartPos) {
@ -143,8 +139,6 @@ PRInt32 nsListBox::FindItem(nsString &aItem, PRInt32 aStartPos)
//-------------------------------------------------------------------------
PRInt32 nsListBox::GetItemCount()
{
g_return_val_if_fail(GTK_IS_CLIST(mCList), NS_ERROR_FAILURE);
return GTK_CLIST(mCList)->rows;
}
@ -155,8 +149,6 @@ PRInt32 nsListBox::GetItemCount()
//-------------------------------------------------------------------------
PRBool nsListBox::RemoveItemAt(PRInt32 aPosition)
{
g_return_val_if_fail(GTK_IS_CLIST(mCList), NS_ERROR_FAILURE);
gtk_clist_remove(GTK_CLIST(mCList), aPosition);
/*
int count = 0;
@ -177,8 +169,6 @@ PRBool nsListBox::RemoveItemAt(PRInt32 aPosition)
//-------------------------------------------------------------------------
PRBool nsListBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
{
g_return_val_if_fail(GTK_IS_CLIST(mCList), NS_ERROR_FAILURE);
PRBool result = PR_FALSE;
char *text = NULL;
@ -261,8 +251,6 @@ PRInt32 nsListBox::GetSelectedIndex()
//-------------------------------------------------------------------------
NS_METHOD nsListBox::SelectItem(PRInt32 aPosition)
{
g_return_val_if_fail(GTK_IS_CLIST(mCList), NS_ERROR_FAILURE);
gtk_clist_select_row(GTK_CLIST(mCList), aPosition, 0);
/*
int count = 0;
@ -281,8 +269,6 @@ NS_METHOD nsListBox::SelectItem(PRInt32 aPosition)
//-------------------------------------------------------------------------
PRInt32 nsListBox::GetSelectedCount()
{
g_return_val_if_fail(GTK_IS_CLIST(mCList), NS_ERROR_FAILURE);
return (PRInt32)g_list_length(GTK_CLIST(mCList)->selection);
}

Просмотреть файл

@ -140,10 +140,6 @@ NS_METHOD nsWidget::Move(PRUint32 aX, PRUint32 aY)
#endif
mBounds.x = aX;
mBounds.y = aY;
g_return_val_if_fail(GTK_IS_WIDGET(mWidget), NS_ERROR_FAILURE);
g_return_val_if_fail(GTK_IS_LAYOUT(mWidget->parent), NS_ERROR_FAILURE);
gtk_layout_move(GTK_LAYOUT(mWidget->parent), mWidget, aX, aY);
//XtVaSetValues(mWidget, XmNx, aX, XmNy, GetYCoord(aY), nsnull);
return NS_OK;
@ -156,9 +152,6 @@ NS_METHOD nsWidget::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
#endif
mBounds.width = aWidth;
mBounds.height = aHeight;
g_return_val_if_fail(GTK_IS_WIDGET(mWidget), NS_ERROR_FAILURE);
gtk_widget_set_usize(mWidget, aWidth, aHeight);
return NS_OK;
}
@ -178,8 +171,6 @@ NS_METHOD nsWidget::Resize(PRUint32 aX, PRUint32 aY, PRUint32 aWidth,
//-------------------------------------------------------------------------
NS_METHOD nsWidget::Enable(PRBool bState)
{
g_return_val_if_fail(GTK_IS_WIDGET(mWidget), NS_ERROR_FAILURE);
gtk_widget_set_sensitive(mWidget, bState);
return NS_OK;
}
@ -191,8 +182,6 @@ NS_METHOD nsWidget::Enable(PRBool bState)
//-------------------------------------------------------------------------
NS_METHOD nsWidget::SetFocus(void)
{
g_return_val_if_fail(GTK_IS_WIDGET(mWidget), NS_ERROR_FAILURE);
gtk_widget_grab_focus(mWidget);
return NS_OK;
}
@ -221,8 +210,6 @@ nscolor nsWidget::GetForegroundColor(void)
//-------------------------------------------------------------------------
NS_METHOD nsWidget::SetForegroundColor(const nscolor &aColor)
{
g_return_val_if_fail(GTK_IS_WIDGET(mWidget), NS_ERROR_FAILURE);
GtkStyle *style;
GdkColor color;
mForeground = aColor;
@ -253,8 +240,6 @@ nscolor nsWidget::GetBackgroundColor(void)
//-------------------------------------------------------------------------
NS_METHOD nsWidget::SetBackgroundColor(const nscolor &aColor)
{
g_return_val_if_fail(GTK_IS_WIDGET(mWidget), NS_ERROR_FAILURE);
GtkStyle *style;
GdkColor color;
mBackground = aColor;
@ -312,12 +297,7 @@ NS_METHOD nsWidget::SetCursor(nsCursor aCursor)
{
if (!mWidget || !mWidget->window)
return NS_ERROR_FAILURE;
/*
g_return_val_if_fail(mWidget != NULL, NS_ERROR_FAILURE);
g_return_val_if_fail(GTK_IS_WIDGET(mWidget), NS_ERROR_FAILURE);
g_return_val_if_fail(mWidget->window != NULL, NS_ERROR_FAILURE);
*/
// Only change cursor if it's changing
if (aCursor != mCursor) {
GdkCursor *newCursor = 0;
@ -462,20 +442,16 @@ NS_METHOD nsWidget::EndResizingChildren(void)
NS_METHOD nsWidget::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
{
g_return_val_if_fail(aWidth != 0 && aHeight != 0, NS_ERROR_FAILURE);
aWidth = mPreferredWidth;
aHeight = mPreferredHeight;
return NS_OK;
return (mPreferredWidth != 0 && mPreferredHeight != 0)?NS_OK:NS_ERROR_FAILURE;
}
NS_METHOD nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
{
g_return_val_if_fail(aWidth != 0 && aHeight != 0, NS_ERROR_FAILURE);
mPreferredWidth = aWidth;
mPreferredHeight = aHeight;
return NS_OK;
mPreferredWidth = aWidth;
mPreferredHeight = aHeight;
return NS_OK;
}
NS_METHOD nsWidget::SetMenuBar(nsIMenuBar * aMenuBar)
@ -524,13 +500,10 @@ nsresult nsWidget::StandardWindowCreate(nsIWidget *aParent,
if (parentWidget)
{
if (GTK_IS_LAYOUT(parentWidget))
{
gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, mBounds.x, mBounds.y);
gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, mBounds.x, mBounds.y);
#ifdef DBG
g_print("nsWidget::SWC(%3d,%3d) - %s %p\n", mBounds.x, mBounds.y, mWidget->name, this);
g_print("nsWidget::SWC(%3d,%3d) - %s %p\n", mBounds.x, mBounds.y, mWidget->name, this);
#endif
}
}
InitCallbacks();

Просмотреть файл

@ -499,10 +499,7 @@ void *nsWindow::GetNativeData(PRUint32 aDataType)
{
switch(aDataType) {
case NS_NATIVE_WINDOW:
if (GTK_IS_LAYOUT(mWidget))
return (void *)GTK_LAYOUT(mWidget)->bin_window;
else
return (void *)mWidget->window;
return (void *)GTK_LAYOUT(mWidget)->bin_window;
case NS_NATIVE_DISPLAY:
return (void *)GDK_DISPLAY();
case NS_NATIVE_WIDGET: