mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
upptst: DropGridTst
git-svn-id: svn://ultimatepp.org/upp/trunk@1172 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
64807363c3
commit
2f294d966b
12 changed files with 228 additions and 3 deletions
10
upptst/DropGridTst/DropGridTst.upp
Normal file
10
upptst/DropGridTst/DropGridTst.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
CtrlLib,
|
||||
DropGrid;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
5
upptst/DropGridTst/init
Normal file
5
upptst/DropGridTst/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _DropGridTst_icpp_init_stub
|
||||
#define _DropGridTst_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "DropGrid/init"
|
||||
#endif
|
||||
51
upptst/DropGridTst/main.cpp
Normal file
51
upptst/DropGridTst/main.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <GridCtrl/GridCtrl.h>
|
||||
#include <DropGrid/DropGrid.h>
|
||||
|
||||
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();
|
||||
}
|
||||
27
upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.h
Normal file
27
upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef _I18NCtrlLayoutTest_I18NCtrlLayoutTest_h
|
||||
#define _I18NCtrlLayoutTest_I18NCtrlLayoutTest_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define LAYOUTFILE <I18NCtrlLayoutTest/Layout.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
class MainDlg : public WithMainDlg<TopWindow> {
|
||||
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
|
||||
|
||||
11
upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.upp
Normal file
11
upptst/I18NCtrlLayoutTest/I18NCtrlLayoutTest.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
I18NCtrlLayoutTest.h,
|
||||
Layout.lay,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
8
upptst/I18NCtrlLayoutTest/Layout.lay
Normal file
8
upptst/I18NCtrlLayoutTest/Layout.lay
Normal file
|
|
@ -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
|
||||
|
||||
4
upptst/I18NCtrlLayoutTest/init
Normal file
4
upptst/I18NCtrlLayoutTest/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _I18NCtrlLayoutTest_icpp_init_stub
|
||||
#define _I18NCtrlLayoutTest_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
74
upptst/I18NCtrlLayoutTest/main.cpp
Normal file
74
upptst/I18NCtrlLayoutTest/main.cpp
Normal file
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
9
upptst/WMF/WMF.upp
Normal file
9
upptst/WMF/WMF.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
4
upptst/WMF/init
Normal file
4
upptst/WMF/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _WMF_icpp_init_stub
|
||||
#define _WMF_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
22
upptst/WMF/main.cpp
Normal file
22
upptst/WMF/main.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue