Sha256: ef5555dce87e65a8fba96f1ac6d0b28e8ee1815efcee1dd8ae79506648490d0a
Contents?: true
Size: 1.51 KB
Versions: 4
Compression:
Stored size: 1.51 KB
Contents
# # This module handles all sorts of things related to fonts # and text attributes # module UnderOs::UI class Style module Fonts def fontFamily end def fontFamily=(value) @view.font = @view.font.fontWithName(value) end def fontSize end def fontSize=(value) @view.font = @view.font.fontWithSize(value) @view.sizeToFit if @type == :icon end def textAlign if @view.is_a?(UIButton) BUTTONS_ALIGMENTS_MAP.key(@view.contentHorizontalAlignment) elsif @view.respond_to?(:textAlignment) TEXTNODES_ALIGMENTS_MAP.key(@view.textAlignment) end end def textAlign=(value) if @view.is_a?(UIButton) @view.contentHorizontalAlignment = BUTTONS_ALIGMENTS_MAP[value.to_s] || BUTTONS_ALIGMENTS_MAP['left'] elsif @view.respond_to?(:textAlignment) @view.textAlignment = TEXTNODES_ALIGMENTS_MAP[value.to_s] || BUTTONS_ALIGMENTS_MAP['left'] end end BUTTONS_ALIGMENTS_MAP = { 'right' => UIControlContentHorizontalAlignmentRight, 'center' => UIControlContentHorizontalAlignmentCenter, 'justify' => UIControlContentHorizontalAlignmentFill, 'left' => UIControlContentHorizontalAlignmentLeft } TEXTNODES_ALIGMENTS_MAP = { 'right' => NSTextAlignmentRight, 'center' => NSTextAlignmentCenter, 'justify' => NSTextAlignmentJustified, 'left' => NSTextAlignmentLeft } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
under-os-1.3.0 | lib/under_os/ui/style/fonts.rb |
under-os-1.2.1 | lib/under_os/ui/style/fonts.rb |
under-os-1.2.0 | lib/under_os/ui/style/fonts.rb |
under-os-1.1.0 | lib/under_os/ui/style/fonts.rb |