epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 7 | #include <stdarg.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 8 | #include "SkOSMenu.h" |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 9 | #include "SkThread.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | |
| 11 | static int gOSMenuCmd = 7000; |
| 12 | |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 13 | SkOSMenu::SkOSMenu(const char title[]) { |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 14 | fTitle.set(title); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 15 | } |
| 16 | |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 17 | SkOSMenu::~SkOSMenu() { |
| 18 | this->reset(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 19 | } |
| 20 | |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 21 | void SkOSMenu::reset() { |
| 22 | fItems.deleteAll(); |
| 23 | fTitle.reset(); |
| 24 | } |
| 25 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 26 | const SkOSMenu::Item* SkOSMenu::getItemByID(int itemID) const { |
| 27 | for (int i = 0; i < fItems.count(); ++i) { |
| 28 | if (itemID == fItems[i]->getID()) |
| 29 | return fItems[i]; |
| 30 | } |
| 31 | return NULL; |
| 32 | } |
| 33 | |
| 34 | void SkOSMenu::getItems(const SkOSMenu::Item* items[]) const { |
| 35 | if (NULL != items) { |
| 36 | for (int i = 0; i < fItems.count(); ++i) { |
| 37 | items[i] = fItems[i]; |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 42 | void SkOSMenu::assignKeyEquivalentToItem(int itemID, SkUnichar key) { |
| 43 | for (int i = 0; i < fItems.count(); ++i) { |
| 44 | if (itemID == fItems[i]->getID()) |
| 45 | fItems[i]->setKeyEquivalent(key); |
| 46 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 47 | } |
| 48 | |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 49 | bool SkOSMenu::handleKeyEquivalent(SkUnichar key) { |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 50 | int value = 0, size = 0; |
| 51 | bool state; |
| 52 | SkOSMenu::TriState tristate; |
| 53 | for (int i = 0; i < fItems.count(); ++i) { |
| 54 | Item* item = fItems[i]; |
| 55 | if (item->getKeyEquivalent()== key) { |
| 56 | SkString list; |
| 57 | switch (item->getType()) { |
| 58 | case kList_Type: |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 59 | SkOSMenu::FindListItemCount(*item->getEvent(), &size); |
| 60 | SkOSMenu::FindListIndex(*item->getEvent(), item->getSlotName(), &value); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 61 | value = (value + 1) % size; |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 62 | item->setInt(value); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 63 | break; |
| 64 | case kSwitch_Type: |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 65 | SkOSMenu::FindSwitchState(*item->getEvent(), item->getSlotName(), &state); |
| 66 | item->setBool(!state); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 67 | break; |
| 68 | case kTriState_Type: |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 69 | SkOSMenu::FindTriState(*item->getEvent(), item->getSlotName(), &tristate); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 70 | if (kOnState == tristate) |
| 71 | tristate = kMixedState; |
| 72 | else |
| 73 | tristate = (SkOSMenu::TriState)((int)tristate + 1); |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 74 | item->setTriState(tristate); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 75 | break; |
| 76 | case kAction_Type: |
| 77 | case kCustom_Type: |
| 78 | case kSlider_Type: |
| 79 | case kTextField_Type: |
| 80 | default: |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 81 | break; |
| 82 | } |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 83 | item->postEvent(); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 84 | return true; |
| 85 | } |
| 86 | } |
| 87 | return false; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 88 | } |
| 89 | |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 90 | //////////////////////////////////////////////////////////////////////////////// |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 91 | |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 92 | SkOSMenu::Item::Item(const char label[], SkOSMenu::Type type, |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 93 | const char slotName[], SkEvent* evt) { |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 94 | fLabel.set(label); |
| 95 | fSlotName.set(slotName); |
| 96 | fType = type; |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 97 | fEvent = evt; |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 98 | fKey = 0; |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 99 | fID = sk_atomic_inc(&gOSMenuCmd); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 100 | } |
| 101 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 102 | void SkOSMenu::Item::setBool(bool value) const { |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 103 | SkASSERT(SkOSMenu::kSwitch_Type == fType); |
| 104 | fEvent->setBool(fSlotName.c_str(), value); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 105 | } |
| 106 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 107 | void SkOSMenu::Item::setScalar(SkScalar value) const { |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 108 | SkASSERT(SkOSMenu::kSlider_Type == fType); |
| 109 | fEvent->setScalar(fSlotName.c_str(), value); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 110 | } |
| 111 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 112 | void SkOSMenu::Item::setInt(int value) const { |
| 113 | SkASSERT(SkOSMenu::kList_Type == fType); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 114 | fEvent->setS32(fSlotName.c_str(), value); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 115 | } |
| 116 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 117 | void SkOSMenu::Item::setTriState(TriState value) const { |
| 118 | SkASSERT(SkOSMenu::kTriState_Type == fType); |
| 119 | fEvent->setS32(fSlotName.c_str(), value); |
| 120 | } |
| 121 | |
| 122 | void SkOSMenu::Item::setString(const char value[]) const { |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 123 | SkASSERT(SkOSMenu::kTextField_Type == fType); |
| 124 | fEvent->setString(fSlotName.c_str(), value); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | //////////////////////////////////////////////////////////////////////////////// |
| 128 | |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 129 | static const char* gMenuEventType = "SkOSMenuEventType"; |
| 130 | static const char* gSlider_Min_Scalar = "SkOSMenuSlider_Min"; |
| 131 | static const char* gSlider_Max_Scalar = "SkOSMenuSlider_Max"; |
| 132 | static const char* gDelimiter = "|"; |
| 133 | static const char* gList_Items_Str = "SkOSMenuList_Items"; |
| 134 | static const char* gList_ItemCount_S32 = "SkOSMenuList_ItemCount"; |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 135 | |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 136 | int SkOSMenu::appendItem(const char label[], Type type, const char slotName[], |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 137 | SkEvent* evt) { |
| 138 | SkOSMenu::Item* item = new Item(label, type, slotName, evt); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 139 | fItems.append(1, &item); |
| 140 | return item->getID(); |
| 141 | } |
| 142 | |
| 143 | int SkOSMenu::appendAction(const char label[], SkEventSinkID target) { |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 144 | SkEvent* evt = new SkEvent(gMenuEventType, target); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 145 | //Store label in event so it can be used to identify the action later |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 146 | evt->setString(label, label); |
| 147 | return appendItem(label, SkOSMenu::kAction_Type, "", evt); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 148 | } |
| 149 | |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 150 | int SkOSMenu::appendList(const char label[], const char slotName[], |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 151 | SkEventSinkID target, int index, const char option[], ...) { |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 152 | SkEvent* evt = new SkEvent(gMenuEventType, target); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 153 | va_list args; |
| 154 | if (option) { |
| 155 | SkString str(option); |
| 156 | va_start(args, option); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 157 | int count = 1; |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 158 | for (const char* arg = va_arg(args, const char*); arg != NULL; arg = va_arg(args, const char*)) { |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 159 | str += gDelimiter; |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 160 | str += arg; |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 161 | ++count; |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 162 | } |
| 163 | va_end(args); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 164 | evt->setString(gList_Items_Str, str); |
| 165 | evt->setS32(gList_ItemCount_S32, count); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 166 | evt->setS32(slotName, index); |
| 167 | } |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 168 | return appendItem(label, SkOSMenu::kList_Type, slotName, evt); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 169 | } |
| 170 | |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 171 | int SkOSMenu::appendSlider(const char label[], const char slotName[], |
| 172 | SkEventSinkID target, SkScalar min, SkScalar max, |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 173 | SkScalar defaultValue) { |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 174 | SkEvent* evt = new SkEvent(gMenuEventType, target); |
| 175 | evt->setScalar(gSlider_Min_Scalar, min); |
| 176 | evt->setScalar(gSlider_Max_Scalar, max); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 177 | evt->setScalar(slotName, defaultValue); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 178 | return appendItem(label, SkOSMenu::kSlider_Type, slotName, evt); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 179 | } |
| 180 | |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 181 | int SkOSMenu::appendSwitch(const char label[], const char slotName[], |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 182 | SkEventSinkID target, bool defaultState) { |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 183 | SkEvent* evt = new SkEvent(gMenuEventType, target); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 184 | evt->setBool(slotName, defaultState); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 185 | return appendItem(label, SkOSMenu::kSwitch_Type, slotName, evt); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | int SkOSMenu::appendTriState(const char label[], const char slotName[], |
| 189 | SkEventSinkID target, SkOSMenu::TriState defaultState) { |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 190 | SkEvent* evt = new SkEvent(gMenuEventType, target); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 191 | evt->setS32(slotName, defaultState); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 192 | return appendItem(label, SkOSMenu::kTriState_Type, slotName, evt); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 193 | } |
| 194 | |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 195 | int SkOSMenu::appendTextField(const char label[], const char slotName[], |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 196 | SkEventSinkID target, const char placeholder[]) { |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 197 | SkEvent* evt = new SkEvent(gMenuEventType, target); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 198 | evt->setString(slotName, placeholder); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 199 | return appendItem(label, SkOSMenu::kTextField_Type, slotName, evt); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 200 | } |
| 201 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 202 | bool SkOSMenu::FindListItemCount(const SkEvent& evt, int* count) { |
| 203 | return evt.isType(gMenuEventType) && evt.findS32(gList_ItemCount_S32, count); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 204 | } |
| 205 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 206 | bool SkOSMenu::FindListItems(const SkEvent& evt, SkString items[]) { |
| 207 | if (evt.isType(gMenuEventType) && NULL != items) { |
| 208 | const char* text = evt.findString(gList_Items_Str); |
yangsu@google.com | 2f9462d | 2011-08-05 22:37:18 +0000 | [diff] [blame] | 209 | if (text != NULL) { |
| 210 | SkString temp(text); |
| 211 | char* token = strtok((char*)temp.c_str(), gDelimiter); |
| 212 | int index = 0; |
| 213 | while (token != NULL) { |
| 214 | items[index].set(token, strlen(token)); |
| 215 | token = strtok (NULL, gDelimiter); |
| 216 | ++index; |
| 217 | } |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 218 | } |
| 219 | return true; |
| 220 | } |
| 221 | return false; |
| 222 | } |
| 223 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 224 | bool SkOSMenu::FindSliderMin(const SkEvent& evt, SkScalar* min) { |
| 225 | return evt.isType(gMenuEventType) && evt.findScalar(gSlider_Min_Scalar, min); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 226 | } |
| 227 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 228 | bool SkOSMenu::FindSliderMax(const SkEvent& evt, SkScalar* max) { |
| 229 | return evt.isType(gMenuEventType) && evt.findScalar(gSlider_Max_Scalar, max); |
yangsu@google.com | e55f533 | 2011-08-05 22:11:41 +0000 | [diff] [blame] | 230 | } |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 231 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 232 | bool SkOSMenu::FindAction(const SkEvent& evt, const char label[]) { |
| 233 | return evt.isType(gMenuEventType) && evt.findString(label); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 234 | } |
| 235 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 236 | bool SkOSMenu::FindListIndex(const SkEvent& evt, const char slotName[], int* value) { |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 237 | return evt.isType(gMenuEventType) && evt.findS32(slotName, value); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 238 | } |
| 239 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 240 | bool SkOSMenu::FindSliderValue(const SkEvent& evt, const char slotName[], SkScalar* value) { |
| 241 | return evt.isType(gMenuEventType) && evt.findScalar(slotName, value); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 242 | } |
| 243 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 244 | bool SkOSMenu::FindSwitchState(const SkEvent& evt, const char slotName[], bool* value) { |
| 245 | return evt.isType(gMenuEventType) && evt.findBool(slotName, value); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 246 | } |
| 247 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 248 | bool SkOSMenu::FindTriState(const SkEvent& evt, const char slotName[], SkOSMenu::TriState* value) { |
| 249 | return evt.isType(gMenuEventType) && evt.findS32(slotName, (int*)value); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 250 | } |
| 251 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 252 | bool SkOSMenu::FindText(const SkEvent& evt, const char slotName[], SkString* value) { |
| 253 | if (evt.isType(gMenuEventType)) { |
| 254 | const char* text = evt.findString(slotName); |
yangsu@google.com | 654d72f | 2011-08-01 17:27:33 +0000 | [diff] [blame] | 255 | if (!text || !*text) |
| 256 | return false; |
| 257 | else { |
| 258 | value->set(text); |
| 259 | return true; |
| 260 | } |
| 261 | } |
| 262 | return false; |
| 263 | } |