SpinButtonElement.h [plain text]
#ifndef SpinButtonElement_h
#define SpinButtonElement_h
#include "HTMLDivElement.h"
#include "PopupOpeningObserver.h"
#include "Timer.h"
namespace WebCore {
class SpinButtonElement FINAL : public HTMLDivElement, public PopupOpeningObserver {
public:
enum UpDownState {
Indeterminate, Down,
Up,
};
class SpinButtonOwner {
public:
virtual ~SpinButtonOwner() { }
virtual void focusAndSelectSpinButtonOwner() = 0;
virtual bool shouldSpinButtonRespondToMouseEvents() = 0;
virtual bool shouldSpinButtonRespondToWheelEvents() = 0;
virtual void spinButtonStepDown() = 0;
virtual void spinButtonStepUp() = 0;
};
static PassRefPtr<SpinButtonElement> create(Document*, SpinButtonOwner&);
UpDownState upDownState() const { return m_upDownState; }
virtual void releaseCapture();
void removeSpinButtonOwner() { m_spinButtonOwner = 0; }
void step(int amount);
virtual bool willRespondToMouseMoveEvents() OVERRIDE;
virtual bool willRespondToMouseClickEvents() OVERRIDE;
void forwardEvent(Event*);
private:
SpinButtonElement(Document*, SpinButtonOwner&);
virtual const AtomicString& shadowPseudoId() const;
virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
virtual bool isSpinButtonElement() const { return true; }
virtual bool isDisabledFormControl() const OVERRIDE { return shadowHost() && shadowHost()->isDisabledFormControl(); }
virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
virtual bool matchesReadWritePseudoClass() const OVERRIDE;
virtual void defaultEventHandler(Event*);
virtual void willOpenPopup() OVERRIDE;
void doStepAction(int);
void startRepeatingTimer();
void stopRepeatingTimer();
void repeatingTimerFired(Timer<SpinButtonElement>*);
virtual void setHovered(bool = true) OVERRIDE;
bool shouldRespondToMouseEvents();
virtual bool isMouseFocusable() const { return false; }
SpinButtonOwner* m_spinButtonOwner;
bool m_capturing;
UpDownState m_upDownState;
UpDownState m_pressStartingState;
Timer<SpinButtonElement> m_repeatingTimer;
};
}
#endif