2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Mike Pinkerton (pinkerton@netscape.com).
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef nsNativeThemeCocoa_h_
|
|
|
|
#define nsNativeThemeCocoa_h_
|
|
|
|
|
|
|
|
#import <Carbon/Carbon.h>
|
2007-12-23 11:22:47 -08:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsNativeTheme.h"
|
2008-03-04 12:51:54 -08:00
|
|
|
#include "gfxASurface.h"
|
|
|
|
|
2009-09-16 15:06:16 -07:00
|
|
|
@class CellDrawView;
|
2011-04-21 02:07:32 -07:00
|
|
|
@class NSProgressBarCell;
|
2011-09-08 06:30:32 -07:00
|
|
|
@class ContextAwareSearchFieldCell;
|
2011-04-16 18:22:44 -07:00
|
|
|
class nsDeviceContext;
|
2011-08-08 07:42:45 -07:00
|
|
|
struct SegmentedControlRenderSettings;
|
2009-09-16 15:06:16 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsNativeThemeCocoa : private nsNativeTheme,
|
|
|
|
public nsITheme
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsNativeThemeCocoa();
|
|
|
|
virtual ~nsNativeThemeCocoa();
|
|
|
|
|
2010-11-13 00:19:38 -08:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// The nsITheme interface.
|
2011-04-07 18:04:40 -07:00
|
|
|
NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
PRUint8 aWidgetType,
|
|
|
|
const nsRect& aRect,
|
2008-07-24 16:01:59 -07:00
|
|
|
const nsRect& aDirtyRect);
|
2011-04-16 18:22:44 -07:00
|
|
|
NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
PRUint8 aWidgetType,
|
2009-01-14 19:27:09 -08:00
|
|
|
nsIntMargin* aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool GetWidgetPadding(nsDeviceContext* aContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
PRUint8 aWidgetType,
|
2009-01-14 19:27:09 -08:00
|
|
|
nsIntMargin* aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
|
2008-04-01 16:34:20 -07:00
|
|
|
PRUint8 aWidgetType, nsRect* aOverflowRect);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRUint8 aWidgetType,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsIntSize* aResult, bool* aIsOverridable);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsIAtom* aAttribute, bool* aShouldRepaint);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD ThemeChanged();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
|
|
|
|
bool WidgetIsContainer(PRUint8 aWidgetType);
|
|
|
|
bool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
|
|
|
|
bool ThemeNeedsComboboxDropmarker();
|
2010-06-10 15:53:57 -07:00
|
|
|
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-05-22 12:35:18 -07:00
|
|
|
protected:
|
2007-04-10 17:25:11 -07:00
|
|
|
|
2009-04-17 01:12:12 -07:00
|
|
|
nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame);
|
2011-08-08 07:42:45 -07:00
|
|
|
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
|
|
|
|
CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft,
|
|
|
|
nsIFrame* aCurrent, nsIFrame* aRight);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-04-21 02:06:51 -07:00
|
|
|
// Helpers for progressbar.
|
|
|
|
double GetProgressValue(nsIFrame* aFrame);
|
|
|
|
double GetProgressMaxValue(nsIFrame* aFrame);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// HITheme drawing routines
|
2008-09-22 01:57:42 -07:00
|
|
|
void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,
|
2011-09-28 23:19:26 -07:00
|
|
|
const HIRect& inBoxRect, bool inReadOnly,
|
2010-10-20 04:26:32 -07:00
|
|
|
nsEventStates inState);
|
2007-03-22 10:30:00 -07:00
|
|
|
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool inIsIndeterminate, bool inIsHorizontal,
|
2011-04-21 02:06:51 -07:00
|
|
|
double inValue, double inMaxValue, nsIFrame* aFrame);
|
2011-08-08 07:42:45 -07:00
|
|
|
void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect,
|
|
|
|
nsEventStates inState, nsIFrame* aFrame,
|
|
|
|
const SegmentedControlRenderSettings& aSettings);
|
2008-09-22 01:57:42 -07:00
|
|
|
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
|
|
|
|
void DrawScale(CGContextRef context, const HIRect& inBoxRect,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsEventStates inState, bool inDirection,
|
|
|
|
bool inIsReverse, PRInt32 inCurrentValue, PRInt32 inMinValue,
|
2010-10-20 04:26:32 -07:00
|
|
|
PRInt32 inMaxValue, nsIFrame* aFrame);
|
2011-09-28 23:19:26 -07:00
|
|
|
void DrawCheckboxOrRadio(CGContextRef cgContext, bool inCheckbox,
|
|
|
|
const HIRect& inBoxRect, bool inSelected,
|
2010-10-20 04:26:32 -07:00
|
|
|
nsEventStates inState, nsIFrame* aFrame);
|
2010-09-19 18:16:49 -07:00
|
|
|
void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
|
2010-10-20 04:26:32 -07:00
|
|
|
nsIFrame* aFrame, nsEventStates inState);
|
2009-01-18 03:05:38 -08:00
|
|
|
void DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
2010-10-20 04:26:32 -07:00
|
|
|
nsEventStates inState, nsIFrame* aFrame);
|
2008-09-22 01:57:42 -07:00
|
|
|
void DrawButton(CGContextRef context, ThemeButtonKind inKind,
|
2011-09-28 23:19:26 -07:00
|
|
|
const HIRect& inBoxRect, bool inIsDefault,
|
2010-09-19 18:16:49 -07:00
|
|
|
ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
|
2010-10-20 04:26:32 -07:00
|
|
|
nsEventStates inState, nsIFrame* aFrame);
|
|
|
|
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
nsEventStates inState, PRUint8 aWidgetType,
|
|
|
|
nsIFrame* aFrame);
|
2008-09-22 01:57:42 -07:00
|
|
|
void DrawSpinButtons(CGContextRef context, ThemeButtonKind inKind,
|
2010-10-20 04:26:32 -07:00
|
|
|
const HIRect& inBoxRect, ThemeDrawState inDrawState,
|
|
|
|
ThemeButtonAdornment inAdornment, nsEventStates inState,
|
2008-09-22 01:57:42 -07:00
|
|
|
nsIFrame* aFrame);
|
2008-09-16 01:21:06 -07:00
|
|
|
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
|
2009-12-30 07:23:51 -08:00
|
|
|
NSWindow* aWindow);
|
2009-01-06 07:46:59 -08:00
|
|
|
void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,
|
|
|
|
nsIFrame *aFrame);
|
2009-09-27 14:58:58 -07:00
|
|
|
void DrawResizer(CGContextRef cgContext, const HIRect& aRect, nsIFrame *aFrame);
|
2008-09-16 01:21:06 -07:00
|
|
|
|
2007-04-10 17:25:11 -07:00
|
|
|
// Scrollbars
|
|
|
|
void DrawScrollbar(CGContextRef aCGContext, const HIRect& aBoxRect, nsIFrame *aFrame);
|
2010-10-20 04:26:32 -07:00
|
|
|
void GetScrollbarPressStates (nsIFrame *aFrame, nsEventStates aButtonStates[]);
|
2007-04-10 17:25:11 -07:00
|
|
|
void GetScrollbarDrawInfo (HIThemeTrackDrawInfo& aTdi, nsIFrame *aFrame,
|
2011-09-28 23:19:26 -07:00
|
|
|
const CGSize& aSize, bool aShouldGetButtonStates);
|
2007-04-10 17:25:11 -07:00
|
|
|
nsIFrame* GetParentScrollbarFrame(nsIFrame *aFrame);
|
2007-12-23 11:22:47 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
NSButtonCell* mPushButtonCell;
|
2008-01-13 20:48:33 -08:00
|
|
|
NSButtonCell* mRadioButtonCell;
|
2008-10-13 09:58:40 -07:00
|
|
|
NSButtonCell* mCheckboxCell;
|
2011-09-08 06:30:32 -07:00
|
|
|
ContextAwareSearchFieldCell* mSearchFieldCell;
|
2009-01-31 08:49:29 -08:00
|
|
|
NSPopUpButtonCell* mDropdownCell;
|
2009-02-11 07:54:10 -08:00
|
|
|
NSComboBoxCell* mComboBoxCell;
|
2011-04-21 02:07:32 -07:00
|
|
|
NSProgressBarCell* mProgressBarCell;
|
2009-09-16 15:06:16 -07:00
|
|
|
CellDrawView* mCellDrawView;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsNativeThemeCocoa_h_
|