void NativeButton::SetLabel(const std::wstring& label)
    {
        label_ = label;

        // Even though we create a flipped HWND for a native button when the locale
        // is right-to-left, Windows does not render text for the button using a
        // right-to-left context (perhaps because the parent HWND is not flipped).
        // The result is that RTL strings containing punctuation marks are not
        // displayed properly. For example, the string "...ABC" (where A, B and C are
        // Hebrew characters) is displayed as "ABC..." which is incorrect.
        //
        // In order to overcome this problem, we mark the localized Hebrew strings as
        // RTL strings explicitly (using the appropriate Unicode formatting) so that
        // Windows displays the text correctly regardless of the HWND hierarchy.
        std::wstring localized_label;
        if(base::AdjustStringForLocaleDirection(label_, &localized_label))
        {
            label_ = localized_label;
        }

        if(native_wrapper_)
        {
            native_wrapper_->UpdateLabel();
        }

        // Update the accessible name whenever the label changes.
        SetAccessibleName(label);
        PreferredSizeChanged();
    }
Beispiel #2
0
 void Label::SetFont(const gfx::Font& font)
 {
     font_ = font;
     text_size_valid_ = false;
     PreferredSizeChanged();
     SchedulePaint();
 }
Beispiel #3
0
 void Label::SetText(const std::wstring& text)
 {
     text_ = text;
     text_size_valid_ = false;
     PreferredSizeChanged();
     SchedulePaint();
 }
Beispiel #4
0
 void Listbox::ModelChanged()
 {
     if(native_wrapper_)
     {
         native_wrapper_->UpdateFromModel();
     }
     PreferredSizeChanged();
 }
 void NativeButton::SetNeedElevation(bool need_elevation)
 {
     need_elevation_ = need_elevation;
     if(native_wrapper_)
     {
         native_wrapper_->UpdateLabel();
     }
     PreferredSizeChanged();
 }
 void NativeButton::SetAppearsAsDefault(bool appears_as_default)
 {
     is_default_ = appears_as_default;
     if(native_wrapper_)
     {
         native_wrapper_->UpdateDefault();
     }
     PreferredSizeChanged();
 }
Beispiel #7
0
 void Label::SetHasFocusBorder(bool has_focus_border)
 {
     has_focus_border_ = has_focus_border;
     if(is_multi_line_)
     {
         text_size_valid_ = false;
         PreferredSizeChanged();
     }
 }
Beispiel #8
0
 void Label::SetAllowCharacterBreak(bool allow_character_break)
 {
     if(allow_character_break != allow_character_break_)
     {
         allow_character_break_ = allow_character_break;
         text_size_valid_ = false;
         PreferredSizeChanged();
         SchedulePaint();
     }
 }
Beispiel #9
0
 void Label::SetMultiLine(bool multi_line)
 {
     DCHECK(!multi_line || !elide_in_middle_);
     if(multi_line != is_multi_line_)
     {
         is_multi_line_ = multi_line;
         text_size_valid_ = false;
         PreferredSizeChanged();
         SchedulePaint();
     }
 }
Beispiel #10
0
 void Label::SetElideInMiddle(bool elide_in_middle)
 {
     DCHECK(!elide_in_middle || !is_multi_line_);
     if(elide_in_middle != elide_in_middle_)
     {
         elide_in_middle_ = elide_in_middle;
         text_size_valid_ = false;
         PreferredSizeChanged();
         SchedulePaint();
     }
 }
Beispiel #11
0
 void ToggleImageButton::SetImage(ButtonState state, const SkBitmap* image)
 {
     if(toggled_)
     {
         alternate_images_[state] = image ? *image : SkBitmap();
     }
     else
     {
         images_[state] = image ? *image : SkBitmap();
         if(state_ == state)
         {
             SchedulePaint();
         }
     }
     PreferredSizeChanged();
 }
Beispiel #12
0
 void ImageView::SetImageSize(const gfx::Size& image_size)
 {
     image_size_set_ = true;
     image_size_ = image_size;
     PreferredSizeChanged();
 }
Beispiel #13
0
 void ImageView::SetImage(const SkBitmap& bm)
 {
     image_ = bm;
     PreferredSizeChanged();
     SchedulePaint();
 }
 void NativeViewHost::SetPreferredSize(const gfx::Size& size)
 {
     preferred_size_ = size;
     PreferredSizeChanged();
 }
Beispiel #15
0
 void ImageButton::SetImage(ButtonState aState, const SkBitmap* anImage)
 {
     images_[aState] = anImage ? *anImage : SkBitmap();
     PreferredSizeChanged();
 }