Class: Context::Gtk::Widget

Inherits:
Widget show all
Defined in:
lib/Context/Gtk/Widget.rb

Instance Attribute Summary collapse

Attributes inherited from Widget

#delegate

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Widget

#addedTo, #eql?, #removedFrom

Constructor Details

#initialize(delegate) ⇒ Widget

Returns a new instance of Widget.



18
19
20
21
22
23
24
# File 'lib/Context/Gtk/Widget.rb', line 18

def initialize(delegate)
    super(delegate)
    @mainWindow = nil
    # Packing hints for the container
    @expandHeight = false
    @expandWidth = false
end

Instance Attribute Details

#expandHeightObject

Returns the value of attribute expandHeight.



7
8
9
# File 'lib/Context/Gtk/Widget.rb', line 7

def expandHeight
  @expandHeight
end

#expandWidthObject

Returns the value of attribute expandWidth.



7
8
9
# File 'lib/Context/Gtk/Widget.rb', line 7

def expandWidth
  @expandWidth
end

#mainWindowObject

Returns the value of attribute mainWindow.



7
8
9
# File 'lib/Context/Gtk/Widget.rb', line 7

def mainWindow
  @mainWindow
end

Class Method Details

.inTestsObject

Redefine this in tests so that the widgets don’t get displayed on the screen.



13
14
15
# File 'lib/Context/Gtk/Widget.rb', line 13

def inTests
    false
end

Instance Method Details

#add(widget) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/Context/Gtk/Widget.rb', line 30

def add(widget)
 		    if !widget.delegate.class.ancestors.include?(Gtk::Window)
  		    widget.mainWindow = @mainWindow
  			@delegate.add(widget.delegate)
  			if !Widget.inTests
          		@delegate.show_all
              end
  	    else
  	        widget.isAMainWindow
  	        widget.delegate.set_transient_for(@mainWindow)
  	        if !Widget.inTests
      		    widget.delegate.show_all
      		end
  	    end
end

#isAMainWindowObject



26
27
28
# File 'lib/Context/Gtk/Widget.rb', line 26

def isAMainWindow
    @mainWindow = @delegate
end

#remove(widget) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/Context/Gtk/Widget.rb', line 46

def remove(widget)
    widget.mainWindow = nil
 if !widget.delegate.class.ancestors.include?(Gtk::Window)   
        @delegate.remove(widget.delegate)
        if !Widget.inTests
            @delegate.show_all
        end
    end
    @delegate.grab_focus
end