lib/shoes/swt/app.rb in shoes-swt-4.0.0.pre4 vs lib/shoes/swt/app.rb in shoes-swt-4.0.0.pre5
- old
+ new
@@ -22,11 +22,12 @@
attr_reader :dsl, :real, :shell, :click_listener
def initialize(dsl)
@dsl = dsl
::Swt::Widgets::Display.app_name = @dsl.app_title
- @background = Color.new(@dsl.opts[:background])
+ @background = Color.new(@dsl.opts[:background] ||
+ ::Shoes::COLORS.fetch(:system_background))
@started = false
initialize_shell
initialize_real
::Shoes::Swt.register self
attach_event_listeners
@@ -40,11 +41,10 @@
return if ::Shoes::Swt.main_app.disposed? || @shell.disposed?
@shell.pack
force_shell_size
@shell.open
- @dsl.top_slot.contents_alignment
@started = true
self.fullscreen = true if dsl.start_as_fullscreen?
flush
::Swt.event_loop { ::Shoes::Swt.main_app.disposed? } if main_app?
end
@@ -151,10 +151,18 @@
until @shell.isDisposed
::Swt.display.sleep unless ::Swt.display.readAndDispatch
end
end
+ def self.setup_system_colors
+ # just one color for now
+ background_color = Shoes.display.getSystemColor(::Swt::SWT::COLOR_WIDGET_BACKGROUND)
+ ::Shoes::DSL.define_shoes_color(:system_background, background_color.red,
+ background_color.green,
+ background_color.blue)
+ end
+
private
def initialize_scroll_bar
scroll_bar = @shell.vertical_bar
scroll_bar.increment = 10
@@ -189,9 +197,10 @@
def main_window_style
style = ::Swt::SWT::CLOSE | ::Swt::SWT::MIN | ::Swt::SWT::V_SCROLL
style |= ::Swt::SWT::RESIZE | ::Swt::SWT::MAX if @dsl.opts[:resizable]
style |= ::Swt::SWT::APPLICATION_MODAL if @dsl.opts[:modal]
+ style |= ::Swt::SWT::ON_TOP if @dsl.opts[:always_on_top]
style
end
def initialize_shell
@image = ::Swt::Graphics::Image.new(::Swt.display, ICON)