Esempio n. 1
0
void
nsDeckFrame::IndexChanged()
{
  //did the index change?
  int32_t index = GetSelectedIndex();
  if (index == mIndex)
    return;

  // redraw
  InvalidateFrame();

  // hide the currently showing box
  nsIFrame* currentBox = GetSelectedBox();
  if (currentBox) // only hide if it exists
    HideBox(currentBox);

  mIndex = index;

#ifdef ACCESSIBILITY
  nsAccessibilityService* accService = GetAccService();
  if (accService) {
    accService->DeckPanelSwitched(PresContext()->GetPresShell(), mContent,
                                  currentBox, GetSelectedBox());
  }
#endif
}
Esempio n. 2
0
void
nsDeckFrame::RemoveFrame(ChildListID aListID,
                         nsIFrame* aOldFrame)
{
  nsIFrame* currentFrame = GetSelectedBox();
  if (currentFrame &&
      aOldFrame &&
      currentFrame != aOldFrame) {
    // If the frame we're removing is at an index that's less
    // than mIndex, that means we're going to be shifting indexes
    // by 1.
    //
    // We attempt to keep the same child displayed by automatically
    // updating our internal notion of the current index.
    int32_t removedIndex = mFrames.IndexOf(aOldFrame);
    MOZ_ASSERT(removedIndex >= 0,
               "A deck child was removed that was not in mFrames.");
    if (removedIndex < mIndex) {
      mIndex--;
      // This is going to cause us to handle the index change in IndexedChanged,
      // but since the new index will match mIndex, it's essentially a noop.
      nsContentUtils::AddScriptRunner(new nsSetAttrRunnable(
        mContent, nsGkAtoms::selectedIndex, mIndex));
    }
  }
  nsBoxFrame::RemoveFrame(aListID, aOldFrame);
}
Esempio n. 3
0
void
nsDeckFrame::IndexChanged(nsPresContext* aPresContext)
{
  //did the index change?
  PRInt32 index = GetSelectedIndex();
  if (index == mIndex)
    return;

  // redraw
  InvalidateOverflowRect();

  // hide the currently showing box
  nsIBox* currentBox = GetSelectedBox();
  if (currentBox) // only hide if it exists
     HideBox(aPresContext, currentBox);

  mIndex = index;

  // show the new box
  nsIBox* newBox = GetSelectedBox();
  if (newBox) // only show if it exists
     ShowBox(aPresContext, newBox);
}
Esempio n. 4
0
void
nsDeckFrame::BuildDisplayListForChildren(nsDisplayListBuilder*   aBuilder,
                                         const nsRect&           aDirtyRect,
                                         const nsDisplayListSet& aLists)
{
  // only paint the selected box
  nsIFrame* box = GetSelectedBox();
  if (!box)
    return;

  // Putting the child in the background list. This is a little weird but
  // it matches what we were doing before.
  nsDisplayListSet set(aLists, aLists.BlockBorderBackgrounds());
  BuildDisplayListForChild(aBuilder, box, aDirtyRect, set);
}
Esempio n. 5
0
void
nsDeckFrame::IndexChanged()
{
    //did the index change?
    PRInt32 index = GetSelectedIndex();
    if (index == mIndex)
        return;

    // redraw
    InvalidateOverflowRect();

    // hide the currently showing box
    nsIBox* currentBox = GetSelectedBox();
    if (currentBox) // only hide if it exists
        HideBox(currentBox);

    mIndex = index;
}