diff --git a/upptst/DropGridTst/DropGridTst.upp b/upptst/DropGridTst/DropGridTst.upp new file mode 100644 index 000000000..35c661aa6 --- /dev/null +++ b/upptst/DropGridTst/DropGridTst.upp @@ -0,0 +1,10 @@ +uses + CtrlLib, + DropGrid; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/DropGridTst/init b/upptst/DropGridTst/init new file mode 100644 index 000000000..a58e86220 --- /dev/null +++ b/upptst/DropGridTst/init @@ -0,0 +1,5 @@ +#ifndef _DropGridTst_icpp_init_stub +#define _DropGridTst_icpp_init_stub +#include "CtrlLib/init" +#include "DropGrid/init" +#endif diff --git a/upptst/DropGridTst/main.cpp b/upptst/DropGridTst/main.cpp new file mode 100644 index 000000000..707fd1ef9 --- /dev/null +++ b/upptst/DropGridTst/main.cpp @@ -0,0 +1,51 @@ +#include +#include +#include + +using namespace Upp; + +struct App : public TopWindow +{ + DropGrid drop; + + App() + { + Sizeable().Zoomable(); + SetRect(Size(600, 100)); + Title("DropGrid"); + + drop.ClearButton(); + drop.AddPlus(THISBACK(Action)); + + Add(drop.LeftPosZ(20, 350).TopPosZ(20, 19)); + + drop.AddColumn("ID"); + drop.AddColumn("Value"); + drop.AddColumn("Description"); + + drop.AddText("Add person", THISBACK(Action)); + drop.AddText("Add client", THISBACK(Action)).Left().SetImage(GridImg::Append()); + drop.AddSelect(THISBACK(Action)).Left(); + + for(int i = 0; i < 20; i++) + drop.Add(i, Format("Hello %d", i), Format("How are you mr Hello %d", i)); + + drop.Width(300); + drop.DisplayAll(0);/*NoHeader(0)*///NotNull(); + drop.ColorRows(); + drop.SetDropLines(15); + drop.SetValueColumn(1); + drop.AddValueColumn(0).AddValueColumn(1); + } + + void Action() + { + } + + typedef App CLASSNAME; +}; + +GUI_APP_MAIN +{ + App().Run(); +} diff --git a/upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.h b/upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.h new file mode 100644 index 000000000..1863be028 --- /dev/null +++ b/upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.h @@ -0,0 +1,27 @@ +#ifndef _I18NCtrlLayoutTest_I18NCtrlLayoutTest_h +#define _I18NCtrlLayoutTest_I18NCtrlLayoutTest_h + +#include + +using namespace Upp; + +#define LAYOUTFILE +#include + +class MainDlg : public WithMainDlg { + MenuBar m_menu; + typedef MainDlg CLASSNAME; + +public: + void OnFile(); + void OnPallette(); + void OnPrinter(); + void OnMenu(Bar& bar ); + void OnLanguage(Bar& bar ); + void OnChangeLanguage(int language ); + + MainDlg(); +}; + +#endif + diff --git a/upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.upp b/upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.upp new file mode 100644 index 000000000..3ee4a76db --- /dev/null +++ b/upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.upp @@ -0,0 +1,11 @@ +uses + CtrlLib; + +file + I18NCtrlLayoutTest.h, + Layout.lay, + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/I18NCtrlLayoutTest/Layout.lay b/upptst/I18NCtrlLayoutTest/Layout.lay new file mode 100644 index 000000000..9cac8efdb --- /dev/null +++ b/upptst/I18NCtrlLayoutTest/Layout.lay @@ -0,0 +1,8 @@ +LAYOUT(MainDlg, 328, 108) + ITEM(Button, m_file, SetLabel(t_("File Selection...")).LeftPosZ(12, 116).TopPosZ(12, 24)) + ITEM(Button, m_pallette, SetLabel(t_("Pallette...")).LeftPosZ(136, 92).TopPosZ(12, 24)) + ITEM(Button, m_printer, SetLabel(t_("Printer...")).LeftPosZ(236, 80).TopPosZ(12, 24)) + ITEM(Button, m_close, SetLabel(t_("Close")).SetFont(StdFontZ(11).Bold()).RightPosZ(12, 56).BottomPosZ(12, 24)) + ITEM(EditString, m_current, SetEditable(false).HSizePosZ(12, 84).BottomPosZ(13, 19)) +END_LAYOUT + diff --git a/upptst/I18NCtrlLayoutTest/init b/upptst/I18NCtrlLayoutTest/init new file mode 100644 index 000000000..530583dca --- /dev/null +++ b/upptst/I18NCtrlLayoutTest/init @@ -0,0 +1,4 @@ +#ifndef _I18NCtrlLayoutTest_icpp_init_stub +#define _I18NCtrlLayoutTest_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/upptst/I18NCtrlLayoutTest/main.cpp b/upptst/I18NCtrlLayoutTest/main.cpp new file mode 100644 index 000000000..380710f6d --- /dev/null +++ b/upptst/I18NCtrlLayoutTest/main.cpp @@ -0,0 +1,74 @@ +#include "I18NCtrlLayoutTest.h" + +MainDlg::MainDlg() +{ + ::CtrlLayout( *this, "I18n Layout Test" ); + + AddFrame( m_menu ); + m_menu.Set( THISBACK(OnMenu) ); + AddFrame( InsetFrame() ); + + m_file <<= THISBACK(OnFile); + m_pallette <<= THISBACK(OnPallette); + m_printer <<= THISBACK(OnPrinter); + + OnChangeLanguage( ::GetCurrentLanguage() ); + + m_close <<= Rejector( IDCANCEL ); +} + +void MainDlg::OnFile() +{ + FileSel dlg; + dlg.ReadOnlyOption(); + dlg.ExecuteOpen( t_("Test") ); + dlg.ExecuteSaveAs( t_("Test") ); + dlg.ExecuteSelectDir( t_("Test") ); +} + +void MainDlg::OnPallette() +{ + ::RunDlgSelectColor(); +} + +void MainDlg::OnPrinter() +{ + PrinterJob dlg; + dlg.Execute(); +} + +void MainDlg::OnMenu(Bar& bar ) +{ + bar.Add( t_("Language"), THISBACK(OnLanguage) ).Key( K_F1 ); +} + +void MainDlg::OnLanguage(Bar& bar ) +{ + const int* languages = GetAllLanguages(); + // We have a tremendous amount of redundancy here... we'll use this as a filter. + // Note that sometimes, the number changes, but it still comes up as 'English'. + // This is perhaps because we don't have any translations for the other languages. + VectorMap< String, int > oldLangs; + for (int i = 0; languages[i] != 0; i++ ) + { + String langName = ::GetNativeLangName( languages[ i ] ); + if ( oldLangs.Find( langName ) < 0 ) + { + bar.Add( langName , THISBACK1( OnChangeLanguage, languages[i] ) ); + oldLangs.Add( langName, languages[i] ); + } + } +} + +void MainDlg::OnChangeLanguage(int language ) +{ + m_current.SetData( ::GetNativeLangName( language ) ); + ::SetLanguage( language ); +} + +GUI_APP_MAIN +{ + MainDlg dlg; + dlg.Run(); +} + diff --git a/upptst/Mirrors/main.cpp b/upptst/Mirrors/main.cpp index 9831f8dcc..7af02f0ab 100644 --- a/upptst/Mirrors/main.cpp +++ b/upptst/Mirrors/main.cpp @@ -43,11 +43,11 @@ GUI_APP_MAIN a = Random(100) + 1; b = Random(100) + 1; } - while(a + b < 0 || a + b > 100); + while(a + b < 0 || a + b > 199); r.DrawText(10, 10 + 3 * isz.cy / 2 * i, Format("%d + %d =", a, b), fnt); do { - a = Random(50) + 1; - b = Random(50) + 1; + a = Random(100) + 1; + b = Random(100) + 1; } while(a - b < 1); r.DrawText(2000, 10 + 3 * isz.cy / 2 * i, Format("%d - %d =", a, b), fnt); diff --git a/upptst/WMF/WMF.upp b/upptst/WMF/WMF.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/upptst/WMF/WMF.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/WMF/init b/upptst/WMF/init new file mode 100644 index 000000000..f0406fac2 --- /dev/null +++ b/upptst/WMF/init @@ -0,0 +1,4 @@ +#ifndef _WMF_icpp_init_stub +#define _WMF_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/upptst/WMF/main.cpp b/upptst/WMF/main.cpp new file mode 100644 index 000000000..70becc85c --- /dev/null +++ b/upptst/WMF/main.cpp @@ -0,0 +1,22 @@ +#include + +using namespace Upp; + +struct App : public TopWindow { + String hw; + Drawing dw1; + + void Paint(Draw& w) { + Size sz = GetSize(); + w.DrawRect(sz, White()); + Drawing iw = LoadWMF("U:/germany.wmf"); + w.DrawDrawing(GetSize(), iw); + } + + App() { Sizeable(); } +}; + +GUI_APP_MAIN +{ + App().Run(); +}