@@ -300,6 +300,9 @@ inline int GDLWidget::widgetAlignment()
300
300
long expand=wxEXPAND;
301
301
if (this ->IsLabel ()) expand=0 ; // labels are not expanded
302
302
if (this ->IsDraw ()) expand=0 ; // draw are not expanded
303
+ if (this ->IsDropList ()) expand=0 ; // droplists are not expanded
304
+ if (this ->IsNormalBase ()) expand=0 ;
305
+ if (this ->IsTabbedBase ()) expand=0 ; // apparently IsTabbedBase() is not set even if base is a Tabbed base???
303
306
if (myAlign == gdlwALIGN_NOT) return expand|wxALIGN_LEFT|wxALIGN_TOP;
304
307
// left is top by default and right is bottom. So define left as top and remove top if bottom, etc.
305
308
// ignore sets that do not concern the current layout (vetrtical or horizontal)
@@ -951,7 +954,7 @@ bool GDLWidget::InitWx() {
951
954
void GDLWidget::Init ()
952
955
{
953
956
// set system font to something sensible now that wx is ON:
954
- if (forceWxWidgetsUglyFonts )
957
+ if (tryToMimicOriginalWidgets )
955
958
systemFont = wxFont (8 , wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL) ;// identical for me to GDLWidget::setDefaultFont(wxFont("Monospace 8"));
956
959
#ifdef __WXMSW__ // update for windows:
957
960
bool ok=systemFont.SetNativeFontInfoUserDesc (wxString (" consolas 8" )); // consolas 8 is apparently the one most identical to linux courier 8 and IDL X11 default font.
@@ -977,7 +980,8 @@ void GDLWidget::Init()
977
980
gdlDefaultTreeStateImages->Add (wxIcon (pixmap_checked)); // gdlWxTree_UNCHECKED
978
981
// create wxIcon HERE and not before wxWidgets is started!
979
982
wxgdlicon = wxIcon (gdlicon_xpm);
980
- // use a phantom window to retrieve the exact size of scrollBars wxWidget give wrong values.
983
+ // use a phantom window to retrieve the exact size of scrollBars (wxWidget give wrong values).
984
+ // Also get normal panel color
981
985
gdlwxPhantomFrame* test = new gdlwxPhantomFrame ();
982
986
test->Hide ();
983
987
test->Realize ();
@@ -1329,7 +1333,7 @@ void GDLWidgetTopBase::Realize(bool map, bool use_default) {
1329
1333
1330
1334
OnRealize ();
1331
1335
1332
- if (map) topFrame->Show () ; // endShowRequestEvent();
1336
+ if (map) topFrame->Show () ; // endShowRequestEvent();
1333
1337
else topFrame->Hide (); // SendHideRequestEvent();
1334
1338
realized = true ;
1335
1339
}
@@ -1753,32 +1757,30 @@ void GDLWidgetBase::CreateBase(wxWindow* parent){
1753
1757
if (doFrame && frameWidth > 0 ) {
1754
1758
wxScrolled<wxPanel>* frame = new wxScrolled<wxPanel>(parent, wxID_ANY, wOffset, wxDefaultSize, gdlBORDER_EXT);
1755
1759
theWxContainer=frame;
1756
- #ifdef GDL_DEBUG_WIDGETS_COLORIZE
1757
- frame->SetBackgroundColour (wxColour (0x60 , 0xe0 , 0x94 )); // vert clair
1758
- #endif
1759
1760
wxBoxSizer* panelsz = new wxBoxSizer (wxVERTICAL);
1760
1761
frame->SetSizer (panelsz);
1762
+
1763
+ wxBoxSizer* sz_inside=panelsz;
1764
+ wxPanel* frame_inside=frame;
1765
+ DLong newframewidth=frameWidth;
1766
+ if (frameWidth > 10 && tryToMimicOriginalWidgets ) {
1767
+ newframewidth=frameWidth/2 ;
1768
+ frame->SetBackgroundColour (*wxBLACK); // will show a strong frame as does IDL
1761
1769
// Fancy variant:
1762
- // int mode = wxBORDER_NONE;
1763
- // int width = 2; //the size of wxBORDER_SUNKEN
1764
- // if (frameWidth > 2) {
1765
- // mode = wxBORDER_SIMPLE;
1766
- // width = 3;
1767
- // }
1768
- // if (frameWidth > 3) {
1769
- // mode = wxBORDER_RAISED;
1770
- // width = 4;
1771
- // }
1772
- // wxPanel* frame_inside = new wxPanel(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, mode);
1773
- // sz->Add(frame_inside, FRAME_ALLOWSTRETCH, wxALL, frameWidth - width);
1774
- //
1775
- // wxBoxSizer* sz_inside = new wxBoxSizer(wxVERTICAL);
1776
- // frame_inside->SetSizer(sz_inside);
1777
- // widgetPanel = new wxScrolledWindow(frame_inside, wxID_ANY, wOffset, wxDefaultSize);
1770
+ int mode = wxBORDER_NONE;
1771
+ frame_inside = new wxPanel (frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, mode);
1772
+ frame_inside->SetBackgroundColour (*wxLIGHT_GREY);
1773
+ panelsz->Add (frame_inside, FRAME_ALLOWSTRETCH, wxALL, newframewidth);
1774
+
1775
+ sz_inside = new wxBoxSizer (wxVERTICAL);
1776
+ frame_inside->SetSizer (sz_inside);
1777
+ }
1778
1778
if (xpad > 0 || ypad > 0 ) {
1779
- wxScrolled<wxPanel>* padxpady = new wxScrolled<wxPanel>(frame );
1779
+ wxScrolled<wxPanel>* padxpady = new wxScrolled<wxPanel>(frame_inside );
1780
1780
#ifdef GDL_DEBUG_WIDGETS_COLORIZE
1781
1781
padxpady->SetBackgroundColour (wxColour (0xa7 , 0x3d , 0x0f )); // orange fonce
1782
+ #else
1783
+ if (tryToMimicOriginalWidgets ) padxpady->SetBackgroundColour (wxColour (sysPanelDefaultColour));
1782
1784
#endif
1783
1785
wxGridBagSizer* sz = new wxGridBagSizer (ypad, xpad);
1784
1786
padxpady->SetSizer (sz);
@@ -1799,12 +1801,14 @@ void GDLWidgetBase::CreateBase(wxWindow* parent){
1799
1801
padxpady->SetScrollbars (gdlSCROLL_RATE, gdlSCROLL_RATE, wSize.x / gdlSCROLL_RATE, wSize.y / gdlSCROLL_RATE);
1800
1802
padxpady->ShowScrollbars (wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
1801
1803
}
1802
- panelsz ->Add (padxpady, FRAME_ALLOWSTRETCH, wxALL | wxEXPAND, frameWidth );// gdlFRAME_MARGIN);
1803
- panelsz ->Fit (padxpady);
1804
+ sz_inside ->Add (padxpady, FRAME_ALLOWSTRETCH, wxALL | wxEXPAND, newframewidth );// gdlFRAME_MARGIN);
1805
+ sz_inside ->Fit (padxpady);
1804
1806
} else {
1805
- widgetPanel = new wxScrolledWindow (frame , widgetID, wOffset, wxDefaultSize);
1807
+ widgetPanel = new wxScrolledWindow (frame_inside , widgetID, wOffset, wxDefaultSize);
1806
1808
#ifdef GDL_DEBUG_WIDGETS_COLORIZE
1807
1809
widgetPanel->SetBackgroundColour (RandomWxColour ());
1810
+ #else
1811
+ if (tryToMimicOriginalWidgets ) widgetPanel->SetBackgroundColour (wxColour (sysPanelDefaultColour));
1808
1812
#endif
1809
1813
// widgetPanel->SetVirtualSize(wSize);
1810
1814
widgetPanel->SetSize (wScrollSize);
@@ -1814,8 +1818,8 @@ void GDLWidgetBase::CreateBase(wxWindow* parent){
1814
1818
widgetPanel->SetScrollbars (gdlSCROLL_RATE, gdlSCROLL_RATE, wSize.x / gdlSCROLL_RATE, wSize.y / gdlSCROLL_RATE);
1815
1819
widgetPanel->ShowScrollbars (wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
1816
1820
}
1817
- panelsz ->Add (widgetPanel, FRAME_ALLOWSTRETCH, wxALL | wxEXPAND, frameWidth );// gdlFRAME_MARGIN);
1818
- panelsz ->Fit (widgetPanel);
1821
+ sz_inside ->Add (widgetPanel, FRAME_ALLOWSTRETCH, wxALL | wxEXPAND, newframewidth );// gdlFRAME_MARGIN);
1822
+ sz_inside ->Fit (widgetPanel);
1819
1823
}
1820
1824
theWxWidget = widgetPanel;
1821
1825
} else {
@@ -2136,7 +2140,6 @@ GDLWidgetTabbedBase::GDLWidgetTabbedBase(WidgetIDT parentID, EnvT* e, ULong even
2136
2140
2137
2141
wxNotebook* parentTab = dynamic_cast <wxNotebook*> (parent->GetWxWidget ());
2138
2142
assert (parentTab != NULL );
2139
-
2140
2143
wxString titleWxString = wxString (title_.c_str (), wxConvUTF8);
2141
2144
if (nrows < 1 && ncols < 1 && frameWidth < 1 ) frameWidth=1 ; // set framewidth (temporary) in this case to get good result
2142
2145
CreateBase (parentTab);
@@ -2473,6 +2476,7 @@ GDLWidgetTab::GDLWidgetTab( WidgetIDT p, EnvT* e, ULong eventFlags_, DLong locat
2473
2476
theWxContainer = theWxWidget = notebook;
2474
2477
if (parentSizer) parentSizer->Add (notebook,DONOTALLOWSTRETCH,widgetAlignment ()|wxALL, gdlSPACE);
2475
2478
}
2479
+ notebook->SetPadding (wxSize (0 ,0 ));
2476
2480
// wxNotebook DOES NOT USE a sizer.
2477
2481
this ->AddToDesiredEvents (wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,wxNotebookEventHandler (gdlwxFrame::OnPageChanged),notebook);
2478
2482
}
@@ -2511,19 +2515,30 @@ BaseGDL* GDLWidgetTab::GetTabMultiline(){
2511
2515
// special as wxNotebook DOES NOT RECOMPILE ITS SIZE BEFORE REALIZATION.
2512
2516
void GDLWidgetTab::OnRealize (){
2513
2517
GDLWidgetContainer::OnRealize ();
2514
- std::cerr<<" ." ;
2515
2518
wxNotebook * nb=dynamic_cast <wxNotebook*>(theWxWidget);
2516
2519
assert ( nb != NULL );
2517
- nb->InvalidateBestSize ();
2518
2520
size_t n=nb->GetPageCount ();
2519
- wxSize s (-1 ,1 );
2520
- for (auto i=0 ; i<n; ++i) {
2521
- wxWindow* w=nb->GetPage (i);
2522
- wxSize s_tmp=w->GetBestSize ();
2523
- s.x = MAX (s.x , s_tmp.x );
2524
- s.y = MAX (s.y , s_tmp.y );
2521
+ if (n > 1 ) {
2522
+ wxSize s=nb->GetSize ();
2523
+ // insure larger enough to see tab changer
2524
+ if (s.x < 100 ) {
2525
+ s.x =100 ;
2526
+ nb->SetMinSize (s);
2527
+ }
2525
2528
}
2526
- nb->SetMinSize (s);
2529
+
2530
+ // nb->InvalidateBestSize();
2531
+ // size_t n=nb->GetPageCount();
2532
+ // for (auto i=0; i<n; ++i) {
2533
+ // wxWindow* w=nb->GetPage(i);
2534
+ // wxSize s_tmp=w->GetBestSize();
2535
+ // s.x = MAX(s.x, s_tmp.x);
2536
+ // s.y = MAX(s.y, s_tmp.y);
2537
+ // std::cerr<<"s.x="<<s.x<<" from "<<s_tmp.x<<std::endl;
2538
+ // std::cerr<<"s.y="<<s.y<<" from "<<s_tmp.y<<std::endl;
2539
+ // }
2540
+ // nb->SetMinSize(s);
2541
+ // nb->SetMinClientSize(s);
2527
2542
}
2528
2543
2529
2544
@@ -6050,6 +6065,9 @@ void gdlwxPhantomFrame::Realize() {
6050
6065
if (w.y <= 0 ) w.y =gdlABSENT_SIZE_VALUE;
6051
6066
sysScrollHeight=w.y ;
6052
6067
sysScrollWidth=w.x ;
6068
+ wxColour color=c->GetBackgroundColour ();
6069
+ sysPanelDefaultColour=color.GetRGB ();
6070
+ // std::cerr<<sysPanelDefaultColour<<std::endl;
6053
6071
}
6054
6072
6055
6073
// Frame for Plots ========================================================
@@ -6073,6 +6091,7 @@ gdlwxPlotFrame::~gdlwxPlotFrame() {
6073
6091
}
6074
6092
6075
6093
void gdlwxPlotFrame::Realize () {
6094
+ this ->SetClientSize (this ->GetClientSize ());
6076
6095
#ifdef GDL_DEBUG_WIDGETS
6077
6096
wxMessageOutputStderr ().Printf (_T (" gdlwxPlotFrame:Realize\n " ));
6078
6097
#endif
0 commit comments