• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  *
3  * Copyright (C) 2006 Apple Computer, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  */
21 
22 #ifndef RenderSlider_h
23 #define RenderSlider_h
24 
25 #include "RenderBlock.h"
26 
27 namespace WebCore {
28 
29     class HTMLDivElement;
30     class HTMLInputElement;
31     class HTMLSliderThumbElement;
32     class MouseEvent;
33 
34     class RenderSlider : public RenderBlock {
35     public:
36         RenderSlider(HTMLInputElement*);
37         ~RenderSlider();
38 
renderName()39         virtual const char* renderName() const { return "RenderSlider"; }
isSlider()40         virtual bool isSlider() const { return true; }
41 
42         virtual int baselinePosition( bool, bool ) const;
43         virtual void calcPrefWidths();
44         virtual void layout();
45         virtual void updateFromElement();
46 
47         virtual bool mouseEventIsInThumb(MouseEvent*);
48 
49         void setValueForPosition(int position);
50         double setPositionFromValue(bool inLayout = false);
51         int positionForOffset(const IntPoint&);
52 
53         void valueChanged();
54 
55         int currentPosition();
56         void setCurrentPosition(int pos);
57 
58         void forwardEvent(Event*);
59         bool inDragMode() const;
60 
61     protected:
62         virtual void styleDidChange(RenderStyle::Diff, const RenderStyle* oldStyle);
63 
64     private:
65         PassRefPtr<RenderStyle> createThumbStyle(const RenderStyle* parentStyle, const RenderStyle* oldStyle = 0);
66         int trackSize();
67 
68         RefPtr<HTMLSliderThumbElement> m_thumb;
69 };
70 
71 } // namespace WebCore
72 
73 #endif // RenderSlider_h
74