VDBInstructionsAndSourcePresenter.st
changeset 77 163d914fae79
child 78 5b61031de9a7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VDBInstructionsAndSourcePresenter.st	Fri Jun 22 20:10:16 2018 +0100
@@ -0,0 +1,86 @@
+"
+jv:vdb - Visual / VM Debugger
+Copyright (C) 2015-now Jan Vrany
+
+This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
+
+You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
+"
+"{ Package: 'jv:vdb' }"
+
+"{ NameSpace: Smalltalk }"
+
+VDBAbstractPresenter subclass:#VDBInstructionsAndSourcePresenter
+	instanceVariableNames:'instructionsAndSource'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'VDB-Presentation'
+!
+
+!VDBInstructionsAndSourcePresenter class methodsFor:'documentation'!
+
+copyright
+"
+jv:vdb - Visual / VM Debugger
+Copyright (C) 2015-now Jan Vrany
+
+This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
+
+You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
+"
+! !
+
+!VDBInstructionsAndSourcePresenter methodsFor:'accessing'!
+
+subject
+    "Return an instance of GDB object that this presenter displays."
+
+    ^ instructionsAndSource
+
+    "Created: / 22-06-2018 / 15:10:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBInstructionsAndSourcePresenter methodsFor:'initialization'!
+
+setInstructionsAndSource: aGDBInstructionsAndSourceLine
+    instructionsAndSource := aGDBInstructionsAndSourceLine
+
+    "Created: / 22-06-2018 / 12:40:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBInstructionsAndSourcePresenter methodsFor:'protocol-accessing'!
+
+fetchChildren
+    ^ instructionsAndSource instructions collect:[ :i | VDBInstructionPresenter new setInstruction: i; parent: self ]
+
+    "Created: / 22-06-2018 / 12:19:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+label
+    ^ instructionsAndSource file, ':  ', instructionsAndSource line printString
+
+    "Created: / 22-06-2018 / 12:22:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBInstructionsAndSourcePresenter methodsFor:'protocol-displaying'!
+
+displayLabel:aLabel h:lH on:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected
+    | color |
+
+    color := aGC paint.
+    aGC paint: Color gray.
+    [
+       super displayLabel:aLabel h:lH on:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected
+    ] ensure:[ 
+        aGC paint: color.
+    ].
+
+    "Created: / 22-06-2018 / 15:12:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBInstructionsAndSourcePresenter methodsFor:'testing'!
+
+isInstructionsAndSourcePresenter
+    ^ true
+! !
+