Develop and Download Open Source Software

Browse Subversion Repository

Contents of /window.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (show annotations) (download)
Sat Apr 7 14:27:59 2007 UTC (16 years, 11 months ago) by bluedwarf
File size: 2392 byte(s)
Changes around the windows' initialization.

1 # window.rb: the module definition of Edmaru::Window.
2 #
3 # Copyright (C) 2007 Takashi Nakamoto
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 # 02110-1301 USA.
18 #
19
20 require "cursor.rb"
21 require "modeline.rb"
22
23 module Edmaru
24
25 #Abstract class to implement system specific window.
26 module Window
27
28 #Construct a window instance.
29 #
30 #=== Arguments
31 #_view_ :: The parent view.
32 #
33 #=== Warning
34 #This method *MUST* *NOT* be overrided in derived classes.
35 #
36 #=== Return
37 #An initialized instance of Window.
38 def initialize(view)
39 @view = view
40 @cursor = Cursor.new(0, 0)
41 @modeline = Edmaru::modeline_class.new(self)
42
43 init_ui
44 end
45
46 #The system specific initialization for this window.
47 #
48 #=== Warning
49 #This method *SHOULD* be overrided in derived classes.
50 def init_ui
51 end
52
53 #Discard the current buffer and set the specified new buffer.
54 #
55 #=== Argument
56 #_new_buffer_ :: The buffer to be shown in this window.
57 def buffer=(new_buffer)
58 if @buffer != nil
59 @buffer.unlink(self)
60 end
61
62 #Linked buffer to this window.
63 @buffer = new_buffer
64 @buffer.link(self)
65 refresh
66 end
67
68 def buffer
69 @buffer
70 end
71
72 def modeline
73 @modeline
74 end
75
76 #Redraw this window.
77 #
78 #=== Warning
79 #This method *SHOULD* be overrided in derived clases.
80 def refresh
81 if @buffer == nil
82 return
83 end
84 end
85
86 #Terminate this view instance.
87 #
88 #=== Warning
89 #This method *MUST* *NOT* be overrided in derived classes.
90 def terminate
91 @modeline.terminate
92
93 terminate_ui
94 end
95
96 #Free system specific resources.
97 #
98 #=== Warning
99 #This method *SHOULD* be overrided in derived classes.
100 def terminate_ui
101 end
102 end
103 end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26