|
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 |
|
39 virtual const char* renderName() const { return "RenderSlider"; } |
|
40 virtual bool isSlider() const { return true; } |
|
41 |
|
42 virtual short baselinePosition( bool, bool ) const; |
|
43 virtual void calcPrefWidths(); |
|
44 virtual void setStyle(RenderStyle*); |
|
45 virtual void layout(); |
|
46 virtual void updateFromElement(); |
|
47 |
|
48 bool mouseEventIsInThumb(MouseEvent*); |
|
49 |
|
50 void setValueForPosition(int position); |
|
51 double setPositionFromValue(bool inLayout = false); |
|
52 int positionForOffset(const IntPoint&); |
|
53 |
|
54 void valueChanged(); |
|
55 |
|
56 int currentPosition(); |
|
57 void setCurrentPosition(int pos); |
|
58 |
|
59 void forwardEvent(Event*); |
|
60 bool inDragMode() const; |
|
61 |
|
62 private: |
|
63 RenderStyle* createThumbStyle(RenderStyle* parentStyle); |
|
64 int trackSize(); |
|
65 |
|
66 RefPtr<HTMLSliderThumbElement> m_thumb; |
|
67 }; |
|
68 |
|
69 } // namespace WebCore |
|
70 |
|
71 #endif // RenderSlider_h |