Class: JLDrill::DisplayProblemContext::ProblemView

Inherits:
Context::View
  • Object
show all
Defined in:
lib/jldrill/contexts/DisplayProblemContext.rb

Direct Known Subclasses

Gtk::ProblemView, Test::ProblemView

Defined Under Namespace

Classes: ItemHintView

Instance Attribute Summary collapse

Attributes inherited from Context::View

#context

Instance Method Summary collapse

Methods inherited from Context::View

#addView, #getWidget, #removeView

Constructor Details

#initialize(context) ⇒ ProblemView

Returns a new instance of ProblemView.



42
43
44
45
# File 'lib/jldrill/contexts/DisplayProblemContext.rb', line 42

def initialize(context)
    super(context)
    @itemHints = context.viewBridge.ItemHintView.new(context)
end

Instance Attribute Details

#itemHintsObject (readonly)

Returns the value of attribute itemHints.



40
41
42
# File 'lib/jldrill/contexts/DisplayProblemContext.rb', line 40

def itemHints
  @itemHints
end

Instance Method Details

#newProblem(problem) ⇒ Object

A new problem has been added



58
59
60
61
# File 'lib/jldrill/contexts/DisplayProblemContext.rb', line 58

def newProblem(problem)
    itemHints.newProblem(problem)
    # Define the rest in the concrete class
end

#removingViewFrom(parent) ⇒ Object

Modify the removingViewFrom hook to remove the ItemHintView



53
54
55
# File 'lib/jldrill/contexts/DisplayProblemContext.rb', line 53

def removingViewFrom(parent)
    self.removeView(@itemHints)
end

#showAnswerObject

Show the answer to the problem



70
71
72
# File 'lib/jldrill/contexts/DisplayProblemContext.rb', line 70

def showAnswer
    # Should be overridden in the concrete class
end

#showBusy(bool) ⇒ Object

Show the busy cursor in the UI if bool is true. This happens during a long event where the user can’t interact with the window



77
78
79
# File 'lib/jldrill/contexts/DisplayProblemContext.rb', line 77

def showBusy(bool)
    # Please define in the concrete class
end

#updateProblem(problem) ⇒ Object

The current problem has changed and needs updating



64
65
66
67
# File 'lib/jldrill/contexts/DisplayProblemContext.rb', line 64

def updateProblem(problem)
    itemHints.updateProblem(problem)
    # Define the rest in the concrete class
end

#viewAddedTo(parent) ⇒ Object

Modify the viewAddedTo hook to add the ItemHintView



48
49
50
# File 'lib/jldrill/contexts/DisplayProblemContext.rb', line 48

def viewAddedTo(parent)
    self.addView(@itemHints)
end