wxruby-ruby19 1.9.8-x86-darwin-9 → 1.9.10-x86-darwin-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +53 -0
- data/README +297 -0
- data/lib/wx.rb +2 -2
- data/lib/wx/accessors.rb +7 -1
- data/lib/wx/classes/app.rb +10 -4
- data/lib/wx/classes/bitmap.rb +29 -1
- data/lib/wx/classes/clipboard.rb +19 -3
- data/lib/wx/classes/colour.rb +6 -4
- data/lib/wx/classes/data_object.rb +14 -0
- data/lib/wx/classes/data_object_simple.rb +6 -0
- data/lib/wx/classes/dataformat.rb +23 -0
- data/lib/wx/classes/evthandler.rb +79 -4
- data/lib/wx/classes/genericdirctrl.rb +36 -0
- data/lib/wx/classes/grid.rb +8 -0
- data/lib/wx/classes/hboxsizer.rb +6 -0
- data/lib/wx/classes/icon.rb +12 -1
- data/lib/wx/classes/image.rb +13 -1
- data/lib/wx/classes/listctrl.rb +12 -0
- data/lib/wx/classes/point.rb +8 -0
- data/lib/wx/classes/rect.rb +10 -1
- data/lib/wx/classes/richtextctrl.rb +63 -0
- data/lib/wx/classes/size.rb +9 -0
- data/lib/wx/classes/sizer.rb +18 -3
- data/lib/wx/classes/standardpaths.rb +9 -0
- data/lib/wx/classes/texturlevent.rb +14 -2
- data/lib/wx/classes/toolbar.rb +4 -6
- data/lib/wx/classes/vboxsizer.rb +6 -0
- data/lib/wx/classes/window.rb +7 -0
- data/lib/wx/classes/xmlresource.rb +17 -0
- data/lib/wx/helpers.rb +16 -1
- data/lib/wx/keyword_ctors.rb +3 -2
- data/lib/wx/keyword_defs.rb +56 -5
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.bundle +0 -0
- data/samples/SAMPLES-LICENSE.TXT +18 -0
- data/samples/aui/aui.rb +1356 -0
- data/samples/bigdemo/About.rbw +39 -0
- data/samples/bigdemo/ColorPanel.rbw +23 -0
- data/samples/bigdemo/GridSimple.rbw +78 -0
- data/samples/bigdemo/MDIDemo.rbw +57 -0
- data/samples/bigdemo/PopupMenu.rbw +149 -0
- data/samples/bigdemo/ShapedWindow.rbw +131 -0
- data/samples/bigdemo/Sizers.rbw +543 -0
- data/samples/bigdemo/bigdemo.rb +823 -0
- data/samples/bigdemo/demoTemplate.rbw +33 -0
- data/samples/bigdemo/helpfile.htb +0 -0
- data/samples/bigdemo/icons/Test 015.jpg +0 -0
- data/samples/bigdemo/icons/Test 015.png +0 -0
- data/samples/bigdemo/icons/choice.bmp +0 -0
- data/samples/bigdemo/icons/choice.xpm +27 -0
- data/samples/bigdemo/icons/combo.bmp +0 -0
- data/samples/bigdemo/icons/combo.xpm +27 -0
- data/samples/bigdemo/icons/copy.xpm +25 -0
- data/samples/bigdemo/icons/cut.xpm +24 -0
- data/samples/bigdemo/icons/gauge.bmp +0 -0
- data/samples/bigdemo/icons/gauge.xpm +27 -0
- data/samples/bigdemo/icons/help.xpm +25 -0
- data/samples/bigdemo/icons/list.bmp +0 -0
- data/samples/bigdemo/icons/list.xpm +27 -0
- data/samples/bigdemo/icons/mondrian.ico +0 -0
- data/samples/bigdemo/icons/mondrian.xpm +44 -0
- data/samples/bigdemo/icons/new.xpm +24 -0
- data/samples/bigdemo/icons/ogl.ico +0 -0
- data/samples/bigdemo/icons/ogl.xpm +45 -0
- data/samples/bigdemo/icons/open.xpm +26 -0
- data/samples/bigdemo/icons/paste.bmp +0 -0
- data/samples/bigdemo/icons/paste.xpm +38 -0
- data/samples/bigdemo/icons/pointy.png +0 -0
- data/samples/bigdemo/icons/preview.xpm +26 -0
- data/samples/bigdemo/icons/print.xpm +26 -0
- data/samples/bigdemo/icons/radio.bmp +0 -0
- data/samples/bigdemo/icons/radio.xpm +27 -0
- data/samples/bigdemo/icons/robert.xpm +415 -0
- data/samples/bigdemo/icons/ruby.png +0 -0
- data/samples/bigdemo/icons/sashtest.ico +0 -0
- data/samples/bigdemo/icons/save.xpm +25 -0
- data/samples/bigdemo/icons/smiles.bmp +0 -0
- data/samples/bigdemo/icons/smiles.xpm +39 -0
- data/samples/bigdemo/icons/smiley.ico +0 -0
- data/samples/bigdemo/icons/smiley.xpm +42 -0
- data/samples/bigdemo/icons/stattext.xpm +24 -0
- data/samples/bigdemo/icons/test2.bmp +0 -0
- data/samples/bigdemo/icons/test2.png +0 -0
- data/samples/bigdemo/icons/test2.xpm +79 -0
- data/samples/bigdemo/icons/text.bmp +0 -0
- data/samples/bigdemo/icons/text.xpm +27 -0
- data/samples/bigdemo/icons/tog1.bmp +0 -0
- data/samples/bigdemo/icons/tog1.xpm +38 -0
- data/samples/bigdemo/icons/tog2.bmp +0 -0
- data/samples/bigdemo/icons/tog2.xpm +38 -0
- data/samples/bigdemo/icons/wxwin.ico +0 -0
- data/samples/bigdemo/icons/wxwin16x16.png +0 -0
- data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
- data/samples/bigdemo/icons/wxwin32x32.png +0 -0
- data/samples/bigdemo/icons/wxwin48x48.png +0 -0
- data/samples/bigdemo/run.rb +90 -0
- data/samples/bigdemo/tips.txt +7 -0
- data/samples/bigdemo/utils.rb +12 -0
- data/samples/bigdemo/wxArtProvider.rbw +281 -0
- data/samples/bigdemo/wxBitmapButton.rbw +65 -0
- data/samples/bigdemo/wxButton.rbw +64 -0
- data/samples/bigdemo/wxCalendarCtrl.rbw +60 -0
- data/samples/bigdemo/wxCheckBox.rbw +50 -0
- data/samples/bigdemo/wxCheckListBox.rbw +65 -0
- data/samples/bigdemo/wxChoice.rbw +47 -0
- data/samples/bigdemo/wxChoicebook.rbw +78 -0
- data/samples/bigdemo/wxColourDialog.rbw +31 -0
- data/samples/bigdemo/wxComboBox.rbw +77 -0
- data/samples/bigdemo/wxCursor.rbw +136 -0
- data/samples/bigdemo/wxDialog.rbw +74 -0
- data/samples/bigdemo/wxDirDialog.rbw +29 -0
- data/samples/bigdemo/wxDragImage.rbw +70 -0
- data/samples/bigdemo/wxFileDialog.rbw +37 -0
- data/samples/bigdemo/wxFileDialog_Save.rbw +35 -0
- data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -0
- data/samples/bigdemo/wxFontDialog.rbw +173 -0
- data/samples/bigdemo/wxFrame.rbw +53 -0
- data/samples/bigdemo/wxGauge.rbw +71 -0
- data/samples/bigdemo/wxGenericDirCtrl.rbw +74 -0
- data/samples/bigdemo/wxGrid.rbw +66 -0
- data/samples/bigdemo/wxHtmlHelpController.rbw +52 -0
- data/samples/bigdemo/wxListBox.rbw +140 -0
- data/samples/bigdemo/wxListCtrl_virtual.rbw +112 -0
- data/samples/bigdemo/wxMDIWindows.rbw +50 -0
- data/samples/bigdemo/wxMenu.rbw +236 -0
- data/samples/bigdemo/wxMessageDialog.rbw +27 -0
- data/samples/bigdemo/wxMiniFrame.rbw +70 -0
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +32 -0
- data/samples/bigdemo/wxNotebook.rbw +136 -0
- data/samples/bigdemo/wxProgressDialog.rbw +43 -0
- data/samples/bigdemo/wxRadioBox.rbw +72 -0
- data/samples/bigdemo/wxRadioButton.rbw +125 -0
- data/samples/bigdemo/wxSashWindow.rbw +141 -0
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -0
- data/samples/bigdemo/wxScrolledWindow.rbw +199 -0
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -0
- data/samples/bigdemo/wxSlider.rbw +42 -0
- data/samples/bigdemo/wxSpinButton.rbw +50 -0
- data/samples/bigdemo/wxSpinCtrl.rbw +51 -0
- data/samples/bigdemo/wxSplitterWindow.rbw +63 -0
- data/samples/bigdemo/wxStaticBitmap.rbw +51 -0
- data/samples/bigdemo/wxStaticText.rbw +55 -0
- data/samples/bigdemo/wxStatusBar.rbw +126 -0
- data/samples/bigdemo/wxTextCtrl.rbw +149 -0
- data/samples/bigdemo/wxTextEntryDialog.rbw +31 -0
- data/samples/bigdemo/wxToggleButton.rbw +49 -0
- data/samples/bigdemo/wxToolBar.rbw +131 -0
- data/samples/bigdemo/wxTreeCtrl.rbw +191 -0
- data/samples/calendar/calendar.rb +256 -0
- data/samples/caret/caret.rb +282 -0
- data/samples/caret/mondrian.xpm +44 -0
- data/samples/controls/controls.rb +1136 -0
- data/samples/controls/get_item_sample.rb +87 -0
- data/samples/controls/icons/choice.xpm +27 -0
- data/samples/controls/icons/combo.xpm +27 -0
- data/samples/controls/icons/gauge.xpm +27 -0
- data/samples/controls/icons/list.xpm +27 -0
- data/samples/controls/icons/radio.xpm +27 -0
- data/samples/controls/icons/stattext.xpm +24 -0
- data/samples/controls/icons/text.xpm +27 -0
- data/samples/controls/mondrian.ico +0 -0
- data/samples/controls/mondrian.xpm +44 -0
- data/samples/controls/test2.bmp +0 -0
- data/samples/dialogs/dialogs.rb +797 -0
- data/samples/dialogs/tips.txt +18 -0
- data/samples/dragdrop/dragdrop.rb +177 -0
- data/samples/drawing/graphics_drawing.rb +235 -0
- data/samples/drawing/images.rb +37 -0
- data/samples/drawing/paperclip.png +0 -0
- data/samples/etc/activation.rb +102 -0
- data/samples/etc/choice.rb +67 -0
- data/samples/etc/miniframe.rb +79 -0
- data/samples/etc/sash.rb +130 -0
- data/samples/etc/scrollwin.rb +110 -0
- data/samples/etc/system_settings.rb +252 -0
- data/samples/etc/threaded.rb +72 -0
- data/samples/etc/toolbar_sizer_additem.rb +55 -0
- data/samples/etc/wizard.rb +74 -0
- data/samples/event/event.rb +182 -0
- data/samples/event/update_ui_event.rb +70 -0
- data/samples/grid/grid.rb +198 -0
- data/samples/grid/gridtablebase.rb +148 -0
- data/samples/html/html.rb +262 -0
- data/samples/listbook/listbook.rb +174 -0
- data/samples/listbook/listbook.xrc +370 -0
- data/samples/mdi/mdi.rb +85 -0
- data/samples/media/mediactrl.rb +167 -0
- data/samples/minimal/minimal.rb +77 -0
- data/samples/minimal/mondrian.ico +0 -0
- data/samples/minimal/mondrian.png +0 -0
- data/samples/minimal/nothing.rb +16 -0
- data/samples/opengl/cube.rb +117 -0
- data/samples/printing/mondrian.ico +0 -0
- data/samples/printing/mondrian.xpm +44 -0
- data/samples/printing/printing.rb +487 -0
- data/samples/sockets/SocketPackets.rb +27 -0
- data/samples/sockets/res/message-new.png +0 -0
- data/samples/sockets/res/user.png +0 -0
- data/samples/sockets/wxClient.rb +395 -0
- data/samples/sockets/wxServer.rb +422 -0
- data/samples/sockets/wxSocketGUI.rb +97 -0
- data/samples/text/format-text-bold.png +0 -0
- data/samples/text/format-text-italic.png +0 -0
- data/samples/text/format-text-underline.png +0 -0
- data/samples/text/mondrian.ico +0 -0
- data/samples/text/mondrian.xpm +44 -0
- data/samples/text/rich_textctrl.rb +98 -0
- data/samples/text/scintilla.rb +169 -0
- data/samples/text/textctrl.rb +111 -0
- data/samples/text/unicode.rb +242 -0
- data/samples/text/utf8.txt +15 -0
- data/samples/treectrl/icon1.xpm +79 -0
- data/samples/treectrl/icon2.xpm +53 -0
- data/samples/treectrl/icon3.xpm +79 -0
- data/samples/treectrl/icon4.xpm +43 -0
- data/samples/treectrl/icon5.xpm +79 -0
- data/samples/treectrl/treectrl.rb +1166 -0
- data/samples/xrc/samples.xrc +46 -0
- data/samples/xrc/xrc_sample.rb +76 -0
- metadata +17 -3
@@ -0,0 +1,242 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
+
begin
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
# Tell ruby this script is written in UTF-8 encoded text.
|
9
|
+
$KCODE = 'u'
|
10
|
+
|
11
|
+
# Library to get character lengths (as opposed to byte lengths) from
|
12
|
+
# Ruby strings.
|
13
|
+
require 'jcode'
|
14
|
+
|
15
|
+
require 'wx'
|
16
|
+
|
17
|
+
$utf8_file = File.join( File.dirname(__FILE__), 'utf8.txt')
|
18
|
+
|
19
|
+
class UnicodeDemoTextCtrl < Wx::TextCtrl
|
20
|
+
NEWLINE_CORRECTION_FACTOR = 0
|
21
|
+
|
22
|
+
DEFAULT_TEXT = "If you have a unicode version of wxruby, you should be able to see a range of characters from different languages displayed, and be able to type multilingual strings in the text area. Note that some scripts may only be displayed if you are using a suitable font; otherwise characters will appear as blank boxes.
|
23
|
+
|
24
|
+
" << File.read( $utf8_file )
|
25
|
+
|
26
|
+
def initialize(parent, text = DEFAULT_TEXT)
|
27
|
+
super(parent, -1, text,
|
28
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::TE_MULTILINE)
|
29
|
+
end
|
30
|
+
|
31
|
+
# run through a few useful methods of textctrl and report the results
|
32
|
+
# as a string
|
33
|
+
def report()
|
34
|
+
report = ''
|
35
|
+
sel = get_string_selection()
|
36
|
+
report << 'Selected string byte length: ' << sel.length.to_s << "\n"
|
37
|
+
report << 'Selected string character length: ' << sel.jlength.to_s << "\n"
|
38
|
+
report << 'Selected string:: ' << sel.inspect << "\n"
|
39
|
+
return report
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# A read-only text ctrl useful for displaying output
|
44
|
+
class LogTextCtrl < Wx::TextCtrl
|
45
|
+
STYLE = Wx::TE_READONLY|Wx::TE_MULTILINE
|
46
|
+
def initialize(parent)
|
47
|
+
super(parent, -1, '', Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, STYLE)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class IConvFrame < Wx::Frame
|
52
|
+
# Ruby stdlib for converting strings between encodings
|
53
|
+
begin
|
54
|
+
require 'iconv'
|
55
|
+
ICONV_LOADED = 1
|
56
|
+
rescue LoadError
|
57
|
+
end
|
58
|
+
|
59
|
+
# The encodings we're going to make importable and exportable in this
|
60
|
+
# application - see construct_import_export_menus below
|
61
|
+
ENCODINGS = { 'US ASCII' => 'ASCII',
|
62
|
+
'UTF-8' => 'UTF-8',
|
63
|
+
'UTF-16' => 'UTF-16',
|
64
|
+
'Windows Latin CP1252' => 'CP1252',
|
65
|
+
'Latin ISO-8859-1' => 'ISO-8859-1',
|
66
|
+
'Japanese SHIFT-JIS' => 'SHIFT-JIS' }
|
67
|
+
|
68
|
+
def initialize(title, pos, size)
|
69
|
+
super(nil, -1, title, pos, size)
|
70
|
+
panel = Wx::Panel.new(self)
|
71
|
+
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
|
72
|
+
|
73
|
+
sys_lang = Wx::Locale.get_system_language_name
|
74
|
+
text = Wx::StaticText.new(panel, -1, "System language: #{sys_lang}")
|
75
|
+
sizer.add(text, 0, Wx::ALL, 5)
|
76
|
+
|
77
|
+
sys_enc = Wx::Locale.get_system_encoding_name
|
78
|
+
text = Wx::StaticText.new(panel, -1, "System default encoding: #{sys_enc}")
|
79
|
+
sizer.add(text, 0, Wx::ALL, 5)
|
80
|
+
|
81
|
+
# The text input and display
|
82
|
+
@textctrl = UnicodeDemoTextCtrl.new(panel)
|
83
|
+
sizer.add(@textctrl, 3, Wx::GROW|Wx::ALL, 2)
|
84
|
+
|
85
|
+
# The button to show what's selected
|
86
|
+
button = Wx::Button.new(panel, -1, 'Describe text selection')
|
87
|
+
sizer.add(button, 0, Wx::ADJUST_MINSIZE|Wx::ALL, 2 )
|
88
|
+
evt_button(button.get_id) { | e | on_click(e) }
|
89
|
+
|
90
|
+
@log = LogTextCtrl.new(panel)
|
91
|
+
sizer.add(@log, 1, Wx::GROW|Wx::ALL, 2)
|
92
|
+
sizer.add( Wx::StaticText.new(panel, -1, 'Some controls with unicode'),
|
93
|
+
0, Wx::ADJUST_MINSIZE|Wx::ALL, 2 )
|
94
|
+
ctrl_sizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
|
95
|
+
|
96
|
+
test_button = Wx::Button.new(panel, -1, '万')
|
97
|
+
ctrl_sizer.add(test_button, 0, Wx::ADJUST_MINSIZE|Wx::ALL, 2)
|
98
|
+
choice = Wx::Choice.new(panel, -1, Wx::DEFAULT_POSITION,
|
99
|
+
Wx::DEFAULT_SIZE, [])
|
100
|
+
File.readlines($utf8_file).each do | line |
|
101
|
+
next if line.chomp.empty?
|
102
|
+
choice.append(line.chomp)
|
103
|
+
end
|
104
|
+
choice.set_selection(0)
|
105
|
+
ctrl_sizer.add(choice, 0, Wx::ADJUST_MINSIZE|Wx::ALL, 2)
|
106
|
+
|
107
|
+
sizer.add(ctrl_sizer, 0, Wx::ADJUST_MINSIZE|Wx::ALL, 2)
|
108
|
+
construct_menus()
|
109
|
+
panel.set_sizer_and_fit( sizer )
|
110
|
+
end
|
111
|
+
|
112
|
+
# Prompt the user to specify a file whose contents should be loaded
|
113
|
+
# into the text ctrl. The file should be encoded in +encoding+
|
114
|
+
def on_import_file(encoding)
|
115
|
+
fd = Wx::FileDialog.new( nil, 'Import file', "", "",
|
116
|
+
"*.*", Wx::OPEN|Wx::FILE_MUST_EXIST )
|
117
|
+
return unless fd.show_modal() == Wx::ID_OK
|
118
|
+
File.open( fd.get_path ) do | file |
|
119
|
+
import_file( file, encoding )
|
120
|
+
end
|
121
|
+
rescue Iconv::IllegalSequence
|
122
|
+
message = "The file %s does not seem to be in %s encoding " %
|
123
|
+
[ fd.get_filename, encoding ]
|
124
|
+
Wx::MessageDialog.new(self, message, 'Wrong encoding',
|
125
|
+
Wx::OK|Wx::ICON_EXCLAMATION).show_modal()
|
126
|
+
end
|
127
|
+
|
128
|
+
# Read +io+, which should be text file encoding in +source_encoding+,
|
129
|
+
# and display the contents in the textctrl.
|
130
|
+
def import_file(io, source_encoding = 'UTF-8')
|
131
|
+
case source_encoding
|
132
|
+
when /UTF-?8/
|
133
|
+
@textctrl.set_value( io.read() )
|
134
|
+
else
|
135
|
+
output = ''
|
136
|
+
Iconv.open('UTF-8', source_encoding) do | converter |
|
137
|
+
output << converter.iconv( io.read() )
|
138
|
+
output << converter.iconv(nil)
|
139
|
+
end
|
140
|
+
@textctrl.set_value( output )
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Ask the user for a file path, and then export the content of the
|
145
|
+
# textctrl to it in the encoding +encoding+
|
146
|
+
def on_export_file(encoding)
|
147
|
+
fd = Wx::FileDialog.new( nil, 'Export file', "", "",
|
148
|
+
"*.*", Wx::SAVE|Wx::OVERWRITE_PROMPT )
|
149
|
+
return unless fd.show_modal() == Wx::ID_OK
|
150
|
+
File.open( fd.get_path, 'w' ) do | file |
|
151
|
+
export_file( file, encoding )
|
152
|
+
end
|
153
|
+
rescue Iconv::IllegalSequence
|
154
|
+
message = "The text content containts characters that " <<
|
155
|
+
"cannot be encoded using %s" % encoding
|
156
|
+
Wx::MessageDialog.new(self, message, 'Invalid encoding',
|
157
|
+
Wx::OK|Wx::ICON_EXCLAMATION).show_modal()
|
158
|
+
end
|
159
|
+
|
160
|
+
# Write the content of the textctrl to the file or io +io+, encoding
|
161
|
+
# the text in encoding +target_encoding+
|
162
|
+
def export_file(io, target_encoding = 'utf-8')
|
163
|
+
case target_encoding
|
164
|
+
when /UTF-?8/
|
165
|
+
io.write( @textctrl.get_value )
|
166
|
+
else
|
167
|
+
Iconv.open(target_encoding, 'UTF-8') do | converter |
|
168
|
+
io << converter.iconv( @textctrl.get_value )
|
169
|
+
io << converter.iconv(nil)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def construct_menus()
|
175
|
+
menu_bar = Wx::MenuBar.new()
|
176
|
+
|
177
|
+
menu_file = Wx::Menu.new()
|
178
|
+
menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit this program")
|
179
|
+
evt_menu(Wx::ID_EXIT) { on_quit() }
|
180
|
+
menu_bar.append(menu_file, "&File")
|
181
|
+
if self.class.const_defined?(:ICONV_LOADED)
|
182
|
+
construct_import_export_menus(menu_bar)
|
183
|
+
end
|
184
|
+
|
185
|
+
menu_help = Wx::Menu.new()
|
186
|
+
menu_help.append(Wx::ID_ABOUT, "&About...\tF1", "Show about dialog")
|
187
|
+
evt_menu(Wx::ID_ABOUT) { on_about() }
|
188
|
+
menu_bar.append(menu_help, "&Help")
|
189
|
+
|
190
|
+
set_menu_bar(menu_bar)
|
191
|
+
end
|
192
|
+
|
193
|
+
def construct_import_export_menus(menu_bar)
|
194
|
+
id_counter = 0
|
195
|
+
menu_import = Wx::Menu.new()
|
196
|
+
|
197
|
+
ENCODINGS.each do | desc, enc |
|
198
|
+
id_counter += 1
|
199
|
+
menu_import.append(id_counter, "Import (#{desc})",
|
200
|
+
"Import a file in #{desc} encoding")
|
201
|
+
|
202
|
+
evt_menu(id_counter) { on_import_file(enc) }
|
203
|
+
end
|
204
|
+
menu_bar.append(menu_import, '&Import')
|
205
|
+
|
206
|
+
menu_export = Wx::Menu.new()
|
207
|
+
ENCODINGS.each do | desc, enc |
|
208
|
+
id_counter += 1
|
209
|
+
menu_export.append(id_counter, "Export (#{desc})",
|
210
|
+
"Export a file in #{desc} encoding")
|
211
|
+
|
212
|
+
evt_menu(id_counter) { on_export_file(enc) }
|
213
|
+
end
|
214
|
+
menu_bar.append(menu_export, '&Export')
|
215
|
+
end
|
216
|
+
|
217
|
+
def on_click(e)
|
218
|
+
@log.set_value( @textctrl.report() )
|
219
|
+
end
|
220
|
+
|
221
|
+
def on_quit()
|
222
|
+
close(TRUE)
|
223
|
+
end
|
224
|
+
|
225
|
+
def on_about()
|
226
|
+
msg = sprintf("This is the About dialog of the Unicode sample.\n" \
|
227
|
+
"Welcome to %s", Wx::VERSION_STRING)
|
228
|
+
Wx::message_box(msg, "About Minimal", Wx::OK|Wx::ICON_INFORMATION, self)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
class IConvApp < Wx::App
|
233
|
+
def on_init()
|
234
|
+
frame = IConvFrame.new("Unicode demonstration - ",
|
235
|
+
Wx::Point.new(50, 50),
|
236
|
+
Wx::Size.new(450, 450) )
|
237
|
+
|
238
|
+
frame.show(true)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
IConvApp.new().main_loop()
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/* XPM */
|
2
|
+
static char *icon1_xpm[] = {
|
3
|
+
/* columns rows colors chars-per-pixel */
|
4
|
+
"32 32 41 1",
|
5
|
+
"> c #97C4E7",
|
6
|
+
"# c #4381AA",
|
7
|
+
"d c #FFFFFF",
|
8
|
+
"< c #71B2DE",
|
9
|
+
"+ c #538BB1",
|
10
|
+
"& c #D1E5F5",
|
11
|
+
"q c #63B3DE",
|
12
|
+
"6 c #F1F4F7",
|
13
|
+
"* c #CAE1F3",
|
14
|
+
"y c #7AC4E5",
|
15
|
+
"= c #C3DDF1",
|
16
|
+
"X c #74A1BD",
|
17
|
+
"- c #BCD9EF",
|
18
|
+
"5 c #619BC4",
|
19
|
+
"3 c #E6EAF1",
|
20
|
+
"2 c #4B8EBF",
|
21
|
+
"o c #6B97B6",
|
22
|
+
". c #4B82A8",
|
23
|
+
" c None",
|
24
|
+
"w c #54A6D8",
|
25
|
+
"1 c #71A8D1",
|
26
|
+
", c #85BBE2",
|
27
|
+
"t c #EFF6FC",
|
28
|
+
"7 c #DEEDF8",
|
29
|
+
"@ c #4388B4",
|
30
|
+
"a c #F7FBFD",
|
31
|
+
"$ c #D7E0E9",
|
32
|
+
"r c #FAFCFE",
|
33
|
+
"4 c #DAEAF7",
|
34
|
+
"e c #E9F3FA",
|
35
|
+
"0 c #76BAE2",
|
36
|
+
"% c #7FA6C0",
|
37
|
+
"s c #FDFDFE",
|
38
|
+
"O c #5896BE",
|
39
|
+
"p c #B6D5EE",
|
40
|
+
"8 c #87ABC3",
|
41
|
+
": c #A5CCEA",
|
42
|
+
"9 c #E5F0F9",
|
43
|
+
"; c #AFD1EC",
|
44
|
+
"i c #F4F9FD",
|
45
|
+
"u c #8FB0C3",
|
46
|
+
/* pixels */
|
47
|
+
" ",
|
48
|
+
" ",
|
49
|
+
" ",
|
50
|
+
" ",
|
51
|
+
" ",
|
52
|
+
" .XXXooOO++@#$ ",
|
53
|
+
" %&*=-;:>>,<123 ",
|
54
|
+
" %4&*=-;:>>,1>56 ",
|
55
|
+
" %74&*=-;:>>1*>56 ",
|
56
|
+
" 89700qqqqwq1e*>X ",
|
57
|
+
" 8e974&*=-;:1re*>8 ",
|
58
|
+
" 8te974&*=-;11111# ",
|
59
|
+
" 8tty000qqqqqww>,+ ",
|
60
|
+
" uitte974&*=-p:>>+ ",
|
61
|
+
" uaitte974&*=-p:>O ",
|
62
|
+
" uaayyyy000qqqqp:O ",
|
63
|
+
" uraaitte974&*=-po ",
|
64
|
+
" urraaitte974&*=-o ",
|
65
|
+
" usryyyyyyy000q*=X ",
|
66
|
+
" ussrraaitte974&*X ",
|
67
|
+
" udssrraaitte974&X ",
|
68
|
+
" uddyyyyyyyyyy074% ",
|
69
|
+
" udddssrraaitte97% ",
|
70
|
+
" uddddssrraaitte9% ",
|
71
|
+
" udddddssrraaitte8 ",
|
72
|
+
" uddddddssrraaitt8 ",
|
73
|
+
" uuuuuuuuuuuuuu88u ",
|
74
|
+
" ",
|
75
|
+
" ",
|
76
|
+
" ",
|
77
|
+
" ",
|
78
|
+
" "
|
79
|
+
};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/* XPM */
|
2
|
+
static char *icon2_xpm[] = {
|
3
|
+
/* columns rows colors chars-per-pixel */
|
4
|
+
"32 32 15 1",
|
5
|
+
". c Black",
|
6
|
+
"O c #97C4E7",
|
7
|
+
"$ c #63B3DE",
|
8
|
+
"@ c #CAE1F3",
|
9
|
+
"; c #7AC4E5",
|
10
|
+
"* c #74A1BD",
|
11
|
+
"+ c #619BC4",
|
12
|
+
"o c #4B8EBF",
|
13
|
+
" c None",
|
14
|
+
"% c #54A6D8",
|
15
|
+
"= c #FAFCFE",
|
16
|
+
"& c #E9F3FA",
|
17
|
+
"# c #76BAE2",
|
18
|
+
"X c #C00000",
|
19
|
+
"- c #87ABC3",
|
20
|
+
/* pixels */
|
21
|
+
" ",
|
22
|
+
" ",
|
23
|
+
" ",
|
24
|
+
" ",
|
25
|
+
" ",
|
26
|
+
" ............. ",
|
27
|
+
" .XXXXXXXXXX.o. ",
|
28
|
+
" .XXXXXXXXXX.O+. ",
|
29
|
+
" .XXXXXXXXXX.@O+. ",
|
30
|
+
" .XX##$$$$%$.&@O* ",
|
31
|
+
" .XXXXXXXXXX.=&@O- ",
|
32
|
+
" .XXXXXXXXXX...... ",
|
33
|
+
" .XX;###$$$$$%%XX. ",
|
34
|
+
" .XXXXXXXXXXXXXXX. ",
|
35
|
+
" .XXXXXXXXXXXXXXX. ",
|
36
|
+
" .XX;;;;###$$$$XX. ",
|
37
|
+
" .XXXXXXXXXXXXXXX. ",
|
38
|
+
" .XXXXXXXXXXXXXXX. ",
|
39
|
+
" .XX;;;;;;;###$XX. ",
|
40
|
+
" .XXXXXXXXXXXXXXX. ",
|
41
|
+
" .XXXXXXXXXXXXXXX. ",
|
42
|
+
" .XX;;;;;;;;;;#XX. ",
|
43
|
+
" .XXXXXXXXXXXXXXX. ",
|
44
|
+
" .XXXXXXXXXXXXXXX. ",
|
45
|
+
" .XXXXXXXXXXXXXXX. ",
|
46
|
+
" .XXXXXXXXXXXXXXX. ",
|
47
|
+
" ................. ",
|
48
|
+
" ",
|
49
|
+
" ",
|
50
|
+
" ",
|
51
|
+
" ",
|
52
|
+
" "
|
53
|
+
};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/* XPM */
|
2
|
+
static char *icon3_xpm[] = {
|
3
|
+
/* columns rows colors chars-per-pixel */
|
4
|
+
"32 32 41 1",
|
5
|
+
"6 c #EDF2FB",
|
6
|
+
"- c #AAC1E8",
|
7
|
+
": c #B9CDED",
|
8
|
+
"X c #295193",
|
9
|
+
", c #C6D6F0",
|
10
|
+
"a c #4A7CCE",
|
11
|
+
"u c #779DDB",
|
12
|
+
"y c #7FA2DD",
|
13
|
+
"$ c #3263B4",
|
14
|
+
"5 c #EAF0FA",
|
15
|
+
". c #2D59A3",
|
16
|
+
"o c #6E96D8",
|
17
|
+
"* c #356AC1",
|
18
|
+
"r c #F7F9FD",
|
19
|
+
"> c #BED0EE",
|
20
|
+
"3 c #E1E9F7",
|
21
|
+
"7 c #F0F5FC",
|
22
|
+
"< c #CBD9F1",
|
23
|
+
"2 c #DAE5F6",
|
24
|
+
"# c #3161B1",
|
25
|
+
" c None",
|
26
|
+
"0 c #FDFEFF",
|
27
|
+
"= c #9FB9E5",
|
28
|
+
"e c #AEC5EA",
|
29
|
+
"t c #89A9DF",
|
30
|
+
"q c #98B5E4",
|
31
|
+
"p c #5584D1",
|
32
|
+
"d c #3A70CA",
|
33
|
+
"@ c #305FAC",
|
34
|
+
"i c #5D89D3",
|
35
|
+
"1 c #D2DFF4",
|
36
|
+
"% c #3366B9",
|
37
|
+
"9 c #FAFCFE",
|
38
|
+
"8 c #F5F8FD",
|
39
|
+
"s c #4075CC",
|
40
|
+
"O c #638ED5",
|
41
|
+
"w c #90AFE2",
|
42
|
+
"& c #3467BC",
|
43
|
+
"+ c #2F5DA9",
|
44
|
+
"; c #B3C8EB",
|
45
|
+
"4 c #E5EDF9",
|
46
|
+
/* pixels */
|
47
|
+
" ",
|
48
|
+
" ",
|
49
|
+
" ",
|
50
|
+
" ",
|
51
|
+
" ",
|
52
|
+
" ",
|
53
|
+
" ......X ",
|
54
|
+
" .oooooO+ ",
|
55
|
+
" .ooooooo. ",
|
56
|
+
" .+@@@##$%%&&&&&****. ",
|
57
|
+
" .=-;:>,<12345678900. ",
|
58
|
+
" .q=-;:>,<1234567890. ",
|
59
|
+
" .wq=-e:>,<12345678r. ",
|
60
|
+
" .twq=-e:>,<12345678. ",
|
61
|
+
" .ytwq=-e:>,<1234567. ",
|
62
|
+
" .uytwq=-e:>,<123456. ",
|
63
|
+
" .ouytwq=-e:>,<12345. ",
|
64
|
+
" .Oouytwq=-e;>,<1234. ",
|
65
|
+
" .iOouytwq=-e;>,<123. ",
|
66
|
+
" .piOouytwq=-e;>,<12. ",
|
67
|
+
" .apiOouytwq=-e;>,<1. ",
|
68
|
+
" .sapiOouytwq=-e;>,<. ",
|
69
|
+
" .dsapiOouytwq=-e;>,. ",
|
70
|
+
" ...................# ",
|
71
|
+
" ",
|
72
|
+
" ",
|
73
|
+
" ",
|
74
|
+
" ",
|
75
|
+
" ",
|
76
|
+
" ",
|
77
|
+
" ",
|
78
|
+
" "
|
79
|
+
};
|