OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkScrollBarView.h" | 8 #include "SkScrollBarView.h" |
9 #include "SkAnimator.h" | 9 #include "SkAnimator.h" |
10 #include "SkWidgetViews.h" | 10 #include "SkWidgetViews.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 return this->INHERITED::onEvent(evt); | 117 return this->INHERITED::onEvent(evt); |
118 } | 118 } |
119 | 119 |
120 void SkScrollBarView::adjust() | 120 void SkScrollBarView::adjust() |
121 { | 121 { |
122 int total = fTotalLength; | 122 int total = fTotalLength; |
123 int start = fStartPoint; | 123 int start = fStartPoint; |
124 int shown = fShownLength; | 124 int shown = fShownLength; |
125 int hideBar = 0; | 125 // int hideBar = 0; |
126 | 126 |
127 if (total <= 0 || shown <= 0 || shown >= total) // no bar to show | 127 if (total <= 0 || shown <= 0 || shown >= total) // no bar to show |
128 { | 128 { |
129 total = 1; // avoid divide-by-zero. should be done by skin/script | 129 total = 1; // avoid divide-by-zero. should be done by skin/script |
130 hideBar = 1; // signal we don't want a thumb | 130 // hideBar = 1; // signal we don't want a thumb |
131 } | 131 } |
132 else | 132 else |
133 { | 133 { |
134 if (start + shown > total) | 134 if (start + shown > total) |
135 start = total - shown; | 135 start = total - shown; |
136 } | 136 } |
137 | 137 |
138 SkEvent e("user"); | 138 SkEvent e("user"); |
139 e.setString("id", "adjustScrollBar"); | 139 e.setString("id", "adjustScrollBar"); |
140 e.setScalar("_totalLength", SkIntToScalar(total)); | 140 e.setScalar("_totalLength", SkIntToScalar(total)); |
141 e.setScalar("_startPoint", SkIntToScalar(start)); | 141 e.setScalar("_startPoint", SkIntToScalar(start)); |
142 e.setScalar("_shownLength", SkIntToScalar(shown)); | 142 e.setScalar("_shownLength", SkIntToScalar(shown)); |
143 // e.setS32("hideBar", hideBar); | 143 // e.setS32("hideBar", hideBar); |
144 fAnim.doUserEvent(e); | 144 fAnim.doUserEvent(e); |
145 } | 145 } |
OLD | NEW |