Class: Vedeu::Interfaces::Interface

Inherits:
Object
  • Object
show all
Includes:
Presentation, Repositories::Model, Toggleable
Defined in:
lib/vedeu/interfaces/interface.rb,
lib/vedeu/interfaces/repository.rb

Overview

Interfaces

Instance Attribute Summary collapse

Attributes included from Toggleable

#visible

Attributes included from Repositories::Model

#repository

Instance Method Summary collapse

Methods included from Toggleable

included, #toggle

Methods included from Presentation

#to_s

Methods included from Presentation::Styles

#render_style, #style, #style=

Methods included from Common

#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?

Methods included from Presentation::Position

#position, #position=, #position?, #render_position, #x, #y

Methods included from Presentation::Colour

#background, #background=, #colour, #colour=, #colour?, #foreground, #foreground=, #named_colour, #named_colour?, #parent_colour, #parent_colour?, #render_colour

Methods included from Repositories::Model

included, #store

Constructor Details

#initialize(attributes = {}) ⇒ Vedeu::Interfaces::Interface

Return a new instance of Vedeu::Interfaces::Interface.

Parameters:

  • attributes (Hash) (defaults to: {})

Options Hash (attributes):



70
71
72
73
74
# File 'lib/vedeu/interfaces/interface.rb', line 70

def initialize(attributes = {})
  defaults.merge!(attributes).each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#clientFixnum|Float

Returns:

  • (Fixnum|Float)


18
19
20
# File 'lib/vedeu/interfaces/interface.rb', line 18

def client
  @client
end

#cursor_visibleBoolean Also known as: cursor_visible?

Returns:



22
23
24
# File 'lib/vedeu/interfaces/interface.rb', line 22

def cursor_visible
  @cursor_visible
end

#delayFixnum|Float

Returns:

  • (Fixnum|Float)


27
28
29
# File 'lib/vedeu/interfaces/interface.rb', line 27

def delay
  @delay
end

#editableBoolean Also known as: editable?

Returns:



31
32
33
# File 'lib/vedeu/interfaces/interface.rb', line 31

def editable
  @editable
end

#groupSymbol|String

Returns:

  • (Symbol|String)


36
37
38
# File 'lib/vedeu/interfaces/interface.rb', line 36

def group
  @group
end

#nameString

Returns:

  • (String)


40
41
42
# File 'lib/vedeu/interfaces/interface.rb', line 40

def name
  @name
end

#parentVedeu::Views::Composition



44
45
46
# File 'lib/vedeu/interfaces/interface.rb', line 44

def parent
  @parent
end

#wordwrapBoolean

Returns:



48
49
50
# File 'lib/vedeu/interfaces/interface.rb', line 48

def wordwrap
  @wordwrap
end

#zindexFixnum

Returns:

  • (Fixnum)


52
53
54
# File 'lib/vedeu/interfaces/interface.rb', line 52

def zindex
  @zindex
end

Instance Method Details

#attributesHash<Symbol => void>

Returns:

  • (Hash<Symbol => void>)


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/vedeu/interfaces/interface.rb', line 77

def attributes
  {
    client:         client,
    colour:         colour,
    cursor_visible: cursor_visible,
    delay:          delay,
    editable:       editable,
    group:          group,
    name:           name,
    parent:         parent,
    repository:     repository,
    style:          style,
    visible:        visible,
    wordwrap:       wordwrap,
    zindex:         zindex,
  }
end

#defaultsHash<Symbol => void> (private)

The default options/attributes for a new instance of this class.

Returns:

  • (Hash<Symbol => void>)


150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/vedeu/interfaces/interface.rb', line 150

def defaults
  {
    client:         nil,
    colour:         Vedeu.config.colour,
    cursor_visible: true,
    delay:          0.0,
    editable:       false,
    group:          '',
    name:           '',
    parent:         nil,
    repository:     Vedeu.interfaces,
    style:          :normal,
    visible:        true,
    wordwrap:       true,
    zindex:         0,
  }
end

#deputy(client = nil) ⇒ Vedeu::Interfaces::DSL

Returns a DSL instance responsible for defining the DSL methods of this model.

Parameters:

  • client (Object|NilClass) (defaults to: nil)

    The client binding represents the client application object that is currently invoking a DSL method. It is required so that we can send messages to the client application object should we need to.

Returns:



104
105
106
# File 'lib/vedeu/interfaces/interface.rb', line 104

def deputy(client = nil)
  Vedeu::Interfaces::DSL.new(self, client)
end

#hidevoid

This method returns an undefined value.

Hide the named interface.

Will hide the named interface. If the interface is currently visible, it will be cleared- rendered blank. To show the interface, the ‘:show_interface’ event should be triggered. Triggering the ‘:hide_group’ event to which this named interface belongs will also hide the interface.

Examples:

Vedeu.trigger(:_hide_interface_, name)
Vedeu.hide_interface(name)


121
122
123
124
125
# File 'lib/vedeu/interfaces/interface.rb', line 121

def hide
  super

  Vedeu.trigger(:_clear_view_, name)
end

#showvoid

This method returns an undefined value.

Show the named interface.

Will show the named interface. If the interface is currently visible, it will be refreshed- showing any new content available. To hide the interface, the ‘:hide_interface’ event should be triggered. Triggering the ‘:show_group’ event to which this named interface belongs will also show the interface.

Examples:

Vedeu.trigger(:_show_interface_, name)
Vedeu.show_interface(name)


141
142
143
144
145
# File 'lib/vedeu/interfaces/interface.rb', line 141

def show
  super

  Vedeu.trigger(:_refresh_view_, name)
end