nsGfxButtonControlFrame.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/. */
  5. #ifndef nsGfxButtonControlFrame_h___
  6. #define nsGfxButtonControlFrame_h___
  7. #include "mozilla/Attributes.h"
  8. #include "nsHTMLButtonControlFrame.h"
  9. #include "nsCOMPtr.h"
  10. #include "nsIAnonymousContentCreator.h"
  11. // Class which implements the input[type=button, reset, submit] and
  12. // browse button for input[type=file].
  13. // The label for button is specified through generated content
  14. // in the ua.css file.
  15. class nsGfxButtonControlFrame : public nsHTMLButtonControlFrame,
  16. public nsIAnonymousContentCreator
  17. {
  18. public:
  19. NS_DECL_FRAMEARENA_HELPERS
  20. explicit nsGfxButtonControlFrame(nsStyleContext* aContext);
  21. virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
  22. virtual nsresult HandleEvent(nsPresContext* aPresContext,
  23. mozilla::WidgetGUIEvent* aEvent,
  24. nsEventStatus* aEventStatus) override;
  25. virtual nsIAtom* GetType() const override;
  26. #ifdef DEBUG_FRAME_DUMP
  27. virtual nsresult GetFrameName(nsAString& aResult) const override;
  28. #endif
  29. NS_DECL_QUERYFRAME
  30. // nsIAnonymousContentCreator
  31. virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
  32. virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
  33. uint32_t aFilter) override;
  34. virtual nsresult AttributeChanged(int32_t aNameSpaceID,
  35. nsIAtom* aAttribute,
  36. int32_t aModType) override;
  37. virtual bool IsLeaf() const override;
  38. virtual nsContainerFrame* GetContentInsertionFrame() override;
  39. protected:
  40. nsresult GetDefaultLabel(nsXPIDLString& aLabel) const;
  41. nsresult GetLabel(nsXPIDLString& aLabel);
  42. virtual bool IsInput() override { return true; }
  43. private:
  44. nsCOMPtr<nsIContent> mTextContent;
  45. };
  46. #endif