#ifndef RenderListBox_h
#define RenderListBox_h
#include "RenderBlock.h"
#include "ScrollbarClient.h"
namespace WebCore {
class RenderListBox : public RenderBlock, private ScrollbarClient {
public:
RenderListBox(Element*);
virtual ~RenderListBox();
void selectionChanged();
void setOptionsChanged(bool changed) { m_optionsChanged = changed; }
int listIndexAtOffset(int x, int y);
IntRect itemBoundingBoxRect(int tx, int ty, int index);
bool scrollToRevealElementAtListIndex(int index);
bool listIndexIsVisible(int index);
int scrollToward(const IntPoint&);
private:
virtual const char* renderName() const { return "RenderListBox"; }
virtual bool isListBox() const { return true; }
virtual void updateFromElement();
virtual bool canHaveChildren() const { return false; }
virtual bool hasControlClip() const { return true; }
virtual void paintObject(PaintInfo&, int tx, int ty);
virtual IntRect controlClipRect(int tx, int ty) const;
virtual bool isPointInOverflowControl(HitTestResult&, int x, int y, int tx, int ty);
virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f, Node** stopNode = 0);
virtual void calcPrefWidths();
virtual int baselinePosition(bool firstLine, bool isRootLineBox) const;
virtual void calcHeight();
virtual void layout();
virtual bool canBeProgramaticallyScrolled(bool) const { return true; }
virtual void autoscroll();
virtual void stopAutoscroll();
virtual bool shouldPanScroll() const { return true; }
virtual void panScroll(const IntPoint&);
virtual int verticalScrollbarWidth() const;
virtual int scrollLeft() const;
virtual int scrollTop() const;
virtual int scrollWidth() const;
virtual int scrollHeight() const;
virtual void setScrollLeft(int);
virtual void setScrollTop(int);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual void valueChanged(Scrollbar*);
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const;
virtual bool scrollbarCornerPresent() const { return false; } virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;
virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;
virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;
virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
void setHasVerticalScrollbar(bool hasScrollbar);
PassRefPtr<Scrollbar> createScrollbar();
void destroyScrollbar();
int itemHeight() const;
void valueChanged(unsigned listIndex);
int size() const;
int numVisibleItems() const;
int numItems() const;
int listHeight() const;
void paintScrollbar(PaintInfo&, int tx, int ty);
void paintItemForeground(PaintInfo&, int tx, int ty, int listIndex);
void paintItemBackground(PaintInfo&, int tx, int ty, int listIndex);
void scrollToRevealSelection();
bool m_optionsChanged;
bool m_scrollToRevealSelectionAfterLayout;
bool m_inAutoscroll;
int m_optionsWidth;
int m_indexOffset;
RefPtr<Scrollbar> m_vBar;
};
inline RenderListBox* toRenderListBox(RenderObject* object)
{
ASSERT(!object || object->isListBox());
return static_cast<RenderListBox*>(object);
}
void toRenderListBox(const RenderListBox*);
}
#endif // RenderListBox_h