зеркало из https://github.com/mozilla/gecko-dev.git
Bug 269410 - Create a new attribute, "toggletoolbar", which can be used to control whether the toolbar pill collapse button is shown on the window. r=Neil, r=josh, sr=roc
If the attribute is not specified, the button is hidden by default.
This commit is contained in:
Родитель
dbc27ab8fe
Коммит
0fba0e03b4
|
@ -102,10 +102,10 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
|
|||
#define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
|
||||
#endif
|
||||
|
||||
// {5FF2CD19-4F73-4935-8EA2-7A2C33166D4C}
|
||||
// {A16A3387-A529-439C-A127-A5893351FD24}
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x5FF2CD19, 0x4F73, 0x4935, \
|
||||
{ 0x8E, 0xA2, 0x7A, 0x2C, 0x33, 0x16, 0x6D, 0x4C } }
|
||||
{ 0xA16A3387, 0xA529, 0x439C, \
|
||||
{ 0xA1, 0x27, 0xA5, 0x89, 0x33, 0x51, 0xFD, 0x24 } }
|
||||
|
||||
/*
|
||||
* Window shadow styles
|
||||
|
@ -644,6 +644,14 @@ class nsIWidget : public nsISupports {
|
|||
*/
|
||||
NS_IMETHOD SetWindowShadowStyle(PRInt32 aStyle) = 0;
|
||||
|
||||
/*
|
||||
* On Mac OS X, this method shows or hides the pill button in the titlebar
|
||||
* that's used to collapse the toolbar.
|
||||
*
|
||||
* Ignored on child widgets and on non-Mac platforms.
|
||||
*/
|
||||
virtual void SetShowsToolbarButton(PRBool aShow) = 0;
|
||||
|
||||
/**
|
||||
* Hide window chrome (borders, buttons) for this widget.
|
||||
*
|
||||
|
|
|
@ -235,6 +235,7 @@ public:
|
|||
virtual nsTransparencyMode GetTransparencyMode();
|
||||
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
||||
NS_IMETHOD SetWindowShadowStyle(PRInt32 aStyle);
|
||||
virtual void SetShowsToolbarButton(PRBool aShow);
|
||||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive);
|
||||
|
||||
// dispatch an NS_SIZEMODE event on miniaturize or deminiaturize
|
||||
|
|
|
@ -1424,6 +1424,15 @@ NS_IMETHODIMP nsCocoaWindow::SetWindowShadowStyle(PRInt32 aStyle)
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
void nsCocoaWindow::SetShowsToolbarButton(PRBool aShow)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
[mWindow setShowsToolbarButton:aShow];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::SetWindowTitlebarColor(nscolor aColor, PRBool aActive)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
@ -1904,7 +1913,8 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut)
|
|||
return frameRect.size.height - [self contentRectForFrameRect:frameRect].size.height;
|
||||
}
|
||||
|
||||
// Always show the toolbar pill button.
|
||||
// Returning YES here makes the setShowsToolbarButton method work even though
|
||||
// the window doesn't contain an NSToolbar.
|
||||
- (BOOL)_hasToolbar
|
||||
{
|
||||
return YES;
|
||||
|
|
|
@ -107,6 +107,7 @@ public:
|
|||
virtual nsTransparencyMode GetTransparencyMode();
|
||||
virtual void GetWindowClipRegion(nsTArray<nsIntRect>* aRects);
|
||||
NS_IMETHOD SetWindowShadowStyle(PRInt32 aStyle);
|
||||
virtual void SetShowsToolbarButton(PRBool aShow) {}
|
||||
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
|
||||
NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
|
||||
virtual nsIRenderingContext* GetRenderingContext();
|
||||
|
|
|
@ -994,6 +994,7 @@ void nsXULWindow::OnChromeLoaded()
|
|||
if (positionSet)
|
||||
positionSet = LoadPositionFromXUL();
|
||||
LoadMiscPersistentAttributesFromXUL();
|
||||
LoadToolbarButtonPresenceFromXUL();
|
||||
|
||||
//LoadContentAreas();
|
||||
|
||||
|
@ -1436,6 +1437,19 @@ NS_IMETHODIMP nsXULWindow::LoadIconFromXUL()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::LoadToolbarButtonPresenceFromXUL()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> windowElement;
|
||||
GetWindowDOMElement(getter_AddRefs(windowElement));
|
||||
NS_ENSURE_TRUE(windowElement, NS_ERROR_FAILURE);
|
||||
nsAutoString attr;
|
||||
nsresult rv = windowElement->GetAttribute(NS_LITERAL_STRING("toggletoolbar"), attr);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mWindow->SetShowsToolbarButton(attr.LowerCaseEqualsLiteral("true"));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::SavePersistentAttributes()
|
||||
{
|
||||
// can happen when the persistence timer fires at an inopportune time
|
||||
|
|
|
@ -122,6 +122,7 @@ protected:
|
|||
nsresult LoadChromeHidingFromXUL();
|
||||
NS_IMETHOD LoadWindowClassFromXUL();
|
||||
NS_IMETHOD LoadIconFromXUL();
|
||||
NS_IMETHOD LoadToolbarButtonPresenceFromXUL();
|
||||
NS_IMETHOD SavePersistentAttributes();
|
||||
|
||||
NS_IMETHOD GetWindowDOMWindow(nsIDOMWindowInternal** aDOMWindow);
|
||||
|
|
Загрузка…
Ссылка в новой задаче