2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsFormControlFrame_h___
|
|
|
|
#define nsFormControlFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIFormControlFrame.h"
|
|
|
|
#include "nsLeafFrame.h"
|
|
|
|
|
|
|
|
/**
|
2008-03-07 09:57:34 -08:00
|
|
|
* nsFormControlFrame is the base class for radio buttons and
|
|
|
|
* checkboxes. It also has two static methods (RegUnRegAccessKey and
|
|
|
|
* GetScreenHeight) that are used by other form controls.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsFormControlFrame : public nsLeafFrame,
|
|
|
|
public nsIFormControlFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Main constructor
|
|
|
|
* @param aContent the content representing this frame
|
|
|
|
* @param aParentFrame the parent frame
|
|
|
|
*/
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit nsFormControlFrame(nsStyleContext*);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2012-06-04 16:26:30 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return nsLeafFrame::IsFrameOfType(aFlags &
|
|
|
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
|
|
|
}
|
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Respond to a gui event
|
|
|
|
* @see nsIFrame::HandleEvent
|
|
|
|
*/
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult HandleEvent(nsPresContext* aPresContext,
|
2014-02-18 00:36:33 -08:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-17 05:19:38 -07:00
|
|
|
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode)
|
|
|
|
const MOZ_OVERRIDE;
|
2008-03-07 09:57:34 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Respond to the request to resize and/or reflow
|
|
|
|
* @see nsIFrame::Reflow
|
|
|
|
*/
|
2014-05-12 17:47:52 -07:00
|
|
|
virtual void Reflow(nsPresContext* aCX,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// new behavior
|
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual void SetFocus(bool aOn = true, bool aRepaint = false) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIFormControlFrame
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// AccessKey Helper function
|
2011-09-28 23:19:26 -07:00
|
|
|
static nsresult RegUnRegAccessKey(nsIFrame * aFrame, bool aDoReg);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
2009-08-17 20:21:07 -07:00
|
|
|
* Returns the usable screen rect in app units, eg the rect where we can
|
|
|
|
* draw dropdowns.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-08-17 20:21:07 -07:00
|
|
|
static nsRect GetUsableScreenRect(nsPresContext* aPresContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~nsFormControlFrame();
|
|
|
|
|
2014-07-24 10:03:26 -07:00
|
|
|
virtual nscoord GetIntrinsicISize() MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetIntrinsicBSize() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------------------------
|
|
|
|
// Utility methods for managing checkboxes and radiobuttons
|
|
|
|
//-------------------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
* Get the state of the checked attribute.
|
2011-10-17 07:59:28 -07:00
|
|
|
* @param aState set to true if the checked attribute is set,
|
|
|
|
* false if the checked attribute has been removed
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void GetCurrentCheckState(bool* aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|