This commit is contained in:
pavlov%pavlov.net 1999-02-03 19:18:31 +00:00
Родитель 4cadf5bcd7
Коммит a1f741849e
8 изменённых файлов: 50 добавлений и 62 удалений

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

@ -117,23 +117,23 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
aMetric = req.height;
}
break;
case eMetric_ButtonHorizontalInsidePaddingNavQuirks:
aMetric = 10;
break;
case eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks:
aMetric = 8;
break;
case eMetric_TextHorizontalInsideMinimumPadding:
aMetric = 3;
break;
case eMetric_TextVerticalInsidePadding:
aMetric = 0;
break;
case eMetric_TextShouldUseVerticalInsidePadding:
aMetric = 0;
break;
case eMetric_TextHorizontalInsideMinimumPadding:
aMetric = 3;
break;
case eMetric_TextShouldUseHorizontalInsideMinimumPadding:
aMetric = 1;
aMetric = 0;
break;
case eMetric_ButtonHorizontalInsidePaddingNavQuirks:
aMetric = 10;
break;
case eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks:
aMetric = 8;
break;
case eMetric_ListShouldUseHorizontalInsideMinimumPadding:
aMetric = 0;

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

@ -55,25 +55,10 @@ nsMenu::~nsMenu()
NS_IF_RELEASE(mMenuParent);
}
//-------------------------------------------------------------------------
GtkWidget *nsMenu::GetNativeParent()
{
void * voidData;
if (nsnull != mMenuParent) {
mMenuParent->GetNativeData(voidData);
} else if (nsnull != mMenuBarParent) {
mMenuBarParent->GetNativeData(voidData);
} else {
return nsnull;
}
return GTK_WIDGET(voidData);
}
//-------------------------------------------------------------------------
//
// Create the proper widget
//
// add menu to menubar
//-------------------------------------------------------------------------
NS_METHOD nsMenu::Create(nsIMenuBar *aParent, const nsString &aLabel)
{
@ -87,6 +72,7 @@ NS_METHOD nsMenu::Create(nsIMenuBar *aParent, const nsString &aLabel)
return NS_OK;
}
//add submenu
//-------------------------------------------------------------------------
NS_METHOD nsMenu::Create(nsIMenu *aParent, const nsString &aLabel)
{
@ -123,6 +109,9 @@ NS_METHOD nsMenu::GetLabel(nsString &aText)
//-------------------------------------------------------------------------
NS_METHOD nsMenu::SetLabel(nsString &aText)
{
/* we Do GetLabel() when we are adding the menu...
* but we might want to redo this.
*/
mLabel = aText;
return NS_OK;
}
@ -161,7 +150,7 @@ NS_METHOD nsMenu::AddMenuItem(nsIMenuItem * aMenuItem)
NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu)
{
nsString Label;
GtkWidget *item=nsnull, *parentmenu=nsnull, *newmenu=nsnull;
GtkWidget *item=nsnull, *newmenu=nsnull;
char *labelStr;
void *voidData=NULL;
@ -169,12 +158,9 @@ NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu)
labelStr = Label.ToNewCString();
GetNativeData(voidData);
parentmenu = GTK_WIDGET(voidData);
item = gtk_menu_item_new_with_label (labelStr);
gtk_widget_show(item);
gtk_menu_shell_append (GTK_MENU_SHELL (parentmenu), item);
gtk_menu_shell_append (GTK_MENU_SHELL (mMenu), item);
delete[] labelStr;
@ -185,7 +171,6 @@ NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), newmenu);
// XXX add aMenu to internal data structor list
return NS_OK;
}
@ -249,3 +234,17 @@ NS_METHOD nsMenu::GetNativeData(void *& aData)
return NS_OK;
}
GtkWidget *nsMenu::GetNativeParent()
{
void * voidData;
if (nsnull != mMenuParent) {
mMenuParent->GetNativeData(voidData);
} else if (nsnull != mMenuBarParent) {
mMenuBarParent->GetNativeData(voidData);
} else {
return nsnull;
}
return GTK_WIDGET(voidData);
}

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

