mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-25 14:22:54 -06:00
Syncing uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@2149 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
4371834b33
commit
ea66c2f3f1
9 changed files with 63 additions and 58 deletions
|
|
@ -2,44 +2,24 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
struct EditStringSpecial : EditString {
|
||||
ArrayCtrl *GetArrayCtrl() {
|
||||
for(Ctrl *q = GetParent(); q; q = q->GetParent())
|
||||
if(ArrayCtrl *a = dynamic_cast<ArrayCtrl *>(q))
|
||||
return a;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void DoMenu(EditStringSpecial *x) {
|
||||
MenuBar bar;
|
||||
x->StdBar(bar);
|
||||
ArrayCtrl *a = x->GetArrayCtrl();
|
||||
if(a) {
|
||||
bar.Separator();
|
||||
a->WhenBar(bar);
|
||||
}
|
||||
bar.Execute();
|
||||
}
|
||||
|
||||
void MyBar(Bar& bar)
|
||||
{
|
||||
PostCallback(callback1(DoMenu, this));
|
||||
}
|
||||
|
||||
typedef EditStringSpecial CLASSNAME;
|
||||
|
||||
EditStringSpecial() {
|
||||
WhenBar = THISBACK(MyBar);
|
||||
}
|
||||
};
|
||||
void WidgetFactory(int line, One<Ctrl>& x)
|
||||
{
|
||||
if(line & 1)
|
||||
x.Create<EditString>();
|
||||
else
|
||||
x.Create<Option>().SetLabel("Line " + AsString(line));
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
ArrayCtrl a;
|
||||
a.Appending().Removing();
|
||||
a.AddColumn("Text").Ctrls<EditStringSpecial>();
|
||||
a.AddColumn("Text").Ctrls(WidgetFactory);
|
||||
for(int i = 0; i < 300; i++)
|
||||
a.Add(AsString(i));
|
||||
for(int i = 0; i < 300; i += 3)
|
||||
a.GetCtrl(i, 0)->Disable();
|
||||
|
||||
a.SetLineCy(Draw::GetStdFontCy() + 8);
|
||||
|
||||
TopWindow app;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue