| OLD | NEW |
| (Empty) |
| 1 // Copyright 2006-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 // | |
| 16 | |
| 17 #ifndef OMAHA_UI_UILIB_NODE_STATE_H_ | |
| 18 #define OMAHA_UI_UILIB_NODE_STATE_H_ | |
| 19 | |
| 20 #include <atlstr.h> | |
| 21 | |
| 22 class NodeState { | |
| 23 public: | |
| 24 explicit NodeState(HWND window); | |
| 25 virtual ~NodeState(); | |
| 26 | |
| 27 void SetStdFont(HFONT font); | |
| 28 HFONT GetFont() const; | |
| 29 COLORREF text_color() const { return text_color_; } | |
| 30 bool IsURL() const { return !url_.IsEmpty(); } | |
| 31 CString url() const { return url_; } | |
| 32 | |
| 33 int ConsumeTag(const TCHAR* string); | |
| 34 | |
| 35 private: | |
| 36 enum Actions { | |
| 37 UNKNOWN, | |
| 38 BOLD_ON, | |
| 39 BOLD_OFF, | |
| 40 ITALIC_ON, | |
| 41 ITALIC_OFF, | |
| 42 UNDERLINE_ON, | |
| 43 UNDERLINE_OFF, | |
| 44 TEXTCOLOR_ON, | |
| 45 TEXTCOLOR_OFF, | |
| 46 TEXTSIZE_ON, | |
| 47 TEXTSIZE_OFF, | |
| 48 URL_ON, | |
| 49 URL_OFF, | |
| 50 }; | |
| 51 | |
| 52 struct Tags { | |
| 53 const TCHAR* name_to_match; | |
| 54 int length_name_to_match; | |
| 55 Actions action; | |
| 56 bool no_parameters; | |
| 57 }; | |
| 58 | |
| 59 int ApplyAction(Actions action, const TCHAR* string); | |
| 60 int ReadNumParameter(const TCHAR* string, int* param); | |
| 61 int ReadHexParameter(const TCHAR* szString, int* param); | |
| 62 int ReadColorRef(const TCHAR* string, int* param); | |
| 63 int ReadString(const TCHAR* string, CString* string_out); | |
| 64 bool IsDefaultFont() const; | |
| 65 | |
| 66 // Data | |
| 67 static Tags tags_[]; | |
| 68 | |
| 69 HWND owner_window_; | |
| 70 HFONT default_font_; | |
| 71 mutable HFONT font_; | |
| 72 | |
| 73 bool bold_; | |
| 74 bool italic_; | |
| 75 bool underline_; | |
| 76 COLORREF text_color_; | |
| 77 int text_size_; | |
| 78 CString url_; | |
| 79 }; | |
| 80 | |
| 81 #endif // OMAHA_UI_UILIB_NODE_STATE_H_ | |
| OLD | NEW |