@ -47,7 +47,7 @@ nsMenuBar::nsMenuBar() : nsIMenuBar(), nsIMenuListener()
{
NS_INIT_REFCNT();
mNumMenus = 0;
mMenu = nsnull;
mMenuBar = nsnull;
mParent = nsnull;
mIsMenuBarAdded = PR_FALSE;
}
@ -70,16 +70,10 @@ nsMenuBar::~nsMenuBar()
NS_METHOD nsMenuBar::Create(nsIWidget *aParent)
{
mParent = aParent;
NS_ADDREF(mParent);
GtkWidget *parentWidget = GTK_WIDGET(mParent->GetNativeData(NS_NATIVE_WIDGET));
#if 0
GtkWidget *mainWindow = XtParent(parentWidget);
#endif
mMenu = gtk_menu_bar_new();
NS_IF_ADDREF(mParent);
mMenuBar = gtk_menu_bar_new();
mParent->SetMenuBar(this);
gtk_widget_show(mMenu);
// does this need to be added?
// gtk_layout_put(GTK_LAYOUT(parentWidget), mMenu, 0, 0);
gtk_widget_show(mMenuBar);
return NS_OK;
}
@ -87,8 +81,8 @@ NS_METHOD nsMenuBar::Create(nsIWidget *aParent)
//-------------------------------------------------------------------------
NS_METHOD nsMenuBar::GetParent(nsIWidget *&aParent)
{
// XXX: Shouldn't this do an addref here? or is this just internal
aParent = mParent;
NS_IF_ADDREF(aParent);
return NS_OK;
}
@ -106,7 +100,7 @@ NS_METHOD nsMenuBar::AddMenu(nsIMenu * aMenu)
widget = gtk_menu_item_new_with_label (labelStr);
gtk_widget_show(widget);
gtk_menu_bar_append (GTK_MENU_BAR (mMenu), widget);
gtk_menu_bar_append (GTK_MENU_BAR (mMenuBar), widget);
delete[] labelStr;
@ -115,7 +109,6 @@ NS_METHOD nsMenuBar::AddMenu(nsIMenu * aMenu)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget), nmenu);
// XXX add aMenu to internal data structor list
return NS_OK;
}
@ -152,7 +145,7 @@ NS_METHOD nsMenuBar::RemoveAll()
//-------------------------------------------------------------------------
NS_METHOD nsMenuBar::GetNativeData(void *& aData)
{
aData = (void *)mMenu;
aData = (void *)mMenuBar;
return NS_OK;
}

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

@ -56,7 +56,7 @@ public:
NS_IMETHOD Paint();
protected:
PRUint32 mNumMenus;
GtkWidget *mMenu;
GtkWidget *mMenuBar;
nsIWidget *mParent;
PRBool mIsMenuBarAdded;
};

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

@ -44,7 +44,7 @@ NS_IMPL_ISUPPORTS(nsMenuItem, kIMenuItemIID)
nsMenuItem::nsMenuItem() : nsIMenuItem()
{
NS_INIT_REFCNT();
mMenu = nsnull;
mMenuItem = nsnull;
mMenuParent = nsnull;
mPopUpParent = nsnull;
mTarget = nsnull;
@ -78,17 +78,12 @@ void nsMenuItem::Create(nsIWidget *aMBParent,
mTarget = aMBParent;
char * nameStr = mLabel.ToNewCString();
// GtkWidget *parentMenuHandle = GetNativeParent();
mMenu = gtk_menu_item_new_with_label(nameStr);
gtk_widget_show(mMenu);
/*
XtVaCreateManagedWidget(nameStr, xmCascadeButtonGadgetClass,
parentMenuHandle,
NULL);
XtAddCallback(mMenu, XmNactivateCallback, nsXtWidget_Menu_Callback,
(nsIMenuItem *)this);
*/
gtk_signal_connect (GTK_OBJECT (mMenu), "activate", GTK_SIGNAL_FUNC(nsGtkWidget_Menu_Callback) , this);
mMenuItem = gtk_menu_item_new_with_label(nameStr);
gtk_widget_show(mMenuItem);
gtk_signal_connect (GTK_OBJECT (mMenuItem), "activate",
GTK_SIGNAL_FUNC(nsGtkWidget_Menu_Callback),
this);
delete[] nameStr;
}
@ -227,7 +222,7 @@ NS_METHOD nsMenuItem::GetTarget(nsIWidget *& aTarget)
//-------------------------------------------------------------------------
NS_METHOD nsMenuItem::GetNativeData(void *& aData)
{
aData = (void *)mMenu;
aData = (void *)mMenuItem;
return NS_OK;
}

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

@ -67,7 +67,7 @@ protected:
nsIPopUpMenu *mPopUpParent;
nsIWidget *mTarget;
GtkWidget *mMenu; // native cascade widget
GtkWidget *mMenuItem; // native cascade widget
};

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

@ -525,6 +525,7 @@ NS_METHOD nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
NS_METHOD nsWidget::SetMenuBar(nsIMenuBar * aMenuBar)
{
g_print("bleh\n");
NS_NOTYETIMPLEMENTED("nsWidget::SetMenuBar");
return NS_OK;
}

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

@ -410,7 +410,7 @@ NS_METHOD nsWindow::SetMenuBar(nsIMenuBar * aMenuBar)
{
GtkWidget *menubar;
void *voidData;
g_print("blah\n");
aMenuBar->GetNativeData(voidData);
menubar = GTK_WIDGET(voidData);