layout/forms/nsFormControlFrame.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsFormControlFrame_h___
     7 #define nsFormControlFrame_h___
     9 #include "mozilla/Attributes.h"
    10 #include "nsIFormControlFrame.h"
    11 #include "nsLeafFrame.h"
    13 /** 
    14  * nsFormControlFrame is the base class for radio buttons and
    15  * checkboxes.  It also has two static methods (RegUnRegAccessKey and
    16  * GetScreenHeight) that are used by other form controls.
    17  */
    18 class nsFormControlFrame : public nsLeafFrame,
    19                            public nsIFormControlFrame
    20 {
    21 public:
    22   /**
    23     * Main constructor
    24     * @param aContent the content representing this frame
    25     * @param aParentFrame the parent frame
    26     */
    27   nsFormControlFrame(nsStyleContext*);
    29   virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    31   virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
    32   {
    33     return nsLeafFrame::IsFrameOfType(aFlags &
    34       ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
    35   }
    37   NS_DECL_QUERYFRAME
    38   NS_DECL_FRAMEARENA_HELPERS
    40   /** 
    41     * Respond to a gui event
    42     * @see nsIFrame::HandleEvent
    43     */
    44   virtual nsresult HandleEvent(nsPresContext* aPresContext, 
    45                                mozilla::WidgetGUIEvent* aEvent,
    46                                nsEventStatus* aEventStatus) MOZ_OVERRIDE;
    48   virtual nscoord GetBaseline() const MOZ_OVERRIDE;
    50   /**
    51     * Respond to the request to resize and/or reflow
    52     * @see nsIFrame::Reflow
    53     */
    54   virtual nsresult Reflow(nsPresContext*      aCX,
    55                           nsHTMLReflowMetrics& aDesiredSize,
    56                           const nsHTMLReflowState& aReflowState,
    57                           nsReflowStatus&      aStatus) MOZ_OVERRIDE;
    59   virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
    61   // new behavior
    63   virtual void SetFocus(bool aOn = true, bool aRepaint = false) MOZ_OVERRIDE;
    65   // nsIFormControlFrame
    66   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE;
    68   // AccessKey Helper function
    69   static nsresult RegUnRegAccessKey(nsIFrame * aFrame, bool aDoReg);
    71   /**
    72    * Returns the usable screen rect in app units, eg the rect where we can
    73    * draw dropdowns.
    74    */
    75   static nsRect GetUsableScreenRect(nsPresContext* aPresContext);
    77 protected:
    79   virtual ~nsFormControlFrame();
    81   virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE;
    82   virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE;
    84 //
    85 //-------------------------------------------------------------------------------------
    86 //  Utility methods for managing checkboxes and radiobuttons
    87 //-------------------------------------------------------------------------------------
    88 //   
    89    /**
    90     * Get the state of the checked attribute.
    91     * @param aState set to true if the checked attribute is set,
    92     * false if the checked attribute has been removed
    93     */
    95   void GetCurrentCheckState(bool* aState);
    96 };
    98 #endif

mercurial