mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
.uppstst
git-svn-id: svn://ultimatepp.org/upp/trunk@13362 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
88f674a2ba
commit
d7050693a6
6 changed files with 96 additions and 0 deletions
19
upptst/ArrayCtrlSel/ArrayCtrlSel.h
Normal file
19
upptst/ArrayCtrlSel/ArrayCtrlSel.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef _ArrayCtrlSel_ArrayCtrlSel_h
|
||||
#define _ArrayCtrlSel_ArrayCtrlSel_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define LAYOUTFILE <ArrayCtrlSel/ArrayCtrlSel.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
class ArrayCtrlSel : public WithArrayCtrlSelLayout<TopWindow> {
|
||||
public:
|
||||
int serial = 0;
|
||||
|
||||
typedef ArrayCtrlSel CLASSNAME;
|
||||
ArrayCtrlSel();
|
||||
};
|
||||
|
||||
#endif
|
||||
9
upptst/ArrayCtrlSel/ArrayCtrlSel.lay
Normal file
9
upptst/ArrayCtrlSel/ArrayCtrlSel.lay
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
LAYOUT(ArrayCtrlSelLayout, 468, 212)
|
||||
ITEM(ArrayCtrl, list, LeftPosZ(8, 150).TopPosZ(8, 196))
|
||||
ITEM(Label, counter, LeftPosZ(164, 296).TopPosZ(8, 19))
|
||||
ITEM(Label, dv___2, SetLabel(t_("IsSel")).LeftPosZ(164, 56).TopPosZ(32, 20))
|
||||
ITEM(Label, sel, LeftPosZ(224, 236).TopPosZ(32, 19))
|
||||
ITEM(Label, dv___4, SetLabel(t_("IsSelected")).LeftPosZ(164, 52).TopPosZ(56, 20))
|
||||
ITEM(Label, selected, LeftPosZ(224, 236).TopPosZ(56, 19))
|
||||
END_LAYOUT
|
||||
|
||||
11
upptst/ArrayCtrlSel/ArrayCtrlSel.upp
Normal file
11
upptst/ArrayCtrlSel/ArrayCtrlSel.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
ArrayCtrlSel.h,
|
||||
main.cpp,
|
||||
ArrayCtrlSel.lay;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
27
upptst/ArrayCtrlSel/main.cpp
Normal file
27
upptst/ArrayCtrlSel/main.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include "ArrayCtrlSel.h"
|
||||
|
||||
ArrayCtrlSel::ArrayCtrlSel()
|
||||
{
|
||||
CtrlLayout(*this, "Window title");
|
||||
list.MultiSelect();
|
||||
list.AddColumn("Column");
|
||||
for(int i = 0; i < 10; i++)
|
||||
list.Add(i);
|
||||
list.WhenSel = [=] {
|
||||
counter.SetLabel(AsString(serial++));
|
||||
String ssel, sselected;
|
||||
for(int i = 0; i < list.GetCount(); i++) {
|
||||
if(list.IsSel(i))
|
||||
MergeWith(ssel, ", ", AsString(i));
|
||||
if(list.IsSelected(i))
|
||||
MergeWith(sselected, ", ", AsString(i));
|
||||
}
|
||||
sel.SetLabel(ssel);
|
||||
selected.SetLabel(sselected);
|
||||
};
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
ArrayCtrlSel().Run();
|
||||
}
|
||||
21
upptst/TryRealloc/TryRealloc.cpp
Normal file
21
upptst/TryRealloc/TryRealloc.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
for(size_t isz : { 10, 4000, 100000 }) {
|
||||
RLOG("=============================================");
|
||||
RDUMP(isz);
|
||||
void *ptr = MemoryAlloc(isz);
|
||||
for(size_t sz : { 10, 5000, 10000, 2000, 40000, 70000 }) {
|
||||
RDUMP(sz);
|
||||
RDUMP(MemoryTryRealloc(ptr, sz));
|
||||
RDUMP(sz);
|
||||
RLOG("--------");
|
||||
}
|
||||
MemoryFree(ptr);
|
||||
}
|
||||
}
|
||||
9
upptst/TryRealloc/TryRealloc.upp
Normal file
9
upptst/TryRealloc/TryRealloc.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
TryRealloc.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue