Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / views / controls / label.h
index 979810c..17251f3 100644 (file)
@@ -43,10 +43,12 @@ class VIEWS_EXPORT Label : public View {
   };
 
   enum ElideBehavior {
-    NO_ELIDE,         // Do not elide the label text; truncate as needed.
-    ELIDE_IN_MIDDLE,  // Add ellipsis in the middle of the string as needed.
-    ELIDE_AT_END,     // Add ellipsis at the end of the string as needed.
-    ELIDE_AS_EMAIL,   // Elide while retaining username/domain chars as needed.
+    NO_ELIDE,            // Do not elide the label text; truncate as needed.
+    ELIDE_AT_BEGINNING,  // Add ellipsis at the start of the string as needed.
+    ELIDE_IN_MIDDLE,     // Add ellipsis in the middle of the string as needed.
+    ELIDE_AT_END,        // Add ellipsis at the end of the string as needed.
+    ELIDE_AS_EMAIL,      // Elide while retaining username/domain chars
+                         // as needed.
   };
 
   // Internal class name.
@@ -92,6 +94,9 @@ class VIEWS_EXPORT Label : public View {
   // Sets the drop shadow's offset from the text.
   void SetShadowOffset(int x, int y);
 
+  // Sets the shadow blur. Default is zero.
+  void set_shadow_blur(double shadow_blur) { shadow_blur_ = shadow_blur; }
+
   // Disables shadows.
   void ClearEmbellishing();
 
@@ -130,6 +135,14 @@ class VIEWS_EXPORT Label : public View {
   bool is_multi_line() const { return is_multi_line_; }
   void SetMultiLine(bool multi_line);
 
+  // Get or set if the label text should be obscured before rendering (e.g.
+  // should "Password!" display as "*********"); default is false.
+  bool is_obscured() const { return is_obscured_; }
+  void SetObscured(bool obscured);
+
+  // Get the text as displayed to the user, respecting the 'obscured' flag.
+  const base::string16& layout_text() const { return layout_text_; }
+
   // Sets whether the label text can be split on words.
   // Default is false. This only works when is_multi_line is true.
   void SetAllowCharacterBreak(bool allow_character_break);
@@ -173,7 +186,7 @@ class VIEWS_EXPORT Label : public View {
   virtual const char* GetClassName() const OVERRIDE;
   virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) OVERRIDE;
   virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE;
-  virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
+  virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
   // Gets the tooltip text for labels that are wider than their bounds, except
   // when the label is multiline, in which case it just returns false (no
   // tooltip).  If a custom tooltip has been specified with SetTooltipText()
@@ -211,6 +224,10 @@ class VIEWS_EXPORT Label : public View {
   // Calls ComputeDrawStringFlags().
   FRIEND_TEST_ALL_PREFIXES(LabelTest, DisableSubpixelRendering);
 
+  // Sets both |text_| and |layout_text_| to appropriate values, taking
+  // the label's 'obscured' status into account.
+  void SetTextInternal(const base::string16& text);
+
   void Init(const base::string16& text, const gfx::FontList& font_list);
 
   void RecalculateColors();
@@ -237,6 +254,7 @@ class VIEWS_EXPORT Label : public View {
   bool ShouldShowDefaultTooltip() const;
 
   base::string16 text_;
+  base::string16 layout_text_;
   gfx::FontList font_list_;
   SkColor requested_enabled_color_;
   SkColor actual_enabled_color_;
@@ -252,8 +270,11 @@ class VIEWS_EXPORT Label : public View {
   bool auto_color_readability_;
   mutable gfx::Size text_size_;
   mutable bool text_size_valid_;
+  // Indicates the level of shadow blurring. Default is zero.
+  double shadow_blur_;
   int line_height_;
   bool is_multi_line_;
+  bool is_obscured_;
   bool allow_character_break_;
   ElideBehavior elide_behavior_;
   gfx::HorizontalAlignment horizontal_alignment_;