1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/forms/nsFormControlFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,99 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsFormControlFrame_h___ 1.10 +#define nsFormControlFrame_h___ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "nsIFormControlFrame.h" 1.14 +#include "nsLeafFrame.h" 1.15 + 1.16 +/** 1.17 + * nsFormControlFrame is the base class for radio buttons and 1.18 + * checkboxes. It also has two static methods (RegUnRegAccessKey and 1.19 + * GetScreenHeight) that are used by other form controls. 1.20 + */ 1.21 +class nsFormControlFrame : public nsLeafFrame, 1.22 + public nsIFormControlFrame 1.23 +{ 1.24 +public: 1.25 + /** 1.26 + * Main constructor 1.27 + * @param aContent the content representing this frame 1.28 + * @param aParentFrame the parent frame 1.29 + */ 1.30 + nsFormControlFrame(nsStyleContext*); 1.31 + 1.32 + virtual nsIAtom* GetType() const MOZ_OVERRIDE; 1.33 + 1.34 + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE 1.35 + { 1.36 + return nsLeafFrame::IsFrameOfType(aFlags & 1.37 + ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); 1.38 + } 1.39 + 1.40 + NS_DECL_QUERYFRAME 1.41 + NS_DECL_FRAMEARENA_HELPERS 1.42 + 1.43 + /** 1.44 + * Respond to a gui event 1.45 + * @see nsIFrame::HandleEvent 1.46 + */ 1.47 + virtual nsresult HandleEvent(nsPresContext* aPresContext, 1.48 + mozilla::WidgetGUIEvent* aEvent, 1.49 + nsEventStatus* aEventStatus) MOZ_OVERRIDE; 1.50 + 1.51 + virtual nscoord GetBaseline() const MOZ_OVERRIDE; 1.52 + 1.53 + /** 1.54 + * Respond to the request to resize and/or reflow 1.55 + * @see nsIFrame::Reflow 1.56 + */ 1.57 + virtual nsresult Reflow(nsPresContext* aCX, 1.58 + nsHTMLReflowMetrics& aDesiredSize, 1.59 + const nsHTMLReflowState& aReflowState, 1.60 + nsReflowStatus& aStatus) MOZ_OVERRIDE; 1.61 + 1.62 + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; 1.63 + 1.64 + // new behavior 1.65 + 1.66 + virtual void SetFocus(bool aOn = true, bool aRepaint = false) MOZ_OVERRIDE; 1.67 + 1.68 + // nsIFormControlFrame 1.69 + virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE; 1.70 + 1.71 + // AccessKey Helper function 1.72 + static nsresult RegUnRegAccessKey(nsIFrame * aFrame, bool aDoReg); 1.73 + 1.74 + /** 1.75 + * Returns the usable screen rect in app units, eg the rect where we can 1.76 + * draw dropdowns. 1.77 + */ 1.78 + static nsRect GetUsableScreenRect(nsPresContext* aPresContext); 1.79 + 1.80 +protected: 1.81 + 1.82 + virtual ~nsFormControlFrame(); 1.83 + 1.84 + virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE; 1.85 + virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE; 1.86 + 1.87 +// 1.88 +//------------------------------------------------------------------------------------- 1.89 +// Utility methods for managing checkboxes and radiobuttons 1.90 +//------------------------------------------------------------------------------------- 1.91 +// 1.92 + /** 1.93 + * Get the state of the checked attribute. 1.94 + * @param aState set to true if the checked attribute is set, 1.95 + * false if the checked attribute has been removed 1.96 + */ 1.97 + 1.98 + void GetCurrentCheckState(bool* aState); 1.99 +}; 1.100 + 1.101 +#endif 1.102 +