nsIComboboxControlFrame.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 nsIComboboxControlFrame_h___
  6. #define nsIComboboxControlFrame_h___
  7. #include "nsQueryFrame.h"
  8. /**
  9. * nsIComboboxControlFrame is the interface for comboboxes.
  10. */
  11. class nsIComboboxControlFrame : public nsQueryFrame
  12. {
  13. public:
  14. NS_DECL_QUERYFRAME_TARGET(nsIComboboxControlFrame)
  15. /**
  16. * Indicates whether the list is dropped down
  17. */
  18. virtual bool IsDroppedDown() = 0;
  19. virtual bool IsOpenInParentProcess() = 0;
  20. virtual void SetOpenInParentProcess(bool aVal) = 0;
  21. bool IsDroppedDownOrHasParentPopup() { return IsDroppedDown() || IsOpenInParentProcess(); }
  22. /**
  23. * Shows or hides the drop down
  24. */
  25. virtual void ShowDropDown(bool aDoDropDown) = 0;
  26. /**
  27. * Gets the Drop Down List
  28. */
  29. virtual nsIFrame* GetDropDown() = 0;
  30. /**
  31. * Sets the Drop Down List
  32. */
  33. virtual void SetDropDown(nsIFrame* aDropDownFrame) = 0;
  34. /**
  35. * Tells the combobox to roll up
  36. */
  37. virtual void RollupFromList() = 0;
  38. /**
  39. * Redisplay the selected text (will do nothing if text has not changed).
  40. * This method might destroy this frame or any others that happen to be
  41. * around. It might even run script.
  42. */
  43. NS_IMETHOD RedisplaySelectedText() = 0;
  44. /**
  45. * Method for the listbox to set and get the recent index
  46. */
  47. virtual int32_t UpdateRecentIndex(int32_t aIndex) = 0;
  48. /**
  49. * Notification that the content has been reset
  50. */
  51. virtual void OnContentReset() = 0;
  52. /**
  53. * This returns the index of the item that is currently being displayed
  54. * in the display area. It may differ from what the currently Selected index
  55. * is in in the dropdown.
  56. *
  57. * Detailed explanation:
  58. * When the dropdown is dropped down via a mouse click and the user moves the mouse
  59. * up and down without clicking, the currently selected item is being tracking inside
  60. * the dropdown, but the combobox is not being updated. When the user selects items
  61. * with the arrow keys, the combobox is being updated. So when the user clicks outside
  62. * the dropdown and it needs to roll up it has to decide whether to keep the current
  63. * selection or not. This method is used to get the current index in the combobox to
  64. * compare it to the current index in the dropdown to see if the combox has been updated
  65. * and that way it knows whether to "cancel" the current selection residing in the
  66. * dropdown. Or whether to leave the selection alone.
  67. */
  68. virtual int32_t GetIndexOfDisplayArea() = 0;
  69. };
  70. #endif