| 1 |
|
| 2 |
require "modeline.rb" |
| 3 |
|
| 4 |
module Edmaru |
| 5 |
|
| 6 |
#Abstract class to implement system specific window. |
| 7 |
module Window |
| 8 |
|
| 9 |
#Construct a window instance. |
| 10 |
# |
| 11 |
#=== Arguments |
| 12 |
#_view_ :: The parent view. |
| 13 |
#_x_ :: The left edge position in the parent view. |
| 14 |
#_y_ :: The top edge position in the parent view. |
| 15 |
#_col_ :: The max column size allocated for this window. |
| 16 |
#_row_ :: The max line size allocated for this window including |
| 17 |
#ModeLine's line size (usually 1). |
| 18 |
# |
| 19 |
#=== Warning |
| 20 |
#This method *MUST* *NOT* be overrided in derived classes. |
| 21 |
# |
| 22 |
#=== Return |
| 23 |
#An initialized instance of Window. |
| 24 |
def initialize(view, x, y, col, row) |
| 25 |
@view = view |
| 26 |
init_ui(x, y, col, row - 1) |
| 27 |
|
| 28 |
#Creating modeline bar. |
| 29 |
@modeline = Edmaru::modeline_class.new(self, x, y + row - 1, col) |
| 30 |
element = ModeLineElement.new("buffer-name", -1, 1, 1,"*scratch#{$count}*") |
| 31 |
@modeline.add_element(element) |
| 32 |
@modeline.show_element("buffer-name") |
| 33 |
end |
| 34 |
|
| 35 |
#The system specific initialization for this window. |
| 36 |
# |
| 37 |
#=== Arguments |
| 38 |
#_x_ :: The left edge position in the parent view. |
| 39 |
#_y_ :: The top edge position in the parent view. |
| 40 |
#_col_ :: The max column size allocated for this window. |
| 41 |
#_row_ :: The max line size allocated for this window excluding |
| 42 |
#ModeLine's line size (usually 1). |
| 43 |
# |
| 44 |
#=== Warning |
| 45 |
#This method *SHOULD* be overrided in derived classes. |
| 46 |
#And it *MUST* *NOT* deal with anything about modeline bar. |
| 47 |
def init_ui(x, y, col, row) |
| 48 |
end |
| 49 |
|
| 50 |
def show |
| 51 |
end |
| 52 |
|
| 53 |
def move(x, y) |
| 54 |
end |
| 55 |
|
| 56 |
def resize(w, h) |
| 57 |
end |
| 58 |
|
| 59 |
def refresh |
| 60 |
end |
| 61 |
|
| 62 |
#Terminate this view instance. |
| 63 |
# |
| 64 |
#=== Warning |
| 65 |
#This method *MUST* *NOT* be overrided in derived classes. |
| 66 |
def terminate |
| 67 |
@modeline.terminate |
| 68 |
|
| 69 |
terminate_ui |
| 70 |
end |
| 71 |
|
| 72 |
#Free system specific resources. |
| 73 |
# |
| 74 |
#=== Warning |
| 75 |
#This method *SHOULD* be overrided in derived classes. |
| 76 |
def terminate_ui |
| 77 |
end |
| 78 |
end |
| 79 |
end |