forked from pkulchenko/wxlua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauidemo.wx.lua
More file actions
1640 lines (1401 loc) · 75.2 KB
/
auidemo.wx.lua
File metadata and controls
1640 lines (1401 loc) · 75.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
///////////////////////////////////////////////////////////////////////////////
// Name: auidemo.cpp
// Purpose: wxaui: wx advanced user interface - sample/test program
// Author: Benjamin I. Williams
// Modified by:
// Created: 2005-10-03
// RCS-ID: $Id: auidemo.wx.lua,v 1.3 2008/01/22 04:45:39 jrl1 Exp $
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
--]]
-- Load the wxLua module, does nothing if running from wxLua, wxLuaFreeze, or wxLuaEdit
package.cpath = package.cpath..";./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;"
require("wx")
--/* XPM */
local sample_xpm = {
--/* columns rows colors chars-per-pixel */
"32 32 6 1",
" c black",
". c navy",
"X c red",
"o c yellow",
"O c gray100",
"+ c None",
--/* pixels */
"++++++++++++++++++++++++++++++++",
"++++++++++++++++++++++++++++++++",
"++++++++++++++++++++++++++++++++",
"++++++++++++++++++++++++++++++++",
"++++++++++++++++++++++++++++++++",
"++++++++ ++++++++++",
"++++++++ ............ ++++++++++",
"++++++++ ............ ++++++++++",
"++++++++ .OO......... ++++++++++",
"++++++++ .OO......... ++++++++++",
"++++++++ .OO......... ++++++++++",
"++++++++ .OO...... ",
"++++++++ .OO...... oooooooooooo ",
" .OO...... oooooooooooo ",
" XXXXXXX .OO...... oOOooooooooo ",
" XXXXXXX .OO...... oOOooooooooo ",
" XOOXXXX ......... oOOooooooooo ",
" XOOXXXX ......... oOOooooooooo ",
" XOOXXXX oOOooooooooo ",
" XOOXXXXXXXXX ++++ oOOooooooooo ",
" XOOXXXXXXXXX ++++ oOOooooooooo ",
" XOOXXXXXXXXX ++++ oOOooooooooo ",
" XOOXXXXXXXXX ++++ oooooooooooo ",
" XOOXXXXXXXXX ++++ oooooooooooo ",
" XXXXXXXXXXXX ++++ ",
" XXXXXXXXXXXX ++++++++++++++++++",
" ++++++++++++++++++",
"++++++++++++++++++++++++++++++++",
"++++++++++++++++++++++++++++++++",
"++++++++++++++++++++++++++++++++",
"++++++++++++++++++++++++++++++++",
"++++++++++++++++++++++++++++++++"
};
local wxT = function(s) return s end
local _ = function(s) return s end
local IDCounter = nil
local function NewID()
if not IDCounter then IDCounter = wx.wxID_HIGHEST end
IDCounter = IDCounter + 1
return IDCounter
end
local MyApp = {}
local MyFrame = {
ID_CreateTree = NewID(),
ID_CreateGrid = NewID(),
ID_CreateText = NewID(),
ID_CreateHTML = NewID(),
ID_CreateNotebook = NewID(),
ID_CreateSizeReport = NewID(),
ID_GridContent = NewID(),
ID_TextContent = NewID(),
ID_TreeContent = NewID(),
ID_HTMLContent = NewID(),
ID_NotebookContent = NewID(),
ID_SizeReportContent = NewID(),
ID_CreatePerspective = NewID(),
ID_CopyPerspectiveCode = NewID(),
ID_AllowFloating = NewID(),
ID_AllowActivePane = NewID(),
ID_TransparentHint = NewID(),
ID_VenetianBlindsHint = NewID(),
ID_RectangleHint = NewID(),
ID_NoHint = NewID(),
ID_HintFade = NewID(),
ID_NoVenetianFade = NewID(),
ID_TransparentDrag = NewID(),
ID_NoGradient = NewID(),
ID_VerticalGradient = NewID(),
ID_HorizontalGradient = NewID(),
ID_Settings = NewID(),
ID_NotebookNoCloseButton = NewID(),
ID_NotebookCloseButton = NewID(),
ID_NotebookCloseButtonAll = NewID(),
ID_NotebookCloseButtonActive = NewID(),
ID_NotebookAllowTabMove = NewID(),
ID_NotebookAllowTabExternalMove = NewID(),
ID_NotebookAllowTabSplit = NewID(),
ID_NotebookWindowList = NewID(),
ID_NotebookScrollButtons = NewID(),
ID_NotebookTabFixedWidth = NewID(),
ID_NotebookArtGloss = NewID(),
ID_NotebookArtSimple = NewID(),
ID_NotebookAlignTop = NewID(),
ID_NotebookAlignBottom = NewID(),
m_mgr = nil,
m_perspectives = nil,
m_perspectives_menu = nil,
m_notebook_style = nil,
m_notebook_theme = nil,
}
MyFrame.ID_FirstPerspective = MyFrame.ID_CreatePerspective+1000
--// (a utility control that always reports it's client size)
function wxSizeReportCtrl(parent, id, pos, size, mgr)
local this = wx.wxControl(parent, id, pos, size, wx.wxNO_BORDER)
local m_mgr = mgr;
this:Connect(wx.wxEVT_SIZE, function(event)
this:Refresh();
end)
this:Connect(wx.wxEVT_ERASE_BACKGROUND, function(event)
--// intentionally empty
end)
this:Connect(wx.wxEVT_PAINT, function(event)
local dc = wx.wxPaintDC(this)
local sizex,sizey = this:GetClientSizeWH();
local s;
local h, w, height;
s = string.format(wxT("Size: %d x %d"), sizex, sizey);
dc:SetFont(wx.wxNORMAL_FONT);
w,height=dc:GetTextExtent(s);
height = height + 3;
dc:SetBrush(wx.wxWHITE_BRUSH);
dc:SetPen(wx.wxWHITE_PEN);
dc:DrawRectangle(0, 0, sizex, sizey);
dc:SetPen(wx.wxLIGHT_GREY_PEN);
dc:DrawLine(0, 0, sizex, sizey);
dc:DrawLine(0, sizey, sizex, 0);
dc:DrawText(s, (sizex-w)/2, ((sizey-(height*5))/2));
if (m_mgr) then
local pi = m_mgr:GetPane(this);
s = string.format(wxT("Layer: %d"), pi.dock_layer);
w,h = dc:GetTextExtent(s);
dc:DrawText(s, (sizex-w)/2, ((sizey-(height*5))/2)+(height*1));
s = string.format(wxT("Dock: %d Row: %d"), pi.dock_direction, pi.dock_row);
w,h = dc:GetTextExtent(s);
dc:DrawText(s, (sizex-w)/2, ((sizey-(height*5))/2)+(height*2));
s = string.format(wxT("Position: %d"), pi.dock_pos);
w,h = dc:GetTextExtent(s);
dc:DrawText(s, (sizex-w)/2, ((sizey-(height*5))/2)+(height*3));
s = string.format(wxT("Proportion: %d"), pi.dock_proportion);
w,h = dc:GetTextExtent(s);
dc:DrawText(s, (sizex-w)/2, ((sizey-(height*5))/2)+(height*4));
end
dc:delete()
end)
return this
end
--[[
local wxSizeReportCtrl = {
m_mgr = nil,
}
function wxSizeReportCtrl:create(parent, id, pos, size, mgr)
self.this = wx.wxControl(parent, id, pos, size, wx.wxNO_BORDER)
self.m_mgr = mgr;
local this = self.this
this:Connect(wx.wxEVT_SIZE, function(event) self:OnSize(event) end)
this:Connect(wx.wxEVT_PAINT, function(event) self:OnPaint(event) end)
this:Connect(wx.wxEVT_ERASE_BACKGROUND, function(event) self:OnEraseBackground(event) end)
return self
end
function wxSizeReportCtrl:OnPaint(evt)
local this = self.this
local dc = wx.wxPaintDC(this)
local sizex,sizey = this:GetClientSizeWH();
local s;
local h, w, height;
s = string.format(wxT("Size: %d x %d"), sizex, sizey);
dc:SetFont(wx.wxNORMAL_FONT);
w,height=dc:GetTextExtent(s);
height = height + 3;
dc:SetBrush(wx.wxWHITE_BRUSH);
dc:SetPen(wx.wxWHITE_PEN);
dc:DrawRectangle(0, 0, sizex, sizey);
dc:SetPen(wx.wxLIGHT_GREY_PEN);
dc:DrawLine(0, 0, sizex, sizey);
dc:DrawLine(0, sizey, sizex, 0);
dc:DrawText(s, (sizex-w)/2, ((sizey-(height*5))/2));
local m_mgr = self.m_mgr
if (m_mgr) then
---- [.[hd.FIXME
local pi = m_mgr:GetPane(this);
s = string.format(wxT("Layer: %d"), pi.dock_layer);
w,h = dc:GetTextExtent(s);
dc:DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*1));
s = string.format(wxT("Dock: %d Row: %d"), pi.dock_direction, pi.dock_row);
w,h = dc:GetTextExtent(s);
dc:DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*2));
s = string.format(wxT("Position: %d"), pi.dock_pos);
w,h = dc:GetTextExtent(s);
dc:DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*3));
s = string.format(wxT("Proportion: %d"), pi.dock_proportion);
w,h = dc:GetTextExtent(s);
dc:DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*4));
---- ].]
end
dc:delete()
end
function wxSizeReportCtrl:OnEraseBackground(evt)
--// intentionally empty
end
function wxSizeReportCtrl:OnSize(evt)
local this = self.this
this:Refresh();
end
--]]
local SettingsPanel = {
ID_PaneBorderSize = NewID(),
ID_SashSize = NewID(),
ID_CaptionSize = NewID(),
ID_BackgroundColor = NewID(),
ID_SashColor = NewID(),
ID_InactiveCaptionColor = NewID(),
ID_InactiveCaptionGradientColor = NewID(),
ID_InactiveCaptionTextColor = NewID(),
ID_ActiveCaptionColor = NewID(),
ID_ActiveCaptionGradientColor = NewID(),
ID_ActiveCaptionTextColor = NewID(),
ID_BorderColor = NewID(),
ID_GripperColor = NewID(),
m_frame = nil,
m_border_size = nil,
m_sash_size = nil,
m_caption_size = nil,
m_inactive_caption_text_color = nil,
m_inactive_caption_gradient_color = nil,
m_inactive_caption_color = nil,
m_active_caption_text_color = nil,
m_active_caption_gradient_color = nil,
m_active_caption_color = nil,
m_sash_color = nil,
m_background_color = nil,
m_border_color = nil,
m_gripper_color = nil,
}
function SettingsPanel:create(parent, frame)
self.this = wx.wxPanel(parent.this, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize)
self.m_frame = frame
local this = self.this
--//wxBoxSizer* vert = new wxBoxSizer(wxVERTICAL);
--//vert:Add(1, 1, 1, wxEXPAND);
local s1 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_border_size = wx.wxSpinCtrl(this, self.ID_PaneBorderSize, string.format(wxT("%d"),
frame:GetDockArt():GetMetric(wxaui.wxAUI_DOCKART_PANE_BORDER_SIZE)),
wx.wxDefaultPosition, wx.wxSize(50,20), wx.wxSP_ARROW_KEYS, 0, 100,
frame:GetDockArt():GetMetric(wxaui.wxAUI_DOCKART_PANE_BORDER_SIZE));
s1:Add(1, 1, 1, wx.wxEXPAND);
s1:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Pane Border Size:")));
s1:Add(self.m_border_size);
s1:Add(1, 1, 1, wx.wxEXPAND);
s1:SetItemMinSize(1, 180, 20);
--//vert:Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
local s2 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_sash_size = wx.wxSpinCtrl(this, self.ID_SashSize, string.format(wxT("%d"),
frame:GetDockArt():GetMetric(wxaui.wxAUI_DOCKART_SASH_SIZE)),
wx.wxDefaultPosition, wx.wxSize(50,20), wx.wxSP_ARROW_KEYS, 0, 100,
frame:GetDockArt():GetMetric(wxaui.wxAUI_DOCKART_SASH_SIZE));
s2:Add(1, 1, 1, wx.wxEXPAND);
s2:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Sash Size:")));
s2:Add(self.m_sash_size);
s2:Add(1, 1, 1, wx.wxEXPAND);
s2:SetItemMinSize(1, 180, 20);
--//vert:Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
local s3 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_caption_size = wx.wxSpinCtrl(this, self.ID_CaptionSize, string.format(wxT("%d"),
frame:GetDockArt():GetMetric(wxaui.wxAUI_DOCKART_CAPTION_SIZE)),
wx.wxDefaultPosition, wx.wxSize(50,20), wx.wxSP_ARROW_KEYS, 0, 100,
frame:GetDockArt():GetMetric(wxaui.wxAUI_DOCKART_CAPTION_SIZE));
s3:Add(1, 1, 1, wx.wxEXPAND);
s3:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Caption Size:")));
s3:Add(self.m_caption_size);
s3:Add(1, 1, 1, wx.wxEXPAND);
s3:SetItemMinSize(1, 180, 20);
--//vert:Add(s3, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
--//vert:Add(1, 1, 1, wxEXPAND);
local b = self:CreateColorBitmap(wx.wxBLACK);
local s4 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_background_color = wx.wxBitmapButton(this, self.ID_BackgroundColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s4:Add(1, 1, 1, wx.wxEXPAND);
s4:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Background Color:")));
s4:Add(self.m_background_color);
s4:Add(1, 1, 1, wx.wxEXPAND);
s4:SetItemMinSize(1, 180, 20);
local s5 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_sash_color = wx.wxBitmapButton(this, self.ID_SashColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s5:Add(1, 1, 1, wx.wxEXPAND);
s5:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Sash Color:")));
s5:Add(self.m_sash_color);
s5:Add(1, 1, 1, wx.wxEXPAND);
s5:SetItemMinSize(1, 180, 20);
local s6 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_inactive_caption_color = wx.wxBitmapButton(this, self.ID_InactiveCaptionColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s6:Add(1, 1, 1, wx.wxEXPAND);
s6:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Normal Caption:")));
s6:Add(self.m_inactive_caption_color);
s6:Add(1, 1, 1, wx.wxEXPAND);
s6:SetItemMinSize(1, 180, 20);
local s7 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_inactive_caption_gradient_color = wx.wxBitmapButton(this, self.ID_InactiveCaptionGradientColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s7:Add(1, 1, 1, wx.wxEXPAND);
s7:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Normal Caption Gradient:")));
s7:Add(self.m_inactive_caption_gradient_color);
s7:Add(1, 1, 1, wx.wxEXPAND);
s7:SetItemMinSize(1, 180, 20);
local s8 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_inactive_caption_text_color = wx.wxBitmapButton(this, self.ID_InactiveCaptionTextColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s8:Add(1, 1, 1, wx.wxEXPAND);
s8:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Normal Caption Text:")));
s8:Add(self.m_inactive_caption_text_color);
s8:Add(1, 1, 1, wx.wxEXPAND);
s8:SetItemMinSize(1, 180, 20);
local s9 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_active_caption_color = wx.wxBitmapButton(this, self.ID_ActiveCaptionColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s9:Add(1, 1, 1, wx.wxEXPAND);
s9:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Active Caption:")));
s9:Add(self.m_active_caption_color);
s9:Add(1, 1, 1, wx.wxEXPAND);
s9:SetItemMinSize(1, 180, 20);
local s10 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_active_caption_gradient_color = wx.wxBitmapButton(this, self.ID_ActiveCaptionGradientColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s10:Add(1, 1, 1, wx.wxEXPAND);
s10:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Active Caption Gradient:")));
s10:Add(self.m_active_caption_gradient_color);
s10:Add(1, 1, 1, wx.wxEXPAND);
s10:SetItemMinSize(1, 180, 20);
local s11 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_active_caption_text_color = wx.wxBitmapButton(this, self.ID_ActiveCaptionTextColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s11:Add(1, 1, 1, wx.wxEXPAND);
s11:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Active Caption Text:")));
s11:Add(self.m_active_caption_text_color);
s11:Add(1, 1, 1, wx.wxEXPAND);
s11:SetItemMinSize(1, 180, 20);
local s12 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_border_color = wx.wxBitmapButton(this, self.ID_BorderColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s12:Add(1, 1, 1, wx.wxEXPAND);
s12:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Border Color:")));
s12:Add(self.m_border_color);
s12:Add(1, 1, 1, wx.wxEXPAND);
s12:SetItemMinSize(1, 180, 20);
local s13 = wx.wxBoxSizer(wx.wxHORIZONTAL);
self.m_gripper_color = wx.wxBitmapButton(this, self.ID_GripperColor, b, wx.wxDefaultPosition, wx.wxSize(50,25));
s13:Add(1, 1, 1, wx.wxEXPAND);
s13:Add(wx.wxStaticText(this, wx.wxID_ANY, wxT("Gripper Color:")));
s13:Add(self.m_gripper_color);
s13:Add(1, 1, 1, wx.wxEXPAND);
s13:SetItemMinSize(1, 180, 20);
local grid_sizer = wx.wxGridSizer(2,0,2,2);
grid_sizer:SetHGap(5);
grid_sizer:Add(s1); grid_sizer:Add(s4);
grid_sizer:Add(s2); grid_sizer:Add(s5);
grid_sizer:Add(s3); grid_sizer:Add(s13);
grid_sizer:Add(1,1); grid_sizer:Add(s12);
grid_sizer:Add(s6); grid_sizer:Add(s9);
grid_sizer:Add(s7); grid_sizer:Add(s10);
grid_sizer:Add(s8); grid_sizer:Add(s11);
local cont_sizer = wx.wxBoxSizer(wx.wxVERTICAL);
cont_sizer:Add(grid_sizer, 1, wx.wxEXPAND + wx.wxALL, 5);
this:SetSizer(cont_sizer);
this:GetSizer():SetSizeHints(this);
--#if 0
-- m_border_size:SetValue(frame:GetDockArt():GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE));
-- m_sash_size:SetValue(frame:GetDockArt():GetMetric(wxAUI_DOCKART_SASH_SIZE));
-- m_caption_size:SetValue(frame:GetDockArt():GetMetric(wxAUI_DOCKART_CAPTION_SIZE));
--#endif
self:UpdateColors();
this:Connect(self.ID_PaneBorderSize, wx.wxEVT_COMMAND_SPINCTRL_UPDATED, function(event) self:OnPaneBorderSize(event) end)
this:Connect(self.ID_SashSize, wx.wxEVT_COMMAND_SPINCTRL_UPDATED, function(event) self:OnSashSize(event) end)
this:Connect(self.ID_CaptionSize, wx.wxEVT_COMMAND_SPINCTRL_UPDATED, function(event) self:OnCaptionSize(event) end)
this:Connect(self.ID_BackgroundColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_SashColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_InactiveCaptionColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_InactiveCaptionGradientColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_InactiveCaptionTextColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_ActiveCaptionColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_ActiveCaptionGradientColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_ActiveCaptionTextColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_BorderColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
this:Connect(self.ID_GripperColor, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) self:OnSetColor(event) end)
return self
end
function SettingsPanel:CreateColorBitmap(c)
local image = wx.wxImage()
image:Create(25,14);
for x = 0, 25-1 do
for y = 0, 14-1 do
local pixcol = c;
if (x == 0 or x == 24 or y == 0 or y == 13) then
pixcol = wx.wxBLACK;
end
image:SetRGB(x, y, pixcol:Red(), pixcol:Green(), pixcol:Blue());
end
end
return wx.wxBitmap(image);
end
function SettingsPanel:UpdateColors()
local bk = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_BACKGROUND_COLOUR);
self.m_background_color:SetBitmapLabel(self:CreateColorBitmap(bk));
local cap = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR);
self.m_inactive_caption_color:SetBitmapLabel(self:CreateColorBitmap(cap));
local capgrad = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR);
self.m_inactive_caption_gradient_color:SetBitmapLabel(self:CreateColorBitmap(capgrad));
local captxt = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR);
self.m_inactive_caption_text_color:SetBitmapLabel(self:CreateColorBitmap(captxt));
local acap = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR);
self.m_active_caption_color:SetBitmapLabel(self:CreateColorBitmap(acap));
local acapgrad = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR);
self.m_active_caption_gradient_color:SetBitmapLabel(self:CreateColorBitmap(acapgrad));
local acaptxt = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR);
self.m_active_caption_text_color:SetBitmapLabel(self:CreateColorBitmap(acaptxt));
local sash = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_SASH_COLOUR);
self.m_sash_color:SetBitmapLabel(self:CreateColorBitmap(sash));
local border = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_BORDER_COLOUR);
self.m_border_color:SetBitmapLabel(self:CreateColorBitmap(border));
local gripper = self.m_frame:GetDockArt():GetColour(wxaui.wxAUI_DOCKART_GRIPPER_COLOUR);
self.m_gripper_color:SetBitmapLabel(self:CreateColorBitmap(gripper));
end
function SettingsPanel:OnPaneBorderSize(event)
self.m_frame:GetDockArt():SetMetric(wxaui.wxAUI_DOCKART_PANE_BORDER_SIZE,
event:GetInt()); --event:GetPosition());
self.m_frame:DoUpdate();
end
function SettingsPanel:OnSashSize(event)
self.m_frame:GetDockArt():SetMetric(wxaui.wxAUI_DOCKART_SASH_SIZE,
event:GetInt()); --event:GetPosition());
self.m_frame:DoUpdate();
end
function SettingsPanel:OnCaptionSize(event)
self.m_frame:GetDockArt():SetMetric(wxaui.wxAUI_DOCKART_CAPTION_SIZE,
event:GetInt()); --event:GetPosition());
self.m_frame:DoUpdate();
end
function SettingsPanel:OnSetColor(event)
local dlg = wx.wxColourDialog(self.m_frame.this);
dlg:SetTitle(_("Color Picker"));
if (dlg:ShowModal() ~= wx.wxID_OK) then
return;
end
local var = 0;
local id = event:GetId()
if id == self.ID_BackgroundColor then var = wxaui.wxAUI_DOCKART_BACKGROUND_COLOUR;
elseif id == self.ID_SashColor then var = wxaui.wxAUI_DOCKART_SASH_COLOUR;
elseif id == self.ID_InactiveCaptionColor then var = wxaui.wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR;
elseif id == self.ID_InactiveCaptionGradientColor then var = wxaui.wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR;
elseif id == self.ID_InactiveCaptionTextColor then var = wxaui.wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR;
elseif id == self.ID_ActiveCaptionColor then var = wxaui.wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR;
elseif id == self.ID_ActiveCaptionGradientColor then var = wxaui.wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR;
elseif id == self.ID_ActiveCaptionTextColor then var = wxaui.wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR;
elseif id == self.ID_BorderColor then var = wxaui.wxAUI_DOCKART_BORDER_COLOUR;
elseif id == self.ID_GripperColor then var = wxaui.wxAUI_DOCKART_GRIPPER_COLOUR;
else return;
end
self.m_frame:GetDockArt():SetColour(var, dlg:GetColourData():GetColour());
self.m_frame:DoUpdate();
self:UpdateColors();
end
function MyFrame:create(parent, id, title, pos, size, style)
self.this = wx.wxFrame(wx.NULL,
wx.wxID_ANY,
wxT("wxAUI Sample Application"),
wx.wxDefaultPosition,
wx.wxSize(800, 600));
local this = self.this
--// tell wxAuiManager to manage this frame
self.m_mgr = wxaui.wxAuiManager()
self.m_mgr:SetManagedWindow(this);
--// set frame icon
--this:SetIcon(wx.wxIcon(sample_xpm));
local bitmap = wx.wxBitmap(sample_xpm)
local icon = wx.wxIcon()
icon:CopyFromBitmap(bitmap)
this:SetIcon(icon)
bitmap:delete()
icon:delete()
--// set up default notebook style
self.m_notebook_style = wxaui.wxAUI_NB_DEFAULT_STYLE + wxaui.wxAUI_NB_TAB_EXTERNAL_MOVE + wx.wxNO_BORDER;
self.m_notebook_theme = 0;
--// create menu
local mb = wx.wxMenuBar();
local file_menu = wx.wxMenu();
file_menu:Append(wx.wxID_EXIT, _("Exit"));
local view_menu = wx.wxMenu();
view_menu:Append(self.ID_CreateText, _("Create Text Control"));
view_menu:Append(self.ID_CreateHTML, _("Create HTML Control"));
view_menu:Append(self.ID_CreateTree, _("Create Tree"));
view_menu:Append(self.ID_CreateGrid, _("Create Grid"));
view_menu:Append(self.ID_CreateNotebook, _("Create Notebook"));
view_menu:Append(self.ID_CreateSizeReport, _("Create Size Reporter"));
view_menu:AppendSeparator();
view_menu:Append(self.ID_GridContent, _("Use a Grid for the Content Pane"));
view_menu:Append(self.ID_TextContent, _("Use a Text Control for the Content Pane"));
view_menu:Append(self.ID_HTMLContent, _("Use an HTML Control for the Content Pane"));
view_menu:Append(self.ID_TreeContent, _("Use a Tree Control for the Content Pane"));
view_menu:Append(self.ID_NotebookContent, _("Use a wxAuiNotebook control for the Content Pane"));
view_menu:Append(self.ID_SizeReportContent, _("Use a Size Reporter for the Content Pane"));
local options_menu = wx.wxMenu();
options_menu:AppendRadioItem(self.ID_TransparentHint, _("Transparent Hint"));
options_menu:AppendRadioItem(self.ID_VenetianBlindsHint, _("Venetian Blinds Hint"));
options_menu:AppendRadioItem(self.ID_RectangleHint, _("Rectangle Hint"));
options_menu:AppendRadioItem(self.ID_NoHint, _("No Hint"));
options_menu:AppendSeparator();
options_menu:AppendCheckItem(self.ID_HintFade, _("Hint Fade-in"));
options_menu:AppendCheckItem(self.ID_AllowFloating, _("Allow Floating"));
options_menu:AppendCheckItem(self.ID_NoVenetianFade, _("Disable Venetian Blinds Hint Fade-in"));
options_menu:AppendCheckItem(self.ID_TransparentDrag, _("Transparent Drag"));
options_menu:AppendCheckItem(self.ID_AllowActivePane, _("Allow Active Pane"));
options_menu:AppendSeparator();
options_menu:AppendRadioItem(self.ID_NoGradient, _("No Caption Gradient"));
options_menu:AppendRadioItem(self.ID_VerticalGradient, _("Vertical Caption Gradient"));
options_menu:AppendRadioItem(self.ID_HorizontalGradient, _("Horizontal Caption Gradient"));
options_menu:AppendSeparator();
options_menu:Append(self.ID_Settings, _("Settings Pane"));
local notebook_menu = wx.wxMenu();
notebook_menu:AppendRadioItem(self.ID_NotebookArtGloss, _("Glossy Theme (Default)"));
notebook_menu:AppendRadioItem(self.ID_NotebookArtSimple, _("Simple Theme"));
notebook_menu:AppendSeparator();
notebook_menu:AppendRadioItem(self.ID_NotebookNoCloseButton, _("No Close Button"));
notebook_menu:AppendRadioItem(self.ID_NotebookCloseButton, _("Close Button at Right"));
notebook_menu:AppendRadioItem(self.ID_NotebookCloseButtonAll, _("Close Button on All Tabs"));
notebook_menu:AppendRadioItem(self.ID_NotebookCloseButtonActive, _("Close Button on Active Tab"));
notebook_menu:AppendSeparator();
notebook_menu:AppendRadioItem(self.ID_NotebookAlignTop, _("Tab Top Alignment"));
notebook_menu:AppendRadioItem(self.ID_NotebookAlignBottom, _("Tab Bottom Alignment"));
notebook_menu:AppendSeparator();
notebook_menu:AppendCheckItem(self.ID_NotebookAllowTabMove, _("Allow Tab Move"));
notebook_menu:AppendCheckItem(self.ID_NotebookAllowTabExternalMove, _("Allow External Tab Move"));
notebook_menu:AppendCheckItem(self.ID_NotebookAllowTabSplit, _("Allow Notebook Split"));
notebook_menu:AppendCheckItem(self.ID_NotebookScrollButtons, _("Scroll Buttons Visible"));
notebook_menu:AppendCheckItem(self.ID_NotebookWindowList, _("Window List Button Visible"));
notebook_menu:AppendCheckItem(self.ID_NotebookTabFixedWidth, _("Fixed-width Tabs"));
self.m_perspectives_menu = wx.wxMenu();
self.m_perspectives_menu:Append(self.ID_CreatePerspective, _("Create Perspective"));
self.m_perspectives_menu:Append(self.ID_CopyPerspectiveCode, _("Copy Perspective Data To Clipboard"));
self.m_perspectives_menu:AppendSeparator();
self.m_perspectives_menu:Append(self.ID_FirstPerspective+0, _("Default Startup"));
self.m_perspectives_menu:Append(self.ID_FirstPerspective+1, _("All Panes"));
local help_menu = wx.wxMenu();
help_menu:Append(wx.wxID_ABOUT, _("About..."));
mb:Append(file_menu, _("File"));
mb:Append(view_menu, _("View"));
mb:Append(self.m_perspectives_menu, _("Perspectives"));
mb:Append(options_menu, _("Options"));
mb:Append(notebook_menu, _("Notebook"));
mb:Append(help_menu, _("Help"));
this:SetMenuBar(mb);
this:CreateStatusBar();
this:GetStatusBar():SetStatusText(_("Ready"));
--// min size for the frame itself isn't completely done.
--// see the end up wxAuiManager::Update() for the test
--// code. For now, just hard code a frame minimum size
this:SetMinSize(wx.wxSize(400,300));
--// create some toolbars
local tb1 = wx.wxToolBar(this, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize,
wx.wxTB_FLAT + wx.wxTB_NODIVIDER);
tb1:SetToolBitmapSize(wx.wxSize(48,48));
tb1:AddTool(101, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_ERROR));
tb1:AddSeparator();
tb1:AddTool(102, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_QUESTION));
tb1:AddTool(103, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_INFORMATION));
tb1:AddTool(103, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_WARNING));
tb1:AddTool(103, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_MISSING_IMAGE));
tb1:Realize();
local tb2 = wx.wxToolBar(this, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize,
wx.wxTB_FLAT + wx.wxTB_NODIVIDER);
tb2:SetToolBitmapSize(wx.wxSize(16,16));
local tb2_bmp1 = wx.wxArtProvider.GetBitmap(wx.wxART_QUESTION, wx.wxART_OTHER, wx.wxSize(16,16));
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddSeparator();
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddSeparator();
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:AddTool(101, wxT("Test"), tb2_bmp1);
tb2:Realize();
local tb3 = wx.wxToolBar(this, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize,
wx.wxTB_FLAT + wx.wxTB_NODIVIDER);
tb3:SetToolBitmapSize(wx.wxSize(16,16));
local tb3_bmp1 = wx.wxArtProvider.GetBitmap(wx.wxART_FOLDER, wx.wxART_OTHER, wx.wxSize(16,16));
tb3:AddTool(101, wxT("Test"), tb3_bmp1);
tb3:AddTool(101, wxT("Test"), tb3_bmp1);
tb3:AddTool(101, wxT("Test"), tb3_bmp1);
tb3:AddTool(101, wxT("Test"), tb3_bmp1);
tb3:AddSeparator();
tb3:AddTool(101, wxT("Test"), tb3_bmp1);
tb3:AddTool(101, wxT("Test"), tb3_bmp1);
tb3:Realize();
local tb4 = wx.wxToolBar(this, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize,
wx.wxTB_FLAT + wx.wxTB_NODIVIDER + wx.wxTB_HORZ_TEXT);
tb4:SetToolBitmapSize(wx.wxSize(16,16));
local tb4_bmp1 = wx.wxArtProvider.GetBitmap(wx.wxART_NORMAL_FILE, wx.wxART_OTHER, wx.wxSize(16,16));
tb4:AddTool(101, wxT("Item 1"), tb4_bmp1);
tb4:AddTool(101, wxT("Item 2"), tb4_bmp1);
tb4:AddTool(101, wxT("Item 3"), tb4_bmp1);
tb4:AddTool(101, wxT("Item 4"), tb4_bmp1);
tb4:AddSeparator();
tb4:AddTool(101, wxT("Item 5"), tb4_bmp1);
tb4:AddTool(101, wxT("Item 6"), tb4_bmp1);
tb4:AddTool(101, wxT("Item 7"), tb4_bmp1);
tb4:AddTool(101, wxT("Item 8"), tb4_bmp1);
tb4:Realize();
--// create some toolbars
local tb5 = wx.wxToolBar(this, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize,
wx.wxTB_FLAT + wx.wxTB_NODIVIDER + wx.wxTB_VERTICAL);
tb5:SetToolBitmapSize(wx.wxSize(48,48));
tb5:AddTool(101, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_ERROR));
tb5:AddSeparator();
tb5:AddTool(102, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_QUESTION));
tb5:AddTool(103, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_INFORMATION));
tb5:AddTool(103, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_WARNING));
tb5:AddTool(103, wxT("Test"), wx.wxArtProvider.GetBitmap(wx.wxART_MISSING_IMAGE));
tb5:Realize();
--// add a bunch of panes
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test1")):Caption(wxT("Pane Caption")):
Top());
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test2")):Caption(wxT("Client Size Reporter")):
Bottom():Position(1):
CloseButton(true):MaximizeButton(true));
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test3")):Caption(wxT("Client Size Reporter")):
Bottom():
CloseButton(true):MaximizeButton(true));
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test4")):Caption(wxT("Pane Caption")):
Left());
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test5")):Caption(wxT("No Close Button")):
Right():CloseButton(false));
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test6")):Caption(wxT("Client Size Reporter")):
Right():Row(1):
CloseButton(true):MaximizeButton(true));
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test7")):Caption(wxT("Client Size Reporter")):
Left():Layer(1):
CloseButton(true):MaximizeButton(true));
self.m_mgr:AddPane(self:CreateTreeCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test8")):Caption(wxT("Tree Pane")):
Left():Layer(1):Position(1):
CloseButton(true):MaximizeButton(true));
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test9")):Caption(wxT("Min Size 200x100")):
BestSize(wx.wxSize(200,100)):MinSize(wx.wxSize(200,100)):
Bottom():Layer(1):
CloseButton(true):MaximizeButton(true));
local wnd10 = self:CreateTextCtrl(wxT("This pane will prompt the user before hiding."));
self.m_mgr:AddPane(wnd10, wxaui.wxAuiPaneInfo():
Name(wxT("test10")):Caption(wxT("Text Pane with Hide Prompt")):
Bottom():Layer(1):Position(1));
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():
Name(wxT("test11")):Caption(wxT("Fixed Pane")):
Bottom():Layer(1):Position(2):Fixed());
self.m_mgr:AddPane(SettingsPanel:create(self,self).this, wxaui.wxAuiPaneInfo():
Name(wxT("settings")):Caption(wxT("Dock Manager Settings")):
Dockable(false):Float():Hide());
--// create some center panes
self.m_mgr:AddPane(self:CreateGrid(), wxaui.wxAuiPaneInfo():Name(wxT("grid_content")):
CenterPane():Hide());
self.m_mgr:AddPane(self:CreateTreeCtrl(), wxaui.wxAuiPaneInfo():Name(wxT("tree_content")):
CenterPane():Hide());
self.m_mgr:AddPane(self:CreateSizeReportCtrl(), wxaui.wxAuiPaneInfo():Name(wxT("sizereport_content")):
CenterPane():Hide());
self.m_mgr:AddPane(self:CreateTextCtrl(), wxaui.wxAuiPaneInfo():Name(wxT("text_content")):
CenterPane():Hide());
self.m_mgr:AddPane(self:CreateHTMLCtrl(), wxaui.wxAuiPaneInfo():Name(wxT("html_content")):
CenterPane():Hide());
self.m_mgr:AddPane(self:CreateNotebook(), wxaui.wxAuiPaneInfo():Name(wxT("notebook_content")):
CenterPane():PaneBorder(false));
--// add the toolbars to the manager
self.m_mgr:AddPane(tb1, wxaui.wxAuiPaneInfo():
Name(wxT("tb1")):Caption(wxT("Big Toolbar")):
ToolbarPane():Top():
LeftDockable(false):RightDockable(false));
self.m_mgr:AddPane(tb2, wxaui.wxAuiPaneInfo():
Name(wxT("tb2")):Caption(wxT("Toolbar 2")):
ToolbarPane():Top():Row(1):
LeftDockable(false):RightDockable(false));
self.m_mgr:AddPane(tb3, wxaui.wxAuiPaneInfo():
Name(wxT("tb3")):Caption(wxT("Toolbar 3")):
ToolbarPane():Top():Row(1):Position(1):
LeftDockable(false):RightDockable(false));
self.m_mgr:AddPane(tb4, wxaui.wxAuiPaneInfo():
Name(wxT("tb4")):Caption(wxT("Sample Bookmark Toolbar")):
ToolbarPane():Top():Row(2):
LeftDockable(false):RightDockable(false));
self.m_mgr:AddPane(tb5, wxaui.wxAuiPaneInfo():
Name(wxT("tb5")):Caption(wxT("Sample Vertical Toolbar")):
ToolbarPane():Left():
GripperTop():
TopDockable(false):BottomDockable(false));
self.m_mgr:AddPane(wx.wxButton(this, wx.wxID_ANY, _("Test Button")),
wxaui.wxAuiPaneInfo():Name(wxT("tb6")):
ToolbarPane():Top():Row(2):Position(1):
LeftDockable(false):RightDockable(false));
--// make some default perspectives
local perspective_all = self.m_mgr:SavePerspective();
local i, count;
local all_panes = self.m_mgr:GetAllPanes();
count = all_panes:GetCount()
for i = 0, count-1 do
if ( all_panes:Item(i):IsToolbar() == false) then
all_panes:Item(i):Hide();
end
end
self.m_mgr:GetPane(wxT("tb1")):Hide();
self.m_mgr:GetPane(wxT("tb6")):Hide();
self.m_mgr:GetPane(wxT("test8")):Show():Left():Layer(0):Row(0):Position(0);
self.m_mgr:GetPane(wxT("test10")):Show():Bottom():Layer(0):Row(0):Position(0);
self.m_mgr:GetPane(wxT("notebook_content")):Show();
local perspective_default = self.m_mgr:SavePerspective();
self.m_perspectives = wx.wxArrayString()
self.m_perspectives:Add(perspective_default);
self.m_perspectives:Add(perspective_all);
--// "commit" all changes made to wxAuiManager
self.m_mgr:Update();
this:Connect(wx.wxEVT_DESTROY,
function(event)
if (event:GetEventObject():DynamicCast("wxObject") == this:DynamicCast("wxObject")) then
-- You must ALWAYS UnInit() the wxAuiManager when closing
-- since it pushes event handlers into the frame.
self.m_mgr:UnInit()
end end)
this:Connect(wx.wxEVT_ERASE_BACKGROUND, function(event) self:OnEraseBackground(event) end)
this:Connect(wx.wxEVT_SIZE, function(event) self:OnSize(event) end)
this:Connect(self.ID_CreateTree, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnCreateTree(event) end)
this:Connect(self.ID_CreateGrid, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnCreateGrid(event) end)
this:Connect(self.ID_CreateText, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnCreateText(event) end)
this:Connect(self.ID_CreateHTML, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnCreateHTML(event) end)
this:Connect(self.ID_CreateSizeReport, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnCreateSizeReport(event) end)
this:Connect(self.ID_CreateNotebook, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnCreateNotebook(event) end)
this:Connect(self.ID_CreatePerspective, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnCreatePerspective(event) end)
this:Connect(self.ID_CopyPerspectiveCode, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnCopyPerspectiveCode(event) end)
this:Connect(self.ID_AllowFloating, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_TransparentHint, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_VenetianBlindsHint, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_RectangleHint, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_NoHint, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_HintFade, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_NoVenetianFade, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_TransparentDrag, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_AllowActivePane, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnManagerFlag(event) end)
this:Connect(self.ID_NotebookTabFixedWidth, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookNoCloseButton, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookCloseButton, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookCloseButtonAll, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookCloseButtonActive, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookAllowTabMove, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookAllowTabExternalMove, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookAllowTabSplit, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookScrollButtons, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookWindowList, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookArtGloss, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookArtSimple, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnNotebookFlag(event) end)
this:Connect(self.ID_NotebookAlignTop, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnTabAlignment(event) end)
this:Connect(self.ID_NotebookAlignBottom, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnTabAlignment(event) end)
this:Connect(self.ID_NoGradient, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnGradient(event) end)
this:Connect(self.ID_VerticalGradient, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnGradient(event) end)
this:Connect(self.ID_HorizontalGradient, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnGradient(event) end)
this:Connect(self.ID_Settings, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnSettings(event) end)
this:Connect(self.ID_GridContent, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnChangeContentPane(event) end)
this:Connect(self.ID_TreeContent, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnChangeContentPane(event) end)
this:Connect(self.ID_TextContent, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnChangeContentPane(event) end)
this:Connect(self.ID_SizeReportContent, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnChangeContentPane(event) end)
this:Connect(self.ID_HTMLContent, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnChangeContentPane(event) end)
this:Connect(self.ID_NotebookContent, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnChangeContentPane(event) end)
this:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnExit(event) end)
this:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnAbout(event) end)
this:Connect(self.ID_NotebookTabFixedWidth, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookNoCloseButton, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookCloseButton, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookCloseButtonAll, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookCloseButtonActive, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookAllowTabMove, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookAllowTabExternalMove, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookAllowTabSplit, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookScrollButtons, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NotebookWindowList, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_AllowFloating, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_TransparentHint, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_VenetianBlindsHint, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_RectangleHint, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NoHint, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_HintFade, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NoVenetianFade, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_TransparentDrag, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_NoGradient, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_VerticalGradient, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
this:Connect(self.ID_HorizontalGradient, wx.wxEVT_UPDATE_UI, function(event) self:OnUpdateUI(event) end)
--hd.FIXME this:Connect(self.ID_FirstPerspective, self.ID_FirstPerspective+1000, wx.wxEVT_COMMAND_MENU_SELECTED_RANGE, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+0, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+1, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+2, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+3, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+4, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+5, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+6, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+7, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+8, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(self.ID_FirstPerspective+9, wx.wxEVT_COMMAND_MENU_SELECTED, function(event) self:OnRestorePerspective(event) end)
this:Connect(wxaui.wxEVT_AUI_PANE_CLOSE, function(event) self:OnPaneClose(event) end)
this:Connect(wx.wxID_ANY, wxaui.wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, function(event) self:OnAllowNotebookDnD(event) end)
this:Connect(wx.wxID_ANY, wxaui.wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, function(event) self:OnNotebookPageClose(event) end)
return self
end
function MyFrame:dtor()
self.m_mgr:UnInit();
end
function MyFrame:GetDockArt()
return self.m_mgr:GetArtProvider();
end
function MyFrame:DoUpdate()
self.m_mgr:Update();
end
function MyFrame:OnEraseBackground(event)
event:Skip();
end
function MyFrame:OnSize(event)
event:Skip();
end
function MyFrame:OnSettings(event)
--// show the settings pane, and float it
local floating_pane = self.m_mgr:GetPane(wxT("settings")):Float():Show();
if (floating_pane.floating_pos == wx.wxDefaultPosition) then
floating_pane:FloatingPosition(self:GetStartPosition());
end
self.m_mgr:Update();
end
function MyFrame:OnGradient(event)