From 4a5d0fc6bec674e2564c283f562107fea71cd1dd Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 15 May 2014 09:12:27 +0000 Subject: [PATCH] reference: SuggestCtrl git-svn-id: svn://ultimatepp.org/upp/trunk@7377 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- reference/SuggestCtrl/SuggestCtrl.upp | 11 ++++++ reference/SuggestCtrl/init | 4 ++ reference/SuggestCtrl/main.cpp | 57 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 reference/SuggestCtrl/SuggestCtrl.upp create mode 100644 reference/SuggestCtrl/init create mode 100644 reference/SuggestCtrl/main.cpp diff --git a/reference/SuggestCtrl/SuggestCtrl.upp b/reference/SuggestCtrl/SuggestCtrl.upp new file mode 100644 index 000000000..12d03f4c8 --- /dev/null +++ b/reference/SuggestCtrl/SuggestCtrl.upp @@ -0,0 +1,11 @@ +description "Demostrates SuggestCtrl, string editor giving suggestions\377"; + +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI SSE2"; + diff --git a/reference/SuggestCtrl/init b/reference/SuggestCtrl/init new file mode 100644 index 000000000..bcb64636d --- /dev/null +++ b/reference/SuggestCtrl/init @@ -0,0 +1,4 @@ +#ifndef _SuggestCtrl_icpp_init_stub +#define _SuggestCtrl_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/reference/SuggestCtrl/main.cpp b/reference/SuggestCtrl/main.cpp new file mode 100644 index 000000000..548e211ab --- /dev/null +++ b/reference/SuggestCtrl/main.cpp @@ -0,0 +1,57 @@ +#include + +using namespace Upp; + +inline int CharFilterToUpperAscii(int c) +{ + return ToUpper(ToAscii(c)); +} + +int Sep(int c) +{ + return c == ';' || c == ',' ? ';' : 0; +} + +GUI_APP_MAIN +{ + TopWindow win; + SuggestCtrl ctrl; + + static const char *cpp[] = { + "namespace", "asm", "__asm", "else", "struct", + "enum", "switch", "auto", "__except", "template", + "explicit", "this", + "bool", "extern", "mutable", "thread", + "break", "false", "throw", + "case", "__fastcall", "true", + "catch", "__finally", "new", "try", + "__cdecl", "float", "__try", + "char", "wchar_t", "for", "operator", "typedef", + "class", "friend", "private", "typeid", + "const", "goto", "protected", "typename", + "const_cast", "if", "public", "union", + "continue", "inline", "register", "unsigned", + "__declspec", "__inline", "reinterpret_cast", "using", + "using", "default", "int", "return", + "delete", "__int8", "short", "__uuidof", + "dllexport", "__int16", "signed", "virtual", + "dllimport", "__int32", "sizeof", "void", + "do", "__int64", "static", "volatile", + "double", "__leave", "static_cast", + "dynamic_cast", "long", "__stdcall", "while", + "force_inline", + "and", "bitor", "or", "xor", + "compl", "bitand", "and_eq", "or_eq", + "xor_eq", "not", "not_eq", + "char16_t", "char32_t", "constexpr", "decltype", + "noexcept", "nullptr", "static_assert", + "override", "final" + }; + + for(int i = 0; i < __countof(cpp); i++) + ctrl.Add(cpp[i]); + ctrl.Delimiter(Sep); + ctrl.CompareFilter(CharFilterToUpperAscii); + win.Add(ctrl.HSizePos().TopPos(0)); + win.Run(); +}