diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..2763916 Binary files /dev/null and b/.DS_Store differ diff --git a/programming-guide-zh/.DS_Store b/programming-guide-zh/.DS_Store new file mode 100644 index 0000000..7760699 Binary files /dev/null and b/programming-guide-zh/.DS_Store differ diff --git a/programming-guide-zh/figures/.DS_Store b/programming-guide-zh/figures/.DS_Store new file mode 100644 index 0000000..e13808c Binary files /dev/null and b/programming-guide-zh/figures/.DS_Store differ diff --git a/programming-guide-zh/figures/Part1Chapter01-01.jpeg b/programming-guide-zh/figures/Part1Chapter01-01.jpeg new file mode 100644 index 0000000..8898112 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter01-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter02-01.jpeg b/programming-guide-zh/figures/Part1Chapter02-01.jpeg new file mode 100644 index 0000000..90e8809 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter02-02.jpeg b/programming-guide-zh/figures/Part1Chapter02-02.jpeg new file mode 100644 index 0000000..fa7a8e0 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-02.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter02-03.jpeg b/programming-guide-zh/figures/Part1Chapter02-03.jpeg new file mode 100644 index 0000000..9d38854 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-03.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter02-04.png b/programming-guide-zh/figures/Part1Chapter02-04.png new file mode 100644 index 0000000..8be4a16 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-04.png differ diff --git a/programming-guide-zh/figures/Part1Chapter02-05.png b/programming-guide-zh/figures/Part1Chapter02-05.png new file mode 100644 index 0000000..8acad9e Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-05.png differ diff --git a/programming-guide-zh/figures/Part1Chapter02-06.png b/programming-guide-zh/figures/Part1Chapter02-06.png new file mode 100644 index 0000000..02464dc Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-06.png differ diff --git a/programming-guide-zh/figures/Part1Chapter02-07.png b/programming-guide-zh/figures/Part1Chapter02-07.png new file mode 100644 index 0000000..5d6c0b7 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-07.png differ diff --git a/programming-guide-zh/figures/Part1Chapter02-08.jpeg b/programming-guide-zh/figures/Part1Chapter02-08.jpeg new file mode 100644 index 0000000..5d7ed96 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-08.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter02-09.jpeg b/programming-guide-zh/figures/Part1Chapter02-09.jpeg new file mode 100644 index 0000000..fb4cfb6 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter02-09.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter03-01.jpeg b/programming-guide-zh/figures/Part1Chapter03-01.jpeg new file mode 100644 index 0000000..4b44d3c Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter03-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter04-01.jpeg b/programming-guide-zh/figures/Part1Chapter04-01.jpeg new file mode 100644 index 0000000..91ad968 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter04-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter05-01.jpeg b/programming-guide-zh/figures/Part1Chapter05-01.jpeg new file mode 100644 index 0000000..75b879b Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter05-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter06-01.jpeg b/programming-guide-zh/figures/Part1Chapter06-01.jpeg new file mode 100644 index 0000000..43927a2 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter06-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter06-02.jpeg b/programming-guide-zh/figures/Part1Chapter06-02.jpeg new file mode 100644 index 0000000..23616fa Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter06-02.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter07-01.jpeg b/programming-guide-zh/figures/Part1Chapter07-01.jpeg new file mode 100644 index 0000000..fa25f68 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter07-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter07-02.jpeg b/programming-guide-zh/figures/Part1Chapter07-02.jpeg new file mode 100644 index 0000000..0587389 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter07-02.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter07-03.jpeg b/programming-guide-zh/figures/Part1Chapter07-03.jpeg new file mode 100644 index 0000000..8e9a799 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter07-03.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter07-04.jpeg b/programming-guide-zh/figures/Part1Chapter07-04.jpeg new file mode 100644 index 0000000..a8ca711 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter07-04.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter08-01.jpeg b/programming-guide-zh/figures/Part1Chapter08-01.jpeg new file mode 100644 index 0000000..4da0a74 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter08-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter08-02.jpeg b/programming-guide-zh/figures/Part1Chapter08-02.jpeg new file mode 100644 index 0000000..563add5 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter08-02.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter08-03.jpeg b/programming-guide-zh/figures/Part1Chapter08-03.jpeg new file mode 100644 index 0000000..61220a0 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter08-03.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter09-01.jpeg b/programming-guide-zh/figures/Part1Chapter09-01.jpeg new file mode 100644 index 0000000..ad05093 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter09-01.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter09-02.jpeg b/programming-guide-zh/figures/Part1Chapter09-02.jpeg new file mode 100644 index 0000000..012fd7a Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter09-02.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter09-03.jpeg b/programming-guide-zh/figures/Part1Chapter09-03.jpeg new file mode 100644 index 0000000..1dfad30 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter09-03.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter09-04.jpeg b/programming-guide-zh/figures/Part1Chapter09-04.jpeg new file mode 100644 index 0000000..f1912ad Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter09-04.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter10-01.gif b/programming-guide-zh/figures/Part1Chapter10-01.gif new file mode 100644 index 0000000..c435eab Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter10-01.gif differ diff --git a/programming-guide-zh/figures/Part1Chapter10-02.png b/programming-guide-zh/figures/Part1Chapter10-02.png new file mode 100644 index 0000000..101109f Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter10-02.png differ diff --git a/programming-guide-zh/figures/Part1Chapter12-01.jpg b/programming-guide-zh/figures/Part1Chapter12-01.jpg new file mode 100644 index 0000000..1947be7 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-01.jpg differ diff --git a/programming-guide-zh/figures/Part1Chapter12-02.jpg b/programming-guide-zh/figures/Part1Chapter12-02.jpg new file mode 100644 index 0000000..addd199 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-02.jpg differ diff --git a/programming-guide-zh/figures/Part1Chapter12-03.png b/programming-guide-zh/figures/Part1Chapter12-03.png new file mode 100644 index 0000000..687dac4 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-03.png differ diff --git a/programming-guide-zh/figures/Part1Chapter12-04.png b/programming-guide-zh/figures/Part1Chapter12-04.png new file mode 100644 index 0000000..7179d8d Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-04.png differ diff --git a/programming-guide-zh/figures/Part1Chapter12-05.png b/programming-guide-zh/figures/Part1Chapter12-05.png new file mode 100644 index 0000000..13b4b3a Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-05.png differ diff --git a/programming-guide-zh/figures/Part1Chapter12-06.png b/programming-guide-zh/figures/Part1Chapter12-06.png new file mode 100644 index 0000000..8c974c3 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-06.png differ diff --git a/programming-guide-zh/figures/Part1Chapter12-07.png b/programming-guide-zh/figures/Part1Chapter12-07.png new file mode 100644 index 0000000..7e3d200 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-07.png differ diff --git a/programming-guide-zh/figures/Part1Chapter12-08.jpeg b/programming-guide-zh/figures/Part1Chapter12-08.jpeg new file mode 100644 index 0000000..f03021c Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-08.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter12-09.jpeg b/programming-guide-zh/figures/Part1Chapter12-09.jpeg new file mode 100644 index 0000000..a554b42 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-09.jpeg differ diff --git a/programming-guide-zh/figures/Part1Chapter12-10.jpg b/programming-guide-zh/figures/Part1Chapter12-10.jpg new file mode 100644 index 0000000..aba5780 Binary files /dev/null and b/programming-guide-zh/figures/Part1Chapter12-10.jpg differ diff --git a/programming-guide-zh/figures/Part2Chapter03-01.png b/programming-guide-zh/figures/Part2Chapter03-01.png new file mode 100644 index 0000000..d070d78 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter03-01.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-01.png b/programming-guide-zh/figures/Part2Chapter05-01.png new file mode 100644 index 0000000..93f30a7 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-01.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-02.png b/programming-guide-zh/figures/Part2Chapter05-02.png new file mode 100644 index 0000000..9195873 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-02.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-03.png b/programming-guide-zh/figures/Part2Chapter05-03.png new file mode 100644 index 0000000..c732e58 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-03.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-04.png b/programming-guide-zh/figures/Part2Chapter05-04.png new file mode 100644 index 0000000..3a3cd5e Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-04.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-05.png b/programming-guide-zh/figures/Part2Chapter05-05.png new file mode 100644 index 0000000..0689a8c Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-05.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-06.png b/programming-guide-zh/figures/Part2Chapter05-06.png new file mode 100644 index 0000000..fa8f545 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-06.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-07.png b/programming-guide-zh/figures/Part2Chapter05-07.png new file mode 100644 index 0000000..693a78a Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-07.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-08.png b/programming-guide-zh/figures/Part2Chapter05-08.png new file mode 100644 index 0000000..843d5a6 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-08.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-09.png b/programming-guide-zh/figures/Part2Chapter05-09.png new file mode 100644 index 0000000..e5de5f9 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-09.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-10.png b/programming-guide-zh/figures/Part2Chapter05-10.png new file mode 100644 index 0000000..bba3ae1 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-10.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-11.png b/programming-guide-zh/figures/Part2Chapter05-11.png new file mode 100644 index 0000000..eab5f1e Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-11.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-12.png b/programming-guide-zh/figures/Part2Chapter05-12.png new file mode 100644 index 0000000..17e6faf Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-12.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-13.png b/programming-guide-zh/figures/Part2Chapter05-13.png new file mode 100644 index 0000000..56b7aac Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-13.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-14.png b/programming-guide-zh/figures/Part2Chapter05-14.png new file mode 100644 index 0000000..ac48ff3 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-14.png differ diff --git a/programming-guide-zh/figures/Part2Chapter05-15.png b/programming-guide-zh/figures/Part2Chapter05-15.png new file mode 100644 index 0000000..efc7f24 Binary files /dev/null and b/programming-guide-zh/figures/Part2Chapter05-15.png differ diff --git a/programming-guide-zh/figures/Part3Chapter01-01.jpeg b/programming-guide-zh/figures/Part3Chapter01-01.jpeg new file mode 100644 index 0000000..9f25149 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter01-01.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter01-02.jpeg b/programming-guide-zh/figures/Part3Chapter01-02.jpeg new file mode 100644 index 0000000..1796adc Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter01-02.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter01-03.jpeg b/programming-guide-zh/figures/Part3Chapter01-03.jpeg new file mode 100644 index 0000000..d7c7c88 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter01-03.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter02-01.jpeg b/programming-guide-zh/figures/Part3Chapter02-01.jpeg new file mode 100644 index 0000000..53f395e Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter02-01.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter02-02.jpeg b/programming-guide-zh/figures/Part3Chapter02-02.jpeg new file mode 100644 index 0000000..7d21377 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter02-02.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter02-03.jpeg b/programming-guide-zh/figures/Part3Chapter02-03.jpeg new file mode 100644 index 0000000..9e03738 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter02-03.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter02-0digits1.png b/programming-guide-zh/figures/Part3Chapter02-0digits1.png new file mode 100644 index 0000000..1951911 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter02-0digits1.png differ diff --git a/programming-guide-zh/figures/Part3Chapter02-0digits2.png b/programming-guide-zh/figures/Part3Chapter02-0digits2.png new file mode 100644 index 0000000..8049312 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter02-0digits2.png differ diff --git a/programming-guide-zh/figures/Part3Chapter02-0digits3.png b/programming-guide-zh/figures/Part3Chapter02-0digits3.png new file mode 100644 index 0000000..1cc8b26 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter02-0digits3.png differ diff --git a/programming-guide-zh/figures/Part3Chapter02-0digits4.png b/programming-guide-zh/figures/Part3Chapter02-0digits4.png new file mode 100644 index 0000000..9a47704 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter02-0digits4.png differ diff --git a/programming-guide-zh/figures/Part3Chapter03-01.jpeg b/programming-guide-zh/figures/Part3Chapter03-01.jpeg new file mode 100644 index 0000000..db54cee Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter03-01.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter03-02.jpeg b/programming-guide-zh/figures/Part3Chapter03-02.jpeg new file mode 100644 index 0000000..a248072 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter03-02.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter03-03.jpeg b/programming-guide-zh/figures/Part3Chapter03-03.jpeg new file mode 100644 index 0000000..0466929 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter03-03.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter03-04.jpeg b/programming-guide-zh/figures/Part3Chapter03-04.jpeg new file mode 100644 index 0000000..d5e92db Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter03-04.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter03-05.jpeg b/programming-guide-zh/figures/Part3Chapter03-05.jpeg new file mode 100644 index 0000000..fee295b Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter03-05.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter03-06.jpeg b/programming-guide-zh/figures/Part3Chapter03-06.jpeg new file mode 100644 index 0000000..41772d5 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter03-06.jpeg differ diff --git a/programming-guide-zh/figures/Part3Chapter03-07.jpeg b/programming-guide-zh/figures/Part3Chapter03-07.jpeg new file mode 100644 index 0000000..b690aa9 Binary files /dev/null and b/programming-guide-zh/figures/Part3Chapter03-07.jpeg differ diff --git a/programming-guide-zh/figures/Part5Chapter01-01.jpeg b/programming-guide-zh/figures/Part5Chapter01-01.jpeg new file mode 100644 index 0000000..4bc25c8 Binary files /dev/null and b/programming-guide-zh/figures/Part5Chapter01-01.jpeg differ diff --git a/programming-guide-zh/figures/Part5Chapter02-01.jpeg b/programming-guide-zh/figures/Part5Chapter02-01.jpeg new file mode 100644 index 0000000..6de3106 Binary files /dev/null and b/programming-guide-zh/figures/Part5Chapter02-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter01-01.jpeg b/programming-guide-zh/figures/Part6Chapter01-01.jpeg new file mode 100644 index 0000000..9740576 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter01-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter01-02.jpeg b/programming-guide-zh/figures/Part6Chapter01-02.jpeg new file mode 100644 index 0000000..7dbb8f7 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter01-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter01-03.jpeg b/programming-guide-zh/figures/Part6Chapter01-03.jpeg new file mode 100644 index 0000000..38dd106 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter01-03.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter01-04.jpeg b/programming-guide-zh/figures/Part6Chapter01-04.jpeg new file mode 100644 index 0000000..8fb3755 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter01-04.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter01-05.jpeg b/programming-guide-zh/figures/Part6Chapter01-05.jpeg new file mode 100644 index 0000000..1754614 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter01-05.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter01-06.jpeg b/programming-guide-zh/figures/Part6Chapter01-06.jpeg new file mode 100644 index 0000000..47c0867 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter01-06.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter02-01.jpeg b/programming-guide-zh/figures/Part6Chapter02-01.jpeg new file mode 100644 index 0000000..17a1e49 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter02-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter02-02.jpeg b/programming-guide-zh/figures/Part6Chapter02-02.jpeg new file mode 100644 index 0000000..f219b37 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter02-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter02-03.jpeg b/programming-guide-zh/figures/Part6Chapter02-03.jpeg new file mode 100644 index 0000000..bb655c9 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter02-03.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter02-04.jpeg b/programming-guide-zh/figures/Part6Chapter02-04.jpeg new file mode 100644 index 0000000..b649370 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter02-04.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter02-05.jpeg b/programming-guide-zh/figures/Part6Chapter02-05.jpeg new file mode 100644 index 0000000..4cef2ab Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter02-05.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter03-01.jpeg b/programming-guide-zh/figures/Part6Chapter03-01.jpeg new file mode 100644 index 0000000..6c39fd0 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter03-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter03-02.jpeg b/programming-guide-zh/figures/Part6Chapter03-02.jpeg new file mode 100644 index 0000000..8afba09 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter03-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter03-03.jpeg b/programming-guide-zh/figures/Part6Chapter03-03.jpeg new file mode 100644 index 0000000..44a8936 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter03-03.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter03-04.jpeg b/programming-guide-zh/figures/Part6Chapter03-04.jpeg new file mode 100644 index 0000000..01ff84c Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter03-04.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter04-01.jpeg b/programming-guide-zh/figures/Part6Chapter04-01.jpeg new file mode 100644 index 0000000..bc8aaaf Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter04-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter04-02.jpeg b/programming-guide-zh/figures/Part6Chapter04-02.jpeg new file mode 100644 index 0000000..426610e Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter04-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter05-01.jpeg b/programming-guide-zh/figures/Part6Chapter05-01.jpeg new file mode 100644 index 0000000..d5a5603 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter05-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter05-02.jpeg b/programming-guide-zh/figures/Part6Chapter05-02.jpeg new file mode 100644 index 0000000..ec6a116 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter05-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter05-03.jpeg b/programming-guide-zh/figures/Part6Chapter05-03.jpeg new file mode 100644 index 0000000..81290f4 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter05-03.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter05-04.jpeg b/programming-guide-zh/figures/Part6Chapter05-04.jpeg new file mode 100644 index 0000000..c631498 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter05-04.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter05-05.jpeg b/programming-guide-zh/figures/Part6Chapter05-05.jpeg new file mode 100644 index 0000000..2d8a38c Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter05-05.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter05-06.jpeg b/programming-guide-zh/figures/Part6Chapter05-06.jpeg new file mode 100644 index 0000000..abbfc7b Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter05-06.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter06-01.jpeg b/programming-guide-zh/figures/Part6Chapter06-01.jpeg new file mode 100644 index 0000000..3cc36d1 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter06-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter06-02.jpeg b/programming-guide-zh/figures/Part6Chapter06-02.jpeg new file mode 100644 index 0000000..8652201 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter06-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter07-01.jpeg b/programming-guide-zh/figures/Part6Chapter07-01.jpeg new file mode 100644 index 0000000..4866192 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter07-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter07-02.jpeg b/programming-guide-zh/figures/Part6Chapter07-02.jpeg new file mode 100644 index 0000000..c9f100b Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter07-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter07-03.jpeg b/programming-guide-zh/figures/Part6Chapter07-03.jpeg new file mode 100644 index 0000000..cd11951 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter07-03.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter08-01.jpeg b/programming-guide-zh/figures/Part6Chapter08-01.jpeg new file mode 100644 index 0000000..cb3f96b Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter08-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter08-02.jpeg b/programming-guide-zh/figures/Part6Chapter08-02.jpeg new file mode 100644 index 0000000..6627879 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter08-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter08-03.jpeg b/programming-guide-zh/figures/Part6Chapter08-03.jpeg new file mode 100644 index 0000000..17f8cfc Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter08-03.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter09-01.jpeg b/programming-guide-zh/figures/Part6Chapter09-01.jpeg new file mode 100644 index 0000000..ef380d1 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter09-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter09-02.jpeg b/programming-guide-zh/figures/Part6Chapter09-02.jpeg new file mode 100644 index 0000000..29ad5a9 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter09-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter09-03.jpeg b/programming-guide-zh/figures/Part6Chapter09-03.jpeg new file mode 100644 index 0000000..0173459 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter09-03.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter09-04.jpeg b/programming-guide-zh/figures/Part6Chapter09-04.jpeg new file mode 100644 index 0000000..16ade24 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter09-04.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter10-01.jpeg b/programming-guide-zh/figures/Part6Chapter10-01.jpeg new file mode 100644 index 0000000..541e03c Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter10-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter10-02.jpeg b/programming-guide-zh/figures/Part6Chapter10-02.jpeg new file mode 100644 index 0000000..2c28843 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter10-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter11-01.jpeg b/programming-guide-zh/figures/Part6Chapter11-01.jpeg new file mode 100644 index 0000000..3563d4e Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter11-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter11-02.jpeg b/programming-guide-zh/figures/Part6Chapter11-02.jpeg new file mode 100644 index 0000000..8dab9d6 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter11-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter12-01.jpeg b/programming-guide-zh/figures/Part6Chapter12-01.jpeg new file mode 100644 index 0000000..6edfc33 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter12-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter12-02.jpeg b/programming-guide-zh/figures/Part6Chapter12-02.jpeg new file mode 100644 index 0000000..83f0b1e Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter12-02.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter13-01.jpeg b/programming-guide-zh/figures/Part6Chapter13-01.jpeg new file mode 100644 index 0000000..6accde2 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter13-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter14-01.jpeg b/programming-guide-zh/figures/Part6Chapter14-01.jpeg new file mode 100644 index 0000000..e0ebbf2 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter14-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter15-01.jpeg b/programming-guide-zh/figures/Part6Chapter15-01.jpeg new file mode 100644 index 0000000..802cb42 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter15-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter16-01.jpeg b/programming-guide-zh/figures/Part6Chapter16-01.jpeg new file mode 100644 index 0000000..a62d1b1 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter16-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter17-01.jpeg b/programming-guide-zh/figures/Part6Chapter17-01.jpeg new file mode 100644 index 0000000..43f4f31 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter17-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter18-01.jpeg b/programming-guide-zh/figures/Part6Chapter18-01.jpeg new file mode 100644 index 0000000..0bb88a8 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter18-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter19-01.jpeg b/programming-guide-zh/figures/Part6Chapter19-01.jpeg new file mode 100644 index 0000000..2d4090c Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter19-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter20-01.jpeg b/programming-guide-zh/figures/Part6Chapter20-01.jpeg new file mode 100644 index 0000000..ae16f11 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter20-01.jpeg differ diff --git a/programming-guide-zh/figures/Part6Chapter21-01.gif b/programming-guide-zh/figures/Part6Chapter21-01.gif new file mode 100644 index 0000000..f5fa633 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter21-01.gif differ diff --git a/programming-guide-zh/figures/Part6Chapter21-02.gif b/programming-guide-zh/figures/Part6Chapter21-02.gif new file mode 100644 index 0000000..f965108 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter21-02.gif differ diff --git a/programming-guide-zh/figures/Part6Chapter21-03.png b/programming-guide-zh/figures/Part6Chapter21-03.png new file mode 100644 index 0000000..8a3ece8 Binary files /dev/null and b/programming-guide-zh/figures/Part6Chapter21-03.png differ diff --git a/programming-guide-zh/figures/animation_screenshot.png b/programming-guide-zh/figures/animation_screenshot.png new file mode 100644 index 0000000..66e0f22 Binary files /dev/null and b/programming-guide-zh/figures/animation_screenshot.png differ diff --git a/programming-guide-zh/figures/btn.png b/programming-guide-zh/figures/btn.png new file mode 100644 index 0000000..445bb0a Binary files /dev/null and b/programming-guide-zh/figures/btn.png differ diff --git a/programming-guide-zh/figures/check_button.png b/programming-guide-zh/figures/check_button.png new file mode 100644 index 0000000..1b9af63 Binary files /dev/null and b/programming-guide-zh/figures/check_button.png differ diff --git a/programming-guide-zh/figures/checkbtn_fashion_disable.png b/programming-guide-zh/figures/checkbtn_fashion_disable.png new file mode 100644 index 0000000..52a4ab7 Binary files /dev/null and b/programming-guide-zh/figures/checkbtn_fashion_disable.png differ diff --git a/programming-guide-zh/figures/checkbtn_fashion_fgc.png b/programming-guide-zh/figures/checkbtn_fashion_fgc.png new file mode 100644 index 0000000..5b96379 Binary files /dev/null and b/programming-guide-zh/figures/checkbtn_fashion_fgc.png differ diff --git a/programming-guide-zh/figures/checkbtn_flat_bgc.png b/programming-guide-zh/figures/checkbtn_flat_bgc.png new file mode 100644 index 0000000..2473416 Binary files /dev/null and b/programming-guide-zh/figures/checkbtn_flat_bgc.png differ diff --git a/programming-guide-zh/figures/checkbtn_flat_fgc.png b/programming-guide-zh/figures/checkbtn_flat_fgc.png new file mode 100644 index 0000000..5b113f7 Binary files /dev/null and b/programming-guide-zh/figures/checkbtn_flat_fgc.png differ diff --git a/programming-guide-zh/figures/checkbutton.png b/programming-guide-zh/figures/checkbutton.png new file mode 100644 index 0000000..218729e Binary files /dev/null and b/programming-guide-zh/figures/checkbutton.png differ diff --git a/programming-guide-zh/figures/checkbutton_classic_fgc.png b/programming-guide-zh/figures/checkbutton_classic_fgc.png new file mode 100644 index 0000000..7b9ae78 Binary files /dev/null and b/programming-guide-zh/figures/checkbutton_classic_fgc.png differ diff --git a/programming-guide-zh/figures/checkbutton_classic_textdisable.png b/programming-guide-zh/figures/checkbutton_classic_textdisable.png new file mode 100644 index 0000000..7a408a9 Binary files /dev/null and b/programming-guide-zh/figures/checkbutton_classic_textdisable.png differ diff --git a/programming-guide-zh/figures/classic_check_button.bmp b/programming-guide-zh/figures/classic_check_button.bmp new file mode 100644 index 0000000..5fc678c Binary files /dev/null and b/programming-guide-zh/figures/classic_check_button.bmp differ diff --git a/programming-guide-zh/figures/classic_prog.png b/programming-guide-zh/figures/classic_prog.png new file mode 100644 index 0000000..6acbc10 Binary files /dev/null and b/programming-guide-zh/figures/classic_prog.png differ diff --git a/programming-guide-zh/figures/classic_radio_button.bmp b/programming-guide-zh/figures/classic_radio_button.bmp new file mode 100644 index 0000000..32f0f6b Binary files /dev/null and b/programming-guide-zh/figures/classic_radio_button.bmp differ diff --git a/programming-guide-zh/figures/color_button.png b/programming-guide-zh/figures/color_button.png new file mode 100644 index 0000000..b1cdcd9 Binary files /dev/null and b/programming-guide-zh/figures/color_button.png differ diff --git a/programming-guide-zh/figures/colorbutton.png b/programming-guide-zh/figures/colorbutton.png new file mode 100644 index 0000000..32584d3 Binary files /dev/null and b/programming-guide-zh/figures/colorbutton.png differ diff --git a/programming-guide-zh/figures/com.png b/programming-guide-zh/figures/com.png new file mode 100644 index 0000000..8180801 Binary files /dev/null and b/programming-guide-zh/figures/com.png differ diff --git a/programming-guide-zh/figures/combo.png b/programming-guide-zh/figures/combo.png new file mode 100644 index 0000000..dc32670 Binary files /dev/null and b/programming-guide-zh/figures/combo.png differ diff --git a/programming-guide-zh/figures/container_demo.png b/programming-guide-zh/figures/container_demo.png new file mode 100644 index 0000000..a82c1e6 Binary files /dev/null and b/programming-guide-zh/figures/container_demo.png differ diff --git a/programming-guide-zh/figures/data_binding.png b/programming-guide-zh/figures/data_binding.png new file mode 100644 index 0000000..f6d81f4 Binary files /dev/null and b/programming-guide-zh/figures/data_binding.png differ diff --git a/programming-guide-zh/figures/data_binding_model.png b/programming-guide-zh/figures/data_binding_model.png new file mode 100644 index 0000000..c25f38f Binary files /dev/null and b/programming-guide-zh/figures/data_binding_model.png differ diff --git a/programming-guide-zh/figures/data_source.png b/programming-guide-zh/figures/data_source.png new file mode 100644 index 0000000..9d092a5 Binary files /dev/null and b/programming-guide-zh/figures/data_source.png differ diff --git a/programming-guide-zh/figures/edit.png b/programming-guide-zh/figures/edit.png new file mode 100644 index 0000000..5d24b43 Binary files /dev/null and b/programming-guide-zh/figures/edit.png differ diff --git a/programming-guide-zh/figures/event-listener.png b/programming-guide-zh/figures/event-listener.png new file mode 100644 index 0000000..3c89069 Binary files /dev/null and b/programming-guide-zh/figures/event-listener.png differ diff --git a/programming-guide-zh/figures/event_listener_model.png b/programming-guide-zh/figures/event_listener_model.png new file mode 100644 index 0000000..3de999f Binary files /dev/null and b/programming-guide-zh/figures/event_listener_model.png differ diff --git a/programming-guide-zh/figures/fashion_check_btn.bmp b/programming-guide-zh/figures/fashion_check_btn.bmp new file mode 100644 index 0000000..2703d72 Binary files /dev/null and b/programming-guide-zh/figures/fashion_check_btn.bmp differ diff --git a/programming-guide-zh/figures/fashion_radio_btn.bmp b/programming-guide-zh/figures/fashion_radio_btn.bmp new file mode 100644 index 0000000..423b973 Binary files /dev/null and b/programming-guide-zh/figures/fashion_radio_btn.bmp differ diff --git a/programming-guide-zh/figures/flat_prog.png b/programming-guide-zh/figures/flat_prog.png new file mode 100644 index 0000000..fd9cb6b Binary files /dev/null and b/programming-guide-zh/figures/flat_prog.png differ diff --git a/programming-guide-zh/figures/fsh_prog.png b/programming-guide-zh/figures/fsh_prog.png new file mode 100644 index 0000000..ced91f1 Binary files /dev/null and b/programming-guide-zh/figures/fsh_prog.png differ diff --git a/programming-guide-zh/figures/helloworld.png b/programming-guide-zh/figures/helloworld.png new file mode 100644 index 0000000..23cd012 Binary files /dev/null and b/programming-guide-zh/figures/helloworld.png differ diff --git a/programming-guide-zh/figures/iconview.png b/programming-guide-zh/figures/iconview.png new file mode 100644 index 0000000..74d40ca Binary files /dev/null and b/programming-guide-zh/figures/iconview.png differ diff --git a/programming-guide-zh/figures/iconview_demo.png b/programming-guide-zh/figures/iconview_demo.png new file mode 100644 index 0000000..01df787 Binary files /dev/null and b/programming-guide-zh/figures/iconview_demo.png differ diff --git a/programming-guide-zh/figures/listbox.png b/programming-guide-zh/figures/listbox.png new file mode 100644 index 0000000..512740b Binary files /dev/null and b/programming-guide-zh/figures/listbox.png differ diff --git a/programming-guide-zh/figures/listbox_demo.png b/programming-guide-zh/figures/listbox_demo.png new file mode 100644 index 0000000..2dc41dc Binary files /dev/null and b/programming-guide-zh/figures/listbox_demo.png differ diff --git a/programming-guide-zh/figures/listview.png b/programming-guide-zh/figures/listview.png new file mode 100644 index 0000000..b177b18 Binary files /dev/null and b/programming-guide-zh/figures/listview.png differ diff --git a/programming-guide-zh/figures/listview_demo.png b/programming-guide-zh/figures/listview_demo.png new file mode 100644 index 0000000..3e628a3 Binary files /dev/null and b/programming-guide-zh/figures/listview_demo.png differ diff --git a/programming-guide-zh/figures/mGEff 编程指南.docx b/programming-guide-zh/figures/mGEff 编程指南.docx new file mode 100644 index 0000000..dc76939 Binary files /dev/null and b/programming-guide-zh/figures/mGEff 编程指南.docx differ diff --git a/programming-guide-zh/figures/mGEff01.png b/programming-guide-zh/figures/mGEff01.png new file mode 100644 index 0000000..8cfe35d Binary files /dev/null and b/programming-guide-zh/figures/mGEff01.png differ diff --git a/programming-guide-zh/figures/menu_button.png b/programming-guide-zh/figures/menu_button.png new file mode 100644 index 0000000..4d1c570 Binary files /dev/null and b/programming-guide-zh/figures/menu_button.png differ diff --git a/programming-guide-zh/figures/menubutton1.png b/programming-guide-zh/figures/menubutton1.png new file mode 100644 index 0000000..7766de7 Binary files /dev/null and b/programming-guide-zh/figures/menubutton1.png differ diff --git a/programming-guide-zh/figures/menubutton2.png b/programming-guide-zh/figures/menubutton2.png new file mode 100644 index 0000000..ffd4a97 Binary files /dev/null and b/programming-guide-zh/figures/menubutton2.png differ diff --git a/programming-guide-zh/figures/mledit.png b/programming-guide-zh/figures/mledit.png new file mode 100644 index 0000000..a270dcb Binary files /dev/null and b/programming-guide-zh/figures/mledit.png differ diff --git a/programming-guide-zh/figures/mtimer.png b/programming-guide-zh/figures/mtimer.png new file mode 100644 index 0000000..178cafb Binary files /dev/null and b/programming-guide-zh/figures/mtimer.png differ diff --git a/programming-guide-zh/figures/panel.png b/programming-guide-zh/figures/panel.png new file mode 100644 index 0000000..d89c4b5 Binary files /dev/null and b/programming-guide-zh/figures/panel.png differ diff --git a/programming-guide-zh/figures/panel_demo.png b/programming-guide-zh/figures/panel_demo.png new file mode 100644 index 0000000..752fb8a Binary files /dev/null and b/programming-guide-zh/figures/panel_demo.png differ diff --git a/programming-guide-zh/figures/prog.png b/programming-guide-zh/figures/prog.png new file mode 100644 index 0000000..f07668f Binary files /dev/null and b/programming-guide-zh/figures/prog.png differ diff --git a/programming-guide-zh/figures/prog_block.png b/programming-guide-zh/figures/prog_block.png new file mode 100644 index 0000000..0c5e6b1 Binary files /dev/null and b/programming-guide-zh/figures/prog_block.png differ diff --git a/programming-guide-zh/figures/prog_per.png b/programming-guide-zh/figures/prog_per.png new file mode 100644 index 0000000..488c2ac Binary files /dev/null and b/programming-guide-zh/figures/prog_per.png differ diff --git a/programming-guide-zh/figures/prog_smooth.png b/programming-guide-zh/figures/prog_smooth.png new file mode 100644 index 0000000..b98e50e Binary files /dev/null and b/programming-guide-zh/figures/prog_smooth.png differ diff --git a/programming-guide-zh/figures/propsheet_demo.png b/programming-guide-zh/figures/propsheet_demo.png new file mode 100644 index 0000000..fe49116 Binary files /dev/null and b/programming-guide-zh/figures/propsheet_demo.png differ diff --git a/programming-guide-zh/figures/push-button-classic-bg3dcolor.png b/programming-guide-zh/figures/push-button-classic-bg3dcolor.png new file mode 100644 index 0000000..8fd948a Binary files /dev/null and b/programming-guide-zh/figures/push-button-classic-bg3dcolor.png differ diff --git a/programming-guide-zh/figures/push-button-classic-bgdisable.png b/programming-guide-zh/figures/push-button-classic-bgdisable.png new file mode 100644 index 0000000..539f437 Binary files /dev/null and b/programming-guide-zh/figures/push-button-classic-bgdisable.png differ diff --git a/programming-guide-zh/figures/push-button-classic-fg3dcolor.png b/programming-guide-zh/figures/push-button-classic-fg3dcolor.png new file mode 100644 index 0000000..b2d217b Binary files /dev/null and b/programming-guide-zh/figures/push-button-classic-fg3dcolor.png differ diff --git a/programming-guide-zh/figures/push-button-classic-fgdisable.png b/programming-guide-zh/figures/push-button-classic-fgdisable.png new file mode 100644 index 0000000..e00e669 Binary files /dev/null and b/programming-guide-zh/figures/push-button-classic-fgdisable.png differ diff --git a/programming-guide-zh/figures/push-button-classic-hilight-check-halfchk.png b/programming-guide-zh/figures/push-button-classic-hilight-check-halfchk.png new file mode 100644 index 0000000..4ca3d5a Binary files /dev/null and b/programming-guide-zh/figures/push-button-classic-hilight-check-halfchk.png differ diff --git a/programming-guide-zh/figures/push-button-fashion-bgcolor.png b/programming-guide-zh/figures/push-button-fashion-bgcolor.png new file mode 100644 index 0000000..6840b21 Binary files /dev/null and b/programming-guide-zh/figures/push-button-fashion-bgcolor.png differ diff --git a/programming-guide-zh/figures/push-button-fashion-bgdisalbe.png b/programming-guide-zh/figures/push-button-fashion-bgdisalbe.png new file mode 100644 index 0000000..ff8730e Binary files /dev/null and b/programming-guide-zh/figures/push-button-fashion-bgdisalbe.png differ diff --git a/programming-guide-zh/figures/push-button-fashion-gradientmode.png b/programming-guide-zh/figures/push-button-fashion-gradientmode.png new file mode 100644 index 0000000..46f0c31 Binary files /dev/null and b/programming-guide-zh/figures/push-button-fashion-gradientmode.png differ diff --git a/programming-guide-zh/figures/push-button-fashion-hilight-check-halfchk.png b/programming-guide-zh/figures/push-button-fashion-hilight-check-halfchk.png new file mode 100644 index 0000000..2b5a897 Binary files /dev/null and b/programming-guide-zh/figures/push-button-fashion-hilight-check-halfchk.png differ diff --git a/programming-guide-zh/figures/push-button-flat-hilight-check-halfchk.png b/programming-guide-zh/figures/push-button-flat-hilight-check-halfchk.png new file mode 100644 index 0000000..3132a8f Binary files /dev/null and b/programming-guide-zh/figures/push-button-flat-hilight-check-halfchk.png differ diff --git a/programming-guide-zh/figures/push_botton.png b/programming-guide-zh/figures/push_botton.png new file mode 100644 index 0000000..ff9b21f Binary files /dev/null and b/programming-guide-zh/figures/push_botton.png differ diff --git a/programming-guide-zh/figures/push_button.png b/programming-guide-zh/figures/push_button.png new file mode 100644 index 0000000..c693dc9 Binary files /dev/null and b/programming-guide-zh/figures/push_button.png differ diff --git a/programming-guide-zh/figures/radio_button.png b/programming-guide-zh/figures/radio_button.png new file mode 100644 index 0000000..0654784 Binary files /dev/null and b/programming-guide-zh/figures/radio_button.png differ diff --git a/programming-guide-zh/figures/radiobtn_fashion_disable.png b/programming-guide-zh/figures/radiobtn_fashion_disable.png new file mode 100644 index 0000000..e0be88e Binary files /dev/null and b/programming-guide-zh/figures/radiobtn_fashion_disable.png differ diff --git a/programming-guide-zh/figures/radiobtn_fashion_fgc.png b/programming-guide-zh/figures/radiobtn_fashion_fgc.png new file mode 100644 index 0000000..1c56291 Binary files /dev/null and b/programming-guide-zh/figures/radiobtn_fashion_fgc.png differ diff --git a/programming-guide-zh/figures/radiobtn_flat_bgc.png b/programming-guide-zh/figures/radiobtn_flat_bgc.png new file mode 100644 index 0000000..af1e3af Binary files /dev/null and b/programming-guide-zh/figures/radiobtn_flat_bgc.png differ diff --git a/programming-guide-zh/figures/radiobtn_flat_fgc.png b/programming-guide-zh/figures/radiobtn_flat_fgc.png new file mode 100644 index 0000000..f4468b8 Binary files /dev/null and b/programming-guide-zh/figures/radiobtn_flat_fgc.png differ diff --git a/programming-guide-zh/figures/radiobutton.png b/programming-guide-zh/figures/radiobutton.png new file mode 100644 index 0000000..6582aa5 Binary files /dev/null and b/programming-guide-zh/figures/radiobutton.png differ diff --git a/programming-guide-zh/figures/radiobutton_classic_fgc.png b/programming-guide-zh/figures/radiobutton_classic_fgc.png new file mode 100644 index 0000000..3cbe81f Binary files /dev/null and b/programming-guide-zh/figures/radiobutton_classic_fgc.png differ diff --git a/programming-guide-zh/figures/radiobutton_classic_textdisable.png b/programming-guide-zh/figures/radiobutton_classic_textdisable.png new file mode 100644 index 0000000..ecff092 Binary files /dev/null and b/programming-guide-zh/figures/radiobutton_classic_textdisable.png differ diff --git a/programming-guide-zh/figures/sample.png b/programming-guide-zh/figures/sample.png new file mode 100644 index 0000000..247150c Binary files /dev/null and b/programming-guide-zh/figures/sample.png differ diff --git a/programming-guide-zh/figures/scrollbar-classic-bg3dcolor.png b/programming-guide-zh/figures/scrollbar-classic-bg3dcolor.png new file mode 100644 index 0000000..ffacf25 Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-classic-bg3dcolor.png differ diff --git a/programming-guide-zh/figures/scrollbar-classic-bgdisable.png b/programming-guide-zh/figures/scrollbar-classic-bgdisable.png new file mode 100644 index 0000000..324de36 Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-classic-bgdisable.png differ diff --git a/programming-guide-zh/figures/scrollbar-classic-fg3dcolor.png b/programming-guide-zh/figures/scrollbar-classic-fg3dcolor.png new file mode 100644 index 0000000..66816e9 Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-classic-fg3dcolor.png differ diff --git a/programming-guide-zh/figures/scrollbar-classic-fgdisable.png b/programming-guide-zh/figures/scrollbar-classic-fgdisable.png new file mode 100644 index 0000000..d528ed2 Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-classic-fgdisable.png differ diff --git a/programming-guide-zh/figures/scrollbar-fashion-bg3dcolor (1).png b/programming-guide-zh/figures/scrollbar-fashion-bg3dcolor (1).png new file mode 100644 index 0000000..225f34b Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-fashion-bg3dcolor (1).png differ diff --git a/programming-guide-zh/figures/scrollbar-fashion-bg3dcolor.png b/programming-guide-zh/figures/scrollbar-fashion-bg3dcolor.png new file mode 100644 index 0000000..225f34b Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-fashion-bg3dcolor.png differ diff --git a/programming-guide-zh/figures/scrollbar-fashion-slider.png b/programming-guide-zh/figures/scrollbar-fashion-slider.png new file mode 100644 index 0000000..5899e7f Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-fashion-slider.png differ diff --git a/programming-guide-zh/figures/scrollbar-fashion-vert.png b/programming-guide-zh/figures/scrollbar-fashion-vert.png new file mode 100644 index 0000000..19296b3 Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-fashion-vert.png differ diff --git a/programming-guide-zh/figures/scrollbar-flat-bgc.png b/programming-guide-zh/figures/scrollbar-flat-bgc.png new file mode 100644 index 0000000..039982b Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-flat-bgc.png differ diff --git a/programming-guide-zh/figures/scrollbar-flat-fgc.png b/programming-guide-zh/figures/scrollbar-flat-fgc.png new file mode 100644 index 0000000..27fab7c Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-flat-fgc.png differ diff --git a/programming-guide-zh/figures/scrollbar-sample.png b/programming-guide-zh/figures/scrollbar-sample.png new file mode 100644 index 0000000..2ee761e Binary files /dev/null and b/programming-guide-zh/figures/scrollbar-sample.png differ diff --git a/programming-guide-zh/figures/scrollview_demo.png b/programming-guide-zh/figures/scrollview_demo.png new file mode 100644 index 0000000..c34076c Binary files /dev/null and b/programming-guide-zh/figures/scrollview_demo.png differ diff --git a/programming-guide-zh/figures/skin_checkbtn.png b/programming-guide-zh/figures/skin_checkbtn.png new file mode 100644 index 0000000..f45aae6 Binary files /dev/null and b/programming-guide-zh/figures/skin_checkbtn.png differ diff --git a/programming-guide-zh/figures/skin_pb_htruck.png b/programming-guide-zh/figures/skin_pb_htruck.png new file mode 100644 index 0000000..5c719c5 Binary files /dev/null and b/programming-guide-zh/figures/skin_pb_htruck.png differ diff --git a/programming-guide-zh/figures/skin_pb_vtruck.png b/programming-guide-zh/figures/skin_pb_vtruck.png new file mode 100644 index 0000000..427897c Binary files /dev/null and b/programming-guide-zh/figures/skin_pb_vtruck.png differ diff --git a/programming-guide-zh/figures/skin_tab.gif b/programming-guide-zh/figures/skin_tab.gif new file mode 100644 index 0000000..27261d3 Binary files /dev/null and b/programming-guide-zh/figures/skin_tab.gif differ diff --git a/programming-guide-zh/figures/skin_tb_horz.gif b/programming-guide-zh/figures/skin_tb_horz.gif new file mode 100644 index 0000000..a914b30 Binary files /dev/null and b/programming-guide-zh/figures/skin_tb_horz.gif differ diff --git a/programming-guide-zh/figures/skin_tb_vert.gif b/programming-guide-zh/figures/skin_tb_vert.gif new file mode 100644 index 0000000..4e54dc2 Binary files /dev/null and b/programming-guide-zh/figures/skin_tb_vert.gif differ diff --git a/programming-guide-zh/figures/skin_tree.png b/programming-guide-zh/figures/skin_tree.png new file mode 100644 index 0000000..d3b820b Binary files /dev/null and b/programming-guide-zh/figures/skin_tree.png differ diff --git a/programming-guide-zh/figures/sledit.png b/programming-guide-zh/figures/sledit.png new file mode 100644 index 0000000..ec0f5d2 Binary files /dev/null and b/programming-guide-zh/figures/sledit.png differ diff --git a/programming-guide-zh/figures/spinbox-sample.png b/programming-guide-zh/figures/spinbox-sample.png new file mode 100644 index 0000000..c5cae1a Binary files /dev/null and b/programming-guide-zh/figures/spinbox-sample.png differ diff --git a/programming-guide-zh/figures/spinbox.png b/programming-guide-zh/figures/spinbox.png new file mode 100644 index 0000000..4ac6bfa Binary files /dev/null and b/programming-guide-zh/figures/spinbox.png differ diff --git a/programming-guide-zh/figures/spinner-classic-bg3dcolor.png b/programming-guide-zh/figures/spinner-classic-bg3dcolor.png new file mode 100644 index 0000000..904ea0a Binary files /dev/null and b/programming-guide-zh/figures/spinner-classic-bg3dcolor.png differ diff --git a/programming-guide-zh/figures/spinner-classic-bg3ddisable.png b/programming-guide-zh/figures/spinner-classic-bg3ddisable.png new file mode 100644 index 0000000..29e118f Binary files /dev/null and b/programming-guide-zh/figures/spinner-classic-bg3ddisable.png differ diff --git a/programming-guide-zh/figures/spinner-classic-fg3ddisable.png b/programming-guide-zh/figures/spinner-classic-fg3ddisable.png new file mode 100644 index 0000000..5ed31ed Binary files /dev/null and b/programming-guide-zh/figures/spinner-classic-fg3ddisable.png differ diff --git a/programming-guide-zh/figures/spinner-fashion-grandiant-mode.png b/programming-guide-zh/figures/spinner-fashion-grandiant-mode.png new file mode 100644 index 0000000..d377814 Binary files /dev/null and b/programming-guide-zh/figures/spinner-fashion-grandiant-mode.png differ diff --git a/programming-guide-zh/figures/spinner-flat-bgcolor.png b/programming-guide-zh/figures/spinner-flat-bgcolor.png new file mode 100644 index 0000000..f5a9943 Binary files /dev/null and b/programming-guide-zh/figures/spinner-flat-bgcolor.png differ diff --git a/programming-guide-zh/figures/spinner-flat-fgcolor.png b/programming-guide-zh/figures/spinner-flat-fgcolor.png new file mode 100644 index 0000000..ded63d9 Binary files /dev/null and b/programming-guide-zh/figures/spinner-flat-fgcolor.png differ diff --git a/programming-guide-zh/figures/spinner.png b/programming-guide-zh/figures/spinner.png new file mode 100644 index 0000000..2659c34 Binary files /dev/null and b/programming-guide-zh/figures/spinner.png differ diff --git a/programming-guide-zh/figures/spl.png b/programming-guide-zh/figures/spl.png new file mode 100644 index 0000000..e54a715 Binary files /dev/null and b/programming-guide-zh/figures/spl.png differ diff --git a/programming-guide-zh/figures/timer-show.png b/programming-guide-zh/figures/timer-show.png new file mode 100644 index 0000000..ceefd15 Binary files /dev/null and b/programming-guide-zh/figures/timer-show.png differ diff --git a/programming-guide-zh/figures/trackbar-classic-bg3dcolor.png b/programming-guide-zh/figures/trackbar-classic-bg3dcolor.png new file mode 100644 index 0000000..061c1b3 Binary files /dev/null and b/programming-guide-zh/figures/trackbar-classic-bg3dcolor.png differ diff --git a/programming-guide-zh/figures/trackbar-classic-bgdisable.png b/programming-guide-zh/figures/trackbar-classic-bgdisable.png new file mode 100644 index 0000000..9ce32bd Binary files /dev/null and b/programming-guide-zh/figures/trackbar-classic-bgdisable.png differ diff --git a/programming-guide-zh/figures/trackbar-fashion-bg3dcolor.png b/programming-guide-zh/figures/trackbar-fashion-bg3dcolor.png new file mode 100644 index 0000000..09f92ff Binary files /dev/null and b/programming-guide-zh/figures/trackbar-fashion-bg3dcolor.png differ diff --git a/programming-guide-zh/figures/trackbar-fashion-bgdisable.png b/programming-guide-zh/figures/trackbar-fashion-bgdisable.png new file mode 100644 index 0000000..eb55d7b Binary files /dev/null and b/programming-guide-zh/figures/trackbar-fashion-bgdisable.png differ diff --git a/programming-guide-zh/figures/trackbar-fashion-slider.png b/programming-guide-zh/figures/trackbar-fashion-slider.png new file mode 100644 index 0000000..6ffd080 Binary files /dev/null and b/programming-guide-zh/figures/trackbar-fashion-slider.png differ diff --git a/programming-guide-zh/figures/trackbar-flat-fgc.png b/programming-guide-zh/figures/trackbar-flat-fgc.png new file mode 100644 index 0000000..054dbd8 Binary files /dev/null and b/programming-guide-zh/figures/trackbar-flat-fgc.png differ diff --git a/programming-guide-zh/figures/trackbar-sample.png b/programming-guide-zh/figures/trackbar-sample.png new file mode 100644 index 0000000..1b64389 Binary files /dev/null and b/programming-guide-zh/figures/trackbar-sample.png differ diff --git a/programming-guide-zh/figures/trackbar.png b/programming-guide-zh/figures/trackbar.png new file mode 100644 index 0000000..a84887f Binary files /dev/null and b/programming-guide-zh/figures/trackbar.png differ diff --git a/programming-guide-zh/figures/wnd_template.png b/programming-guide-zh/figures/wnd_template.png new file mode 100644 index 0000000..8d68bfa Binary files /dev/null and b/programming-guide-zh/figures/wnd_template.png differ diff --git a/programming-guide-zh/samples/animation.c b/programming-guide-zh/samples/animation.c new file mode 100644 index 0000000..d4f343f --- /dev/null +++ b/programming-guide-zh/samples/animation.c @@ -0,0 +1,205 @@ +#include +#include +#include + +#include +#include +#include +#include +#include +#include "../include/mgncs.h" +#include "../include/mrdr.h" +#define IDC_ANI 100 +#define IDC_BTN1 101 +#define IDC_BTN2 102 +#define IDC_BTN3 103 +#define IDC_ANIM 104 + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //TODO : initialize + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +//START_OF_PIC +static NCS_PROP_ENTRY animate_props [] = { + { NCSP_ANMT_GIFFILE, (DWORD)"tuzi1.gif" }, + { NCSP_ANMT_INTERVAL, 6 }, + {0, 0} +}; + +static NCS_PROP_ENTRY animate_props_ex [] = { + { NCSP_ANMT_DIR, (DWORD)"." }, + { NCSP_ANMT_INTERVAL, 100 }, + {0, 0} +}; +//END_OF_PIC + +NCS_RDR_ELEMENT btn_rdr_elements[] = +{ + { NCS_MODE_USEFLAT, 1}, + { -1, 0 } +}; + +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"flat","flat", NULL} +}; + +NCS_RDR_ELEMENT animate_rdr_elements[] = +{ + { NCS_MODE_USEFLAT, 1}, + { -1, 0 } +}; + +static NCS_RDR_INFO animate_rdr_info[] = +{ + {"flat", "flat", NULL} +}; + +//START_OF_KEY_EVENT +static void btn_notify(mWidget *button, int id, int nc, DWORD add_data) +{ + mAnimate *anim = (mAnimate *)ncsGetChildObj(GetParent(button->hwnd), IDC_ANI); + + switch (id) + { + case IDC_BTN1 : + ncsAnimateStart(anim); + break; + case IDC_BTN2 : + ncsAnimatePauseResume(anim); + break; + case IDC_BTN3 : + ncsAnimateStop(anim); + break; + } + +} + +static NCS_EVENT_HANDLER btn_handlers [] = { + NCS_MAP_NOTIFY(NCSN_BUTTON_PUSHED, btn_notify), + {0, NULL} +}; +//END_OF_KEY_EVENT + +//START_OF_TMPL +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_ANIMATE, + IDC_ANI, + 50, 50, 300, 300, + WS_BORDER | WS_VISIBLE |NCSS_ANMT_AUTOFIT | NCSS_ANMT_AUTOLOOP | NCSS_ANMT_AUTOPLAY, + WS_EX_NONE, + "test", + animate_props, //props, + animate_rdr_info, + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_ANIMATE, + IDC_ANIM, + 0, 230, 300, 300, + WS_BORDER | WS_VISIBLE | NCSS_ANMT_AUTOLOOP | NCSS_ANMT_AUTOFIT | NCSS_ANMT_AUTOPLAY, + WS_EX_NONE, + "test2", + animate_props_ex, //props, + animate_rdr_info, + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_BUTTON, + IDC_BTN1, + 450, 100, 70, 30, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "Start", + NULL, + btn_rdr_info, + btn_handlers, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDC_BTN2, + 450, 200, 70, 30, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "Pause", + NULL, + btn_rdr_info, + btn_handlers, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDC_BTN3, + 450, 300, 70, 30, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "Stop", + NULL, + btn_rdr_info, + btn_handlers, + NULL, + 0, + 0 + }, +}; +//END_OF_TMPL + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 600, 600, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "animate Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect(&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/button.c b/programming-guide-zh/samples/button.c new file mode 100644 index 0000000..caf931e --- /dev/null +++ b/programming-guide-zh/samples/button.c @@ -0,0 +1,173 @@ +/* +** button.c: Sample program for mGNCS Programming Guide +** The first mGNCS application. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define ID_BTN 101 +#define ID_BTN1 102 +#define ID_BTN5 106 +#define ID_BTN6 107 +#define ID_BTN7 108 +#define ID_BTN8 109 + +// START_OF_HANDLERS +static BITMAP bmp; +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //set image +//START_SET_IMAGE + if(LoadBitmapFromFile(HDC_SCREEN, &bmp, "icon_button.png")!=0) + { + printf("cannot load image file \"icon_button.png\"\n"); + } + + mButton *mb1 = (mButton*)ncsGetChildObj(self->hwnd, ID_BTN1); + + if(mb1) + _c(mb1)->setProperty(mb1, NCSP_BUTTON_IMAGE, (DWORD)&bmp); +//END_STE_IMAGE + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; +// END_OF_HANDLERS + +// START_OF_RDRINFO +NCS_RDR_ELEMENT btn_rdr_elements[] = +{ + { NCS_MODE_USEFLAT, 1}, + { -1, 0 } +}; +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"fashion","fashion", btn_rdr_elements} +}; +// END_OF_RDRINFO + +// START_OF_TEMPLATE +static NCS_WND_TEMPLATE _ctrl_templ[] = { +//START_DCL_DEF_PUSHBUTTON + { + NCSCTRL_BUTTON, + ID_BTN, + 30, 30, 80, 25, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "button", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, +//END_DCL_DEF_PUSHBUTTON +//START_DCL_IMAGEBUTTON + { + NCSCTRL_BUTTON, + ID_BTN1, + 150, 30, 80, 25, + WS_VISIBLE | NCSS_BUTTON_IMAGE, + WS_EX_NONE, + "Image", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, +//END_DCL_IMAGEBUTTON +//START_DCL_AUTOCHECKBTN + { + NCSCTRL_BUTTON, + ID_BTN1, + 30, 80, 80, 25, + WS_VISIBLE | NCSS_BUTTON_AUTOCHECK | NCSS_BUTTON_CHECKABLE, + WS_EX_NONE, + "Auto button", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, +//END_DCL_AUTOCHECKBTN +//START_DCL_3DAUTOCHECKBTN + { + NCSCTRL_BUTTON, + ID_BTN1, + 150, 80, 80, 25, + WS_VISIBLE | NCSS_BUTTON_AUTOCHECK | NCSS_BUTTON_CHECKABLE \ + | NCSS_BUTTON_3DCHECK, + WS_EX_NONE, + "3D button", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, +//END_DCL_3DAUTOCHECKBTN +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_MAINWND, + 1, + 0, 0, 260, 180, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Push Button", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; +// END_OF_TEMPLATE + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/checkbutton.c b/programming-guide-zh/samples/checkbutton.c new file mode 100644 index 0000000..df0e4e9 --- /dev/null +++ b/programming-guide-zh/samples/checkbutton.c @@ -0,0 +1,132 @@ +/* +** checkbutton.c: Sample program for mGNCS Programming Guide +** The first mGNCS application. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +// START_OF_HANDLERS +static BOOL mymain_onCreate(mWidget* _this, DWORD add_data) +{ + return TRUE; +} + +static void mymain_onClose(mWidget* _this, int message) +{ + DestroyMainWindow(_this->hwnd); + PostQuitMessage(0); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; +// END_OF_HANDLERS + +// START_OF_RDRINFO +NCS_RDR_ELEMENT btn_rdr_elements[] = +{ + { NCS_MODE_USEFLAT, 1}, + { -1, 0 } +}; + +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"flat","flat", btn_rdr_elements} +}; +// END_OF_RDRINFO + +// START_OF_TEMPLATE +#define ID_BTN 101 +#define ID_BTN1 102 +#define ID_BTN2 103 +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_CHECKBUTTON, + ID_BTN, + 20, 30, 120, 25, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "option1", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_CHECKBUTTON, + ID_BTN1, + 20, 60, 120, 25, + WS_BORDER | WS_VISIBLE | NCSS_BUTTON_AUTOCHECK, + WS_EX_NONE, + "option2", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_CHECKBUTTON, + ID_BTN2, + 20, 90, 120, 25, + WS_BORDER | WS_VISIBLE |NCSS_BUTTON_AUTOCHECK | NCSS_BUTTON_3DCHECK, + WS_EX_NONE, + "option3", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + } +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 260, 180, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Check button", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; +// END_OF_TEMPLATE + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/colorbutton.c b/programming-guide-zh/samples/colorbutton.c new file mode 100644 index 0000000..f765403 --- /dev/null +++ b/programming-guide-zh/samples/colorbutton.c @@ -0,0 +1,118 @@ +/* +** colorbutton.c: Sample program for mGNCS Programming Guide +** The first mGNCS application. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define ID_BTN 101 + +// START_OF_HANDLERS +static BOOL mymain_oncolorchanged(mMainWnd* self, mColorButton *sender, + int id, DWORD param) +{ + SetWindowBkColor(self->hwnd, DWORD2PIXEL(HDC_SCREEN, param)); + InvalidateRect(self->hwnd, NULL, TRUE); + + return FALSE; +} + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + mColorButton *btn = (mColorButton*)_c(self)->getChild(self, ID_BTN); + if(btn) + { + _c(btn)->setProperty(btn, NCSP_CLRBTN_CURCOLOR, PIXEL2DWORD(HDC_SCREEN, + GetWindowBkColor(self->hwnd))); + ncsAddEventListener((mObject*)btn, (mObject*)self, + (NCS_CB_ONPIECEEVENT)mymain_oncolorchanged, + NCSN_CLRBTN_COLORCHANGED); + } + + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; +// END_OF_HANDLERS + +// START_OF_RDRINFO +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"fashion", "fashion", NULL}, +}; +// END_OF_RDRINFO + +// START_OF_TEMPLATE +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_COLORBUTTON, + ID_BTN, + 40, 40, 80, 30, + WS_VISIBLE|NCSS_NOTIFY, + WS_EX_NONE, + "button", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + } +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_MAINWND, + 1, + 0, 0, 180, 140, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Color button", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; +// END_OF_TEMPLATE + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/combobox.c b/programming-guide-zh/samples/combobox.c new file mode 100644 index 0000000..4e98ab3 --- /dev/null +++ b/programming-guide-zh/samples/combobox.c @@ -0,0 +1,222 @@ +/* +** combobox.c: Sample program for mGNCS Programming Guide +** Using Combobox. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + + +#define ID_BTN 201 +#define ID_NAME 202 +#define ID_TYPE 203 +#define ID_LOCA 204 + +static const char *file_type[] = +{ + "All File(*.*)", + "Text File(*.txt)", + "Bin File(*.bin)", +}; + +static BOOL mymain_onCreate (mWidget* _this, DWORD add_data) +{ + int i; + + // get combobox + mCombobox *com = (mCombobox *)ncsGetChildObj(_this->hwnd, ID_TYPE); + + // add items + for (i = 0; i < sizeof(file_type)/sizeof(file_type[0]); i++) + { + _c(com)->addItem(com, file_type[i], 0); + } + + // set the selected item + _c(com)->setProperty(com, NCSP_COMB_SELECT, 1); + + return TRUE; +} + +static void mymain_onClose (mWidget* _this, int message) +{ + DestroyMainWindow (_this->hwnd); + PostQuitMessage (_this->hwnd); +} + +static void mymain_onPaint(mWidget *self, HDC hdc, const CLIPRGN* inv) +{ + SetBkMode (hdc, BM_TRANSPARENT); + TextOut (hdc, 40, 10, "New File Wizard ..."); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {MSG_PAINT, mymain_onPaint}, + {0, NULL} +}; + +static void btn_onClicked(mWidget* _this, int id, int nc, HWND hCtrl) +{ + if(nc == NCSN_WIDGET_CLICKED) + { + PostMessage(GetParent(_this->hwnd), MSG_CLOSE, 0, 0); + } +}; + +static NCS_EVENT_HANDLER btn_handlers[] = +{ + {NCS_NOTIFY_CODE(NCSN_WIDGET_CLICKED), btn_onClicked}, + {0, NULL} +}; + +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"fashion","fashion", NULL} +}; + +//START_OF_INITIAL_PROPS +static NCS_PROP_ENTRY combo_props[] = +{ + { 0, 0 } +}; +//END_OF_INITIAL_PROPS + +//START_OF_TEMPLATE +static NCS_WND_TEMPLATE _ctrl_templ[] = +{ + { + NCSCTRL_STATIC, + 0, + 10, 40, 70, 30, + WS_VISIBLE, + WS_EX_NONE, + "Name:", + NULL, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_SLEDIT, + ID_NAME, + 85, 45, 160, 25, + WS_VISIBLE | WS_BORDER, + WS_EX_NONE, + "", + combo_props, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_STATIC, + 0, + 10, 80, 70, 30, + WS_VISIBLE, + WS_EX_NONE, + "Type:", + NULL, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_COMBOBOX, + ID_TYPE, + 85, 85, 160, 25, + WS_VISIBLE | NCSS_CMBOX_DROPDOWNLIST, + WS_EX_NONE, + "", + combo_props, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_STATIC, + 0, + 10, 120, 70, 30, + WS_VISIBLE, + WS_EX_NONE, + "Location:", + NULL, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_SLEDIT, + ID_LOCA, + 85, 125, 160, 25, + WS_VISIBLE | WS_BORDER, + WS_EX_NONE, + "", + combo_props, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_BUTTON, + ID_BTN, + 50, 170, 80, 25, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "Finish", + NULL, + btn_rdr_info, + btn_handlers, NULL, 0, 0 + }, + { + NCSCTRL_BUTTON, + ID_BTN, + 170, 170, 80, 25, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "Cancel", + NULL, + btn_rdr_info, + btn_handlers, NULL, 0, 0 + }, + +}; +//END_OF_TEMPLATE + +static NCS_MNWND_TEMPLATE mymain_templ = +{ + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 320, 240, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Combobox", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain (int argc, const char* argv[]) +{ + ncsInitialize (); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal (mydlg, TRUE); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/container.c b/programming-guide-zh/samples/container.c new file mode 100644 index 0000000..75314e6 --- /dev/null +++ b/programming-guide-zh/samples/container.c @@ -0,0 +1,394 @@ +/* +** container.c: Sample program for mGNCS Programming Guide +** The demo application for Container. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define IDC_CONTAINER 100 + +#define IDC_RDOGROUP 151 +#define IDC_CKGROUP 152 + +#define IDC_LAMIAN 101 +#define IDC_CHOUDOUFU 102 +#define IDC_JIANBING 103 +#define IDC_MAHUA 104 +#define IDC_SHUIJIAO 105 +#define IDC_XIAN 110 +#define IDC_LA 111 +#define IDC_PROMPT 200 + +// START_OF_NCSCTRLS +static NCS_PROP_ENTRY radioGroup_props [] = { + {NCSP_BUTTON_GROUPID, IDC_RDOGROUP}, + {0, 0} +}; + +static NCS_WND_TEMPLATE ncsCtrlYourTaste[] = { + { + NCSCTRL_BUTTONGROUP, + IDC_RDOGROUP, + 16, 10, 230, 160, + WS_VISIBLE, + WS_EX_TRANSPARENT, + "optional snack", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_RADIOBUTTON, + IDC_LAMIAN, + 36, 38, 200, 20, + WS_VISIBLE | WS_TABSTOP | NCSS_BUTTON_AUTOCHECK, + WS_EX_NONE, + "northwest pulled noodle", + radioGroup_props, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_RADIOBUTTON, + IDC_CHOUDOUFU, + 36, 64, 200, 20, + WS_VISIBLE | WS_TABSTOP | NCSS_BUTTON_AUTOCHECK, + WS_EX_NONE, + "chang sha bad smelling bean curd", + radioGroup_props, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_RADIOBUTTON, + IDC_JIANBING, + 36, 90, 200, 20, + WS_VISIBLE | WS_TABSTOP | WS_DISABLED, + WS_EX_NONE, + "shan dong thini pancake", + radioGroup_props, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_RADIOBUTTON, + IDC_MAHUA, + 36, 116, 200, 20, + WS_VISIBLE | WS_TABSTOP | NCSS_BUTTON_AUTOCHECK, + WS_EX_NONE, + "tianjin fired dough twist", + radioGroup_props, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_RADIOBUTTON, + IDC_SHUIJIAO, + 36, 142, 200, 20, + WS_VISIBLE | WS_TABSTOP | NCSS_BUTTON_AUTOCHECK, + WS_EX_NONE, + "chengdu red oil boiled dumpling", + radioGroup_props, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTONGROUP, + IDC_CKGROUP, + 250, 10, 100, 160, + WS_VISIBLE, + WS_EX_TRANSPARENT, + "flavor", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_CHECKBUTTON, + IDC_XIAN, + 260, 38, 80, 20, + WS_VISIBLE | NCSS_BUTTON_AUTOCHECK, + WS_EX_NONE, + "partial salty", + //checkGroup_props, + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_CHECKBUTTON, + IDC_LA, + 260, 64, 80, 20, + WS_VISIBLE | NCSS_BUTTON_AUTOCHECK, + WS_EX_NONE, + "partial spicy", + //checkGroup_props, + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_STATIC, + IDC_PROMPT, + 16, 180, 360, 40, + WS_VISIBLE, + WS_EX_NONE, + "northwest pulled noodle is competitive product in the wheaten food", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDOK, + 70, 230, 70, 30, + WS_VISIBLE | WS_TABSTOP | NCSS_NOTIFY, + WS_EX_NONE, + "Ok", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDCANCEL, + 200, 230, 70, 30, + WS_VISIBLE | WS_TABSTOP | NCSS_NOTIFY, + WS_EX_NONE, + "Cancel", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, +}; +// END_OF_NCSCTRLS + +// START_OF_INTRINSICCTRLS +static CTRLDATA CtrlYourTaste[] = +{ + { + "static", + WS_VISIBLE | SS_GROUPBOX, + 16, 10, 230, 160, + IDC_STATIC, + "optional snack", + 0, + WS_EX_TRANSPARENT + }, + { + "button", + WS_VISIBLE | BS_AUTORADIOBUTTON | BS_CHECKED | WS_TABSTOP | WS_GROUP, + 36, 38, 200, 20, + IDC_LAMIAN, + "northwest pulled noodle", + 0 + }, + { + "button", + WS_VISIBLE | BS_AUTORADIOBUTTON, + 36, 64, 200, 20, + IDC_CHOUDOUFU, + "chang sha bad smelling bean curd", + 0 + }, + { + "button", + WS_VISIBLE | BS_AUTORADIOBUTTON | WS_DISABLED, + 36, 90, 200, 20, + IDC_JIANBING, + "shan dong thini pancake", + 0 + }, + { + "button", + WS_VISIBLE | BS_AUTORADIOBUTTON, + 36, 116, 200, 20, + IDC_MAHUA, + "tianjin fired dough twist", + 0 + }, + { + "button", + WS_VISIBLE | BS_AUTORADIOBUTTON, + 36, 142, 200, 20, + IDC_SHUIJIAO, + "chengdu red oil boiled dumpling", + 0 + }, + { + "static", + WS_VISIBLE | SS_GROUPBOX | WS_GROUP, + 250, 10, 100, 160, + IDC_STATIC, + "flavor", + 0, + WS_EX_TRANSPARENT + }, + { + "button", + WS_VISIBLE | BS_AUTOCHECKBOX, + 260, 38, 80, 20, + IDC_XIAN, + "partial salty", + 0 + }, + { + "button", + WS_VISIBLE | BS_AUTOCHECKBOX | BS_CHECKED, + 260, 64, 80, 20, + IDC_LA, + "partial spicy", + 0 + }, + { + "static", + WS_VISIBLE | SS_LEFT | WS_GROUP | WS_BORDER, + 16, 180, 360, 40, + IDC_PROMPT, + "northwest pulled noodle is competitive product in the wheaten food", + 0 + }, + { + "button", + WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP | WS_BORDER , + 70, 230, 70, 30, + IDOK, + "OK", + 0 + }, + { + "button", + WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP, + 200, 230, 70, 30, + IDCANCEL, + "Cancel", + 0 + }, +}; +// END_OF_INTRINSICCTRLS + +// START_OF_HANDLERS +static void dialog_onCSizeChanged(mWidget* self, int clientWidth, int clientHeight) +{ + HWND hContainer = GetDlgItem(self->hwnd, IDC_CONTAINER); + if (hContainer != HWND_NULL || hContainer != HWND_INVALID) + MoveWindow(hContainer, 0, 0, clientWidth, clientHeight, TRUE); +} + +static BOOL container_onCommand(mWidget* self, int id, int nc, HWND hCtrl) +{ + if (id == IDOK || id == IDCANCEL) { + + if (nc == NCSN_BUTTON_PUSHED) { + //close dialog + HWND hParent = GetParent(self->hwnd); + SendNotifyMessage(hParent, + MSG_COMMAND, (WPARAM)MAKELONG(id, nc), (LPARAM)hCtrl); + } + + return FALSE; + } + + return FALSE; +} + +static NCS_EVENT_HANDLER container_handlers[] = { + {MSG_COMMAND, container_onCommand}, + {0, NULL} +}; +// END_OF_HANDLERS + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize (); + + mDialogBox* dialog = (mDialogBox*)ncsCreateMainWindow ( + NCSCTRL_DIALOGBOX, "Container Demo", + WS_CAPTION | WS_BORDER | WS_VISIBLE | NCSS_MNWND_MODE, + WS_EX_NONE, + 1, + 0, 0, 400, 320, + HWND_DESKTOP, + 0, 0, + NULL, + NULL, + NULL, + 0); + + ncsSetComponentHandler((mComponent*)dialog, + MSG_CSIZECHANGED, dialog_onCSizeChanged); + + mContainer *container = + (mContainer*)ncsCreateWindow (NCSCTRL_CONTAINER, + "", + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + IDC_CONTAINER, + 0, 0, 300, 200, dialog->hwnd, + NULL, NULL, container_handlers, 0); + + if (argc > 1 && strcmp(argv[1], "intrinsic") == 0) { + _c(container)->addIntrinsicControls (container, CtrlYourTaste, + sizeof(CtrlYourTaste)/sizeof(CTRLDATA)); + } + else { + _c(container)->addChildren(container, ncsCtrlYourTaste, + sizeof(ncsCtrlYourTaste)/sizeof(NCS_WND_TEMPLATE)); + } + + _c(dialog)->doModal(dialog, TRUE); + + MainWindowThreadCleanup (dialog->hwnd); + ncsUninitialize (); + + return 0; +} diff --git a/programming-guide-zh/samples/data_binding.c b/programming-guide-zh/samples/data_binding.c new file mode 100644 index 0000000..ae762a3 --- /dev/null +++ b/programming-guide-zh/samples/data_binding.c @@ -0,0 +1,129 @@ +/* +** data_binding.c: Sample program for mGNCS Programming Guide +** Using data binding. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define IDC_TRACKBAR 101 +#define IDC_SLEDIT 102 + +// START_OF_BINDING +static BOOL mymain_onCreate (mWidget* self, DWORD add_data) +{ + mTrackbar * tb = (mTrackbar*)_c(self)->getChild (self, IDC_TRACKBAR); + mSlEdit * se = (mSlEdit*) _c(self)->getChild (self, IDC_SLEDIT); + + ncsConnectBindProps (NCS_CMPT_PROP (tb, NCSN_TRKBAR_CHANGED, + NCSP_TRKBAR_CURPOS, NCS_BT_INT, + NCS_PROP_FLAG_READ|NCS_PROP_FLAG_WRITE), + NCS_CMPT_PROP (se, NCSN_EDIT_CHANGE, + NCSP_WIDGET_TEXT, NCS_BT_STR, + NCS_PROP_FLAG_READ|NCS_PROP_FLAG_WRITE), + NCS_BPT_DBL); + + ncsAutoReflectObjectBindProps ((mObject*)se); + return TRUE; +} +// END_OF_BINDING + +static void mymain_onClose (mWidget* self, int message) +{ + DestroyMainWindow (self->hwnd); + PostQuitMessage (self->hwnd); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate }, + {MSG_CLOSE, mymain_onClose }, + {0, NULL } +}; + +static NCS_PROP_ENTRY trackbar_props [] = { + {NCSP_TRKBAR_MINPOS, 0}, + {NCSP_TRKBAR_MAXPOS, 20}, + {NCSP_TRKBAR_CURPOS, 10}, + {NCSP_TRKBAR_LINESTEP, 2}, + {NCSP_TRKBAR_PAGESTEP, 5}, + {0, 0} +}; + +static NCS_RDR_INFO trackbar_rdr_info[] = +{ + {"flat", "flat", NULL}, +}; + +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_TRACKBAR, + IDC_TRACKBAR, + 10, 10, 240, 40, + WS_BORDER | WS_VISIBLE | NCSS_TRKBAR_NOTICK | NCSS_NOTIFY, + WS_EX_TRANSPARENT, + "", + trackbar_props, + trackbar_rdr_info, + NULL, NULL, 0, 0, + MakeRGBA(255,0,0,255) + }, + { + NCSCTRL_SLEDIT, + IDC_SLEDIT, + 10, 60, 240, 30, + WS_BORDER | WS_VISIBLE | NCSS_EDIT_CENTER | NCSS_NOTIFY, + WS_EX_NONE, + "edit", + NULL, NULL, NULL, NULL, 0, 0 + }, +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 268, 130, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Data Binding", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + MakeRGBA(255,255,255,255) +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + mDialogBox* mydlg; + + if (argc > 1) { + trackbar_rdr_info[0].glb_rdr = argv[1]; + trackbar_rdr_info[0].ctl_rdr = argv[1]; + } + + ncsInitialize (); + + mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal (mydlg, TRUE); + + MainWindowThreadCleanup (mydlg->hwnd); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/data_source.c b/programming-guide-zh/samples/data_source.c new file mode 100644 index 0000000..f32c95a --- /dev/null +++ b/programming-guide-zh/samples/data_source.c @@ -0,0 +1,119 @@ +/* +** data_source.c: Sample program for mGNCS Programming Guide +** Using static data source. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define IDC_LISTVIEW 100 + +// START_OF_DEFINEDS +static const NCS_LISTV_CLMRD _header[] = { + {"Name", "", 100, NCSF_LSTCLM_LEFTALIGN}, + {"Sex", "", 80, NCSF_LSTCLM_LEFTALIGN}, + {"Age", "", 80, NCSF_LSTCLM_LEFTALIGN} +}; + +static const char* _content[][3] = { + {"Jime", "Male", "15"}, + {"Lily", "Female", "12"}, + {"Tom", "Male", "11"} +}; +// END_OF_DEFINEDS + +// START_OF_SETDATA +static BOOL mymain_onCreate (mWidget* self, DWORD add_data) +{ + mListView *lv = (mListView*)_c(self)->getChild (self, IDC_LISTVIEW); + + if (lv) { + mRecordSet *rs; + rs = _c(g_pStaticDS)->selectRecordSet (g_pStaticDS, + "/listview/header", NCS_DS_SELECT_READ); + _c(lv)->setSpecial (lv, NCSID_LISTV_HDR, (DWORD)rs, NULL); + rs = _c(g_pStaticDS)->selectRecordSet (g_pStaticDS, + "/listview/content", NCS_DS_SELECT_READ); + _c(lv)->setSpecial (lv, NCS_CONTENT, (DWORD)rs, NULL); + } + + return TRUE; +} +// END_OF_SETDATA + +static void mymain_onClose (mWidget* self, int message) +{ + DestroyMainWindow (self->hwnd); + PostQuitMessage (self->hwnd); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; + +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_LISTVIEW, + IDC_LISTVIEW, + 10, 10, 320, 190, + WS_BORDER | WS_VISIBLE | NCSS_LISTV_SORT + | NCSS_LISTV_LOOP, + WS_EX_NONE, + "", + NULL, NULL, NULL, NULL, 0, 0 + } +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_MAINWND, + 1, + 0, 0, 350, 240, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Data Source ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, 0, 0, +}; + +int MiniGUIMain (int argc, const char* argv[]) +{ + mDialogBox* mydlg; + + ncsInitialize (); + +// START_OF_REGDS + ncsRegisterStaticData ("/listview/header", (void*)_header, 3, + sizeof(NCS_LISTV_CLMRD)/sizeof(DWORD), sizeof(DWORD), + gListVColumnRecordTypes); + ncsRegisterStaticData ("/listview/content", (void*)_content, 3, + 3, sizeof(char*), NULL); +// END_OF_REGDS + + mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal (mydlg, TRUE); + + MainWindowThreadCleanup (mydlg->hwnd); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/edit.c b/programming-guide-zh/samples/edit.c new file mode 100644 index 0000000..f3440ca --- /dev/null +++ b/programming-guide-zh/samples/edit.c @@ -0,0 +1,283 @@ +/* +** edit.c: Sample program for mGNCS Programming Guide +** Using edit. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define ID_NAME 104 +#define ID_COUN 105 +#define ID_CITY 106 +#define ID_PSWD 107 +#define ID_SPIN 108 +#define ID_INFO 109 + +#define ID_REG 155 +#define ID_CAN 156 + + +static BOOL mymain_onCreate (mWidget* _this, DWORD add_data) +{ + return TRUE; +} + +static void mymain_onClose (mWidget* _this, int message) +{ + DestroyMainWindow (_this->hwnd); + PostQuitMessage (_this->hwnd); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; + +static void btn_onClicked(mWidget* _this, int id, int nc, HWND hCtrl) +{ + if(nc == NCSN_WIDGET_CLICKED) + { + if (id == ID_CAN){ + PostMessage(GetParent(_this->hwnd), MSG_CLOSE, 0, 0); + } else if (id == ID_REG){ + //TODO + } + + } +}; + +static NCS_EVENT_HANDLER btn_handlers[] = +{ + {NCS_NOTIFY_CODE(NCSN_WIDGET_CLICKED), btn_onClicked}, + {0, NULL} +}; + +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"fashion","fashion", NULL} +}; + +static NCS_PROP_ENTRY static_props[] = +{ + {NCSP_STATIC_ALIGN, NCS_ALIGN_RIGHT}, + {0, 0} +}; + +static NCS_PROP_ENTRY spin_props [] = +{ + {NCSP_SPNBOX_MAXPOS, 99}, + {NCSP_SPNBOX_MINPOS, 0}, + {NCSP_SPNBOX_CURPOS, 25}, + {NCSP_SPNBOX_LINESTEP, 1}, + {0, 0} +}; + +#define HSTART 25 +#define HSPACE 40 + +static NCS_WND_TEMPLATE _ctrl_templ[] = +{ +//START_OF_SLEDIT_TEMPLATE + { + NCSCTRL_STATIC, + 0, + 10, HSTART, 70, 25, + WS_VISIBLE, + WS_EX_NONE, + "Name :", + static_props, + NULL, + NULL, NULL, 0, 0 + }, + { //左对齐 + NCSCTRL_SLEDIT, + ID_NAME, + 100, HSTART, 150, 25, + WS_BORDER | WS_VISIBLE | NCSS_EDIT_LEFT, + WS_EX_NONE, + "", + NULL, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_STATIC, + 0, + 10, HSTART + HSPACE, 70, 25, + WS_VISIBLE, + WS_EX_NONE, + "Age :", + static_props, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_SPINBOX, + ID_SPIN, + 100, HSTART + HSPACE, 70, 25, + WS_VISIBLE | NCSS_SPNBOX_NUMBER | NCSS_SPNBOX_AUTOLOOP, + WS_EX_NONE, + "", + spin_props, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_STATIC, + 0, + 10, HSTART + 2 * HSPACE, 70, 25, + WS_VISIBLE, + WS_EX_NONE, + "Country:", + static_props, + NULL, + NULL, NULL, 0, 0 + }, + { //居中对齐, 大写字母 + NCSCTRL_SLEDIT, + ID_COUN, + 100, HSTART + 2 * HSPACE, 130, 25, + WS_BORDER | WS_VISIBLE | NCSS_EDIT_CENTER | NCSS_EDIT_UPPERCASE, + WS_EX_NONE, + "", + NULL, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_STATIC, + 0, + 10, HSTART + 3 * HSPACE, 70, 25, + WS_VISIBLE, + WS_EX_NONE, + "City :", + static_props, + NULL, + NULL, NULL, 0, 0 + }, + { //小写字母 + NCSCTRL_SLEDIT, + ID_CITY, + 100, HSTART + 3 * HSPACE, 150, 25, + WS_BORDER | WS_VISIBLE | NCSS_EDIT_LOWERCASE, + WS_EX_NONE, + "", + NULL, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_STATIC, + 0, + 10, HSTART + 4 * HSPACE, 70, 25, + WS_VISIBLE, + WS_EX_NONE, + "Passwd :", + static_props, + NULL, + NULL, NULL, 0, 0 + }, + { //密码输入形式的edit + NCSCTRL_SLEDIT, + ID_PSWD, + 100, HSTART + 4 * HSPACE, 150, 25, + WS_BORDER | WS_VISIBLE | NCSS_SLEDIT_PASSWORD, + WS_EX_NONE, + "", + NULL, + NULL, + NULL, NULL, 0, 0 + }, +//END_OF_SLEDIT_TEMPLATE +//START_OF_MLEDIT_TEMPLATE + { + NCSCTRL_STATIC, + 0, + 10, HSTART + 5 * HSPACE, 70, 25, + WS_VISIBLE, + WS_EX_NONE, + "Info :", + static_props, + NULL, + NULL, NULL, 0, 0 + }, + { //多行编辑框 + NCSCTRL_MLEDIT, + ID_INFO, + 100, HSTART + 5 * HSPACE, 200, 160, + WS_BORDER | WS_VISIBLE | WS_VSCROLL | NCSS_EDIT_BASELINE, + WS_EX_NONE, + "", + NULL, + NULL, + NULL, NULL, 0, 0 + }, +//END_OF_MLEDIT_TEMPLATE + + { + NCSCTRL_BUTTON, + ID_REG, + 240, 400, 80, 25, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "Register", + NULL, + btn_rdr_info, + btn_handlers, NULL, 0, 0 + }, + { + NCSCTRL_BUTTON, + ID_CAN, + 120, 400, 80, 25, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "Cancel", + NULL, + btn_rdr_info, + btn_handlers, NULL, 0, 0 + }, +}; + +static NCS_MNWND_TEMPLATE mymain_templ = +{ + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 360, 480, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Register", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain (int argc, const char* argv[]) +{ + ncsInitialize (); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal (mydlg, TRUE); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/event_listener.c b/programming-guide-zh/samples/event_listener.c new file mode 100644 index 0000000..68a6b48 --- /dev/null +++ b/programming-guide-zh/samples/event_listener.c @@ -0,0 +1,170 @@ +/* +** event_listener.c: Sample program for mGNCS Programming Guide +** Using event listener. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define IDC_EXIT 100 +#define IDC_STOP 101 +#define IDC_PROG 200 + +static void mymain_onClose (mWidget* self, int message); + +// START_OF_EVENTLISTENER +static BOOL mymain_onExit (mMainWnd *self, mButton *sender, int id, DWORD param) +{ + mymain_onClose ((mWidget*)self, MSG_CLOSE); + return TRUE; +} + +static BOOL mymain_onStop (mMainWnd *self, mButton *sender, int id, DWORD param) +{ + KillTimer (self->hwnd, 100); + return TRUE; +} +// END_OF_EVENTLISTENER + +// START_OF_HANDLERS +static BOOL mymain_onCreate (mWidget* self, DWORD addData) +{ + mButton *btn; + + btn = (mButton*)_c(self)->getChild (self, IDC_EXIT); + ncsAddEventListener ((mObject*)btn, (mObject*)self, + (NCS_CB_ONOBJEVENT)mymain_onExit, NCSN_WIDGET_CLICKED); + + btn = (mButton*)_c(self)->getChild (self, IDC_STOP); + ncsAddEventListener ((mObject*)btn, (mObject*)self, + (NCS_CB_ONOBJEVENT)mymain_onStop, NCSN_WIDGET_CLICKED); + + SetTimer (self->hwnd, 100, 20); + return TRUE; +} + +static void mymain_onTimer (mWidget *self, int id, DWORD count) +{ + static int pb_pos = 0; + mProgressBar *pb = (mProgressBar*)ncsGetChildObj (self->hwnd, IDC_PROG); + if (pb) + _c(pb)->setProperty (pb, NCSP_PROG_CURPOS, pb_pos++); +} + +static void mymain_onClose (mWidget* self, int message) +{ + DestroyMainWindow (self->hwnd); + PostQuitMessage (self->hwnd); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {MSG_TIMER, mymain_onTimer}, + {0, NULL} +}; +// END_OF_HANDLERS + +static NCS_RDR_INFO btn1_rdr_info[] = +{ + {"fashion", "fashion", NULL} +}; + +static NCS_RDR_INFO btn2_rdr_info[] = +{ + {"skin", "skin", NULL} +}; + +// START_OF_PROPERTIES +static NCS_PROP_ENTRY progress_props [] = { + {NCSP_PROG_MAXPOS, 100}, + {NCSP_PROG_MINPOS, 0 }, + {NCSP_PROG_LINESTEP, 1}, + {NCSP_PROG_CURPOS, 0 }, + { 0, 0 } +}; +// END_OF_PROPERTIES + +// START_OF_TEMPLATE +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_PROGRESSBAR, + IDC_PROG, + 10, 10, 290, 30, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + progress_props, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDC_STOP, + 10, 50, 100, 25, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Stop", + NULL, + btn1_rdr_info, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_BUTTON, + IDC_EXIT, + 200, 50, 100, 25, + WS_VISIBLE, + WS_EX_NONE, + "Exit", + NULL, + btn2_rdr_info, + NULL, NULL, 0, 0 + }, +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 320, 110, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Event Listener", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; +// END_OF_TEMPLATE + +int MiniGUIMain (int argc, const char* argv[]) +{ + mDialogBox* mydlg; + + ncsInitialize (); + + mydlg = (mDialogBox *)ncsCreateMainWindowIndirect (&mymain_templ, + HWND_DESKTOP); + + _c(mydlg)->doModal (mydlg, TRUE); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/groupbox.c b/programming-guide-zh/samples/groupbox.c new file mode 100644 index 0000000..dc8b892 --- /dev/null +++ b/programming-guide-zh/samples/groupbox.c @@ -0,0 +1,104 @@ +/* + * ** groupbox.c: Sample program for mGNCS Programming Guide + * ** A mGNCS application for mGroupbox. + * ** + * ** Copyright (C) 2009 ~ 2019 FMSoft Technologies. + * */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define ID_GROUP 101 + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //TODO : initialize + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +static NCS_RDR_INFO grp_rdr_info[] = { +// {"fashion", "fashion", NULL} +// {"flat", "flat", NULL} +// {"classic", "classic", NULL} + {"skin", "skin", NULL} +}; + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_GROUPBOX , + ID_GROUP, +// 10, 10, 280, 180, + 10, 10, 140, 90, + WS_VISIBLE, + WS_EX_NONE, + "groupbox", + NULL, //props, + grp_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate }, + {MSG_CLOSE, mymain_onClose }, + {0, NULL } +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 320, 240, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Group Box Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + if(argc > 1) + { + grp_rdr_info[0].glb_rdr = argv[1]; + grp_rdr_info[0].ctl_rdr = argv[1]; + } + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/helloworld.c b/programming-guide-zh/samples/helloworld.c new file mode 100644 index 0000000..bf50409 --- /dev/null +++ b/programming-guide-zh/samples/helloworld.c @@ -0,0 +1,74 @@ +/* +** helloworld.c: Sample program for mGNCS Programming Guide +** The first mGNCS application. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +// START_OF_HANDLERS +static void mymain_onPaint (mWidget *_this, HDC hdc, const CLIPRGN* inv) +{ + RECT rt; + GetClientRect (_this->hwnd, &rt); + DrawText (hdc, "Hello, world!", -1, &rt, DT_SINGLELINE|DT_CENTER|DT_VCENTER); +} + +static BOOL mymain_onClose (mWidget* _this, int message) +{ + DestroyMainWindow (_this->hwnd); + return TRUE; +} + +static NCS_EVENT_HANDLER mymain_handlers [] = { + {MSG_PAINT, mymain_onPaint}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; +// END_OF_HANDLERS + +int MiniGUIMain (int argc, const char* argv[]) +{ + MSG Msg; + + ncsInitialize (); + + mWidget* mymain = ncsCreateMainWindow ( + NCSCTRL_MAINWND, "Hello, world!", + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + 1, + 0, 0, 300,200, + HWND_DESKTOP, + 0, 0, + NULL, + NULL, + mymain_handlers, + 0); + +// START_OF_MSGLOOP + while (GetMessage (&Msg, mymain->hwnd)) { + TranslateMessage (&Msg); + DispatchMessage (&Msg); + } +// END_OF_MSGLOOP + + MainWindowThreadCleanup (mymain->hwnd); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/helloworld_domodal.c b/programming-guide-zh/samples/helloworld_domodal.c new file mode 100644 index 0000000..6d76bea --- /dev/null +++ b/programming-guide-zh/samples/helloworld_domodal.c @@ -0,0 +1,64 @@ +/* +** helloworld_domodal.c: Sample program for mGNCS Programming Guide. +** The mGNCS helloworld using modal main window. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +static void mymain_onPaint (mWidget *_this, HDC hdc, const CLIPRGN* inv) +{ + RECT rt; + GetClientRect (_this->hwnd, &rt); + DrawText (hdc, "Hello, world!", -1, &rt, DT_SINGLELINE|DT_CENTER|DT_VCENTER); +} + +static BOOL mymain_onClose (mWidget* _this, int message) +{ + DestroyMainWindow (_this->hwnd); + return TRUE; +} + +static NCS_EVENT_HANDLER mymain_handlers [] = { + {MSG_PAINT, mymain_onPaint}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; + +// START_OF_MINIGUIMAIN +int MiniGUIMain (int argc, const char* argv[]) +{ + ncsInitialize (); + + mMainWnd* mymain = (mMainWnd*) ncsCreateMainWindow ( + NCSCTRL_MAINWND, "Hello, world!", + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + 1, + 0, 0, 300, 200, + HWND_DESKTOP, + 0, 0, + NULL, + NULL, + mymain_handlers, + 0); + + _c(mymain)->doModal (mymain, TRUE); + + ncsUninitialize (); + + return 0; +} +// END_OF_MINIGUIMAIN + diff --git a/programming-guide-zh/samples/iconview.c b/programming-guide-zh/samples/iconview.c new file mode 100644 index 0000000..98aeba8 --- /dev/null +++ b/programming-guide-zh/samples/iconview.c @@ -0,0 +1,295 @@ +/** + * iconview.c: Sample program for mGNCS Programming Guide + * The demo application for IconView. + * + * Copyright (C) 2009 ~ 2019 FMSoft Technologies. + */ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define IDC_ICONVIEW 100 +#define IDC_ADD 600 +#define IDC_DELETE 601 + +static BITMAP icon_demos [12]; + +static const char* iconfiles[12] = +{ + "./res/acroread.png", + "./res/icons.png", + "./res/looknfeel.png", + "./res/package_games.png", + "./res/tux.png", + "./res/xemacs.png", + "./res/gimp.png", + "./res/kpilot.png", + "./res/multimedia.png", + "./res/realplayer.png", + "./res/usb.png", + "./res/xmms.png" +}; + +static const char *iconlabels[12] = +{ + "acroread", + "icons", + "looknfeel", + "games", + "tux", + "xemacs", + "gimp", + "kpilot", + "multimedia", + "realplayer", + "usb", + "xmms" +}; + +static BOOL iconv_init(mDialogBox* self) +{ + NCS_ICONV_ITEMINFO info; + static int i = 0, j = 0, pos = 0; + mIconView *iconvObj; + HWND iconvWnd; + + for(i = 0; i < TABLESIZE(icon_demos); i++) + { + LoadBitmap (HDC_SCREEN, &icon_demos[i], iconfiles[i]); + } + + iconvWnd = GetDlgItem (self->hwnd, IDC_ICONVIEW); + iconvObj = (mIconView*)ncsObjFromHandle(iconvWnd); + + if (!iconvObj) + return FALSE; + +// START_OF_ADDITEMS + _c(iconvObj)->setIconSize(iconvObj, 90, 80); + + for(i = 0; i < TABLESIZE(icon_demos); i++) + { + pos = 0; + memset (&info, 0, sizeof(NCS_ICONV_ITEMINFO)); + info.bmp = &icon_demos[i]; + info.index = TABLESIZE(icon_demos) * j + i; + info.label = iconlabels[i]; + info.addData = (DWORD)iconlabels[i]; + _c(iconvObj)->addItem(iconvObj, &info, &pos); + } + _c(iconvObj)->setCurSel(iconvObj, 0); +// END_OF_ADDITEMS + + return TRUE; +} + +// START_OF_WNDHANDLERS +static BOOL mainwnd_onKeyDown(mWidget* self, + int message, int code, DWORD key_status) +{ + if (message == MSG_KEYDOWN) { + if (code == SCANCODE_REMOVE) { + mIconView *iconView; + int curSel, count; + HITEM delItem; + + iconView = + (mIconView*)ncsObjFromHandle(GetDlgItem (self->hwnd, IDC_ICONVIEW)); + count = _c(iconView)->getItemCount(iconView); + + if (iconView) { + curSel = _c(iconView)->getCurSel(iconView); + + if (curSel >= 0) { + delItem = _c(iconView)->getItem(iconView, curSel); + _c(iconView)->removeItem(iconView, delItem); + if (curSel == count -1) + curSel--; + _c(iconView)->setCurSel(iconView, curSel); + } + } + } + } + return FALSE; +} + +static NCS_EVENT_HANDLER mainwnd_handlers[] = { + {MSG_KEYDOWN, mainwnd_onKeyDown}, + {0, NULL } +}; +// END_OF_WNDHANDLERS + +// START_OF_ICONVHANDLERS +static void iconv_notify (mWidget *self, int id, int nc, DWORD add_data) +{ + if (nc == NCSN_ICONV_CLICKED) + { + if (self) { + int idx; + const char *text; + mIconView *iconvObj = (mIconView*)self; + + idx = _c(iconvObj)->indexOf(iconvObj, (HITEM)add_data); + text = _c(iconvObj)->getText(iconvObj, (HITEM)add_data); + fprintf (stderr, "click icon[%d], text is %s \n", idx, text); + } + } +} + +static NCS_EVENT_HANDLER iconv_handlers[] = { + NCS_MAP_NOTIFY(NCSN_ICONV_CLICKED, iconv_notify), + NCS_MAP_NOTIFY(NCSN_ICONV_SELCHANGED, iconv_notify), + {0, NULL } +}; +// END_OF_ICONVHANDLERS + +// START_OF_BTNHANDLERS +static void btn_notify(mWidget *self, int id, int nc, DWORD add_data) +{ + mIconView *iconvObj = + (mIconView *)ncsGetChildObj(GetParent(self->hwnd), IDC_ICONVIEW); + + if (!iconvObj) + return; + + switch (id) + { + case IDC_ADD: + { + char buff[12]; + int count, pos = 0; + NCS_ICONV_ITEMINFO info; + + count = _c(iconvObj)->getItemCount(iconvObj); + sprintf (buff, "icon%i", count+1); + + memset (&info, 0, sizeof(NCS_ICONV_ITEMINFO)); + info.bmp = &icon_demos[0]; + info.index = count; + info.label = buff; + info.addData = (DWORD)"icon"; + + if (_c(iconvObj)->addItem(iconvObj, &info, &pos)) + _c(iconvObj)->setCurSel(iconvObj, pos); + + break; + } + + case IDC_DELETE: + { + int count, sel; + char *label = NULL; + HITEM hItem; + + sel = _c(iconvObj)->getCurSel(iconvObj); + count = _c(iconvObj)->getItemCount(iconvObj); + hItem = _c(iconvObj)->getItem(iconvObj, sel); + + if (sel >= 0) { + label = (char*)_c(iconvObj)->getAddData(iconvObj, hItem); + _c(iconvObj)->removeItem(iconvObj, hItem); + + if (sel == count -1) + sel --; + + _c(iconvObj)->setCurSel(iconvObj, sel); + } + break; + } + } +} + +static NCS_EVENT_HANDLER btn_handlers [] = { + NCS_MAP_NOTIFY(NCSN_BUTTON_PUSHED, btn_notify), + {0, NULL} +}; +// END_OF_BTNHANDLERS + +static NCS_RDR_INFO iconv_rdr_info = { + "classic", "classic", NULL +}; + +static NCS_WND_TEMPLATE _ctrl_tmpl[] = { + { + NCSCTRL_ICONVIEW, + IDC_ICONVIEW, + 15, 10, 220, 250, + WS_BORDER | WS_CHILD | WS_VISIBLE | NCSS_NOTIFY | NCSS_ICONV_LOOP, + WS_EX_NONE, + "", + NULL, + &iconv_rdr_info, + iconv_handlers, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDC_ADD, + 15, 280, 80, 30, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "add", + NULL, + NULL, + btn_handlers, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDC_DELETE, + 155, 280, 80, 30, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "delete", + NULL, + NULL, + btn_handlers, + NULL, + 0, + 0 + }, +}; + +static NCS_MNWND_TEMPLATE mainwnd_tmpl = { + NCSCTRL_DIALOGBOX, + 7, + 0, 0, 260, 350, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "IconView Demo", + NULL, + NULL, + mainwnd_handlers, + _ctrl_tmpl, + sizeof(_ctrl_tmpl)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mainwnd_tmpl, HWND_DESKTOP); + + iconv_init(mydlg); + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + ncsUninitialize(); + return 0; +} diff --git a/programming-guide-zh/samples/image.c b/programming-guide-zh/samples/image.c new file mode 100644 index 0000000..ddf1dc9 --- /dev/null +++ b/programming-guide-zh/samples/image.c @@ -0,0 +1,352 @@ +/* + * ** image.c: Sample program for mGNCS Programming Guide + * ** A mGNCS application for mImage. + * ** + * ** Copyright (C) 2009 ~ 2019 FMSoft Technologies. + * */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define IDC_IMAGE1 100 +#define IDC_IMAGE2 101 +#define IDC_IMAGE3 102 +#define IDC_IMAGE4 103 +#define IDC_IMAGE5 104 +#define IDC_IMAGE6 105 +#define IDC_IMAGE7 106 +#define IDC_IMAGE8 107 + +static BITMAP icon; +static BITMAP bitmap; + +static void set_icon_info(mWidget* self, int id, PBITMAP pbmp, int align_id, int align) +{ + mImage *img; + img = (mImage *)ncsGetChildObj(self->hwnd, id); + + if(img){ + _c(img)->setProperty(img, NCSP_IMAGE_IMAGE, (DWORD)pbmp); + _c(img)->setProperty(img, align_id, align); + } +} + + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //TODO : initialize + mImage *img; + LoadBitmapFromFile(HDC_SCREEN, &bitmap, "image_test.jpg"); + + LoadBitmapFromFile(HDC_SCREEN, &icon, "icon.png"); + + set_icon_info(self, IDC_IMAGE1, &icon, NCSP_STATIC_ALIGN, NCS_ALIGN_LEFT); + set_icon_info(self, IDC_IMAGE2, &icon, NCSP_STATIC_ALIGN, NCS_ALIGN_CENTER); + set_icon_info(self, IDC_IMAGE3, &icon, NCSP_STATIC_ALIGN, NCS_ALIGN_RIGHT); + set_icon_info(self, IDC_IMAGE4, &icon, NCSP_STATIC_VALIGN, NCS_VALIGN_TOP); + set_icon_info(self, IDC_IMAGE5, &icon, NCSP_STATIC_VALIGN, NCS_VALIGN_CENTER); + set_icon_info(self, IDC_IMAGE6, &icon, NCSP_STATIC_VALIGN, NCS_VALIGN_BOTTOM); + + img = (mImage *)ncsGetChildObj(self->hwnd, IDC_IMAGE7); + if(img){ + _c(img)->setProperty(img, NCSP_IMAGE_IMAGE, (DWORD)&bitmap); + _c(img)->setProperty(img, NCSP_IMAGE_DRAWMODE, NCS_DM_SCALED); + } + + img = (mImage *)ncsGetChildObj(self->hwnd, IDC_IMAGE8); + if(img){ + _c(img)->setProperty(img, NCSP_IMAGE_IMAGE, (DWORD)&bitmap); + _c(img)->setProperty(img, NCSP_IMAGE_DRAWMODE, NCS_DM_TILED); + } + + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); + UnloadBitmap(&bitmap); +} + + +//Propties for + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_STATIC, + 0, + 10, 10, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "image - left", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_IMAGE, + IDC_IMAGE1, + 10, 30, 100, 100, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 130, 10, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "image - center", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_IMAGE, + IDC_IMAGE2, + 130, 30, 100, 100, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 250, 10, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "image - right", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_IMAGE, + IDC_IMAGE3, + 250, 30, 100, 100, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 10, 140, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "image - top", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_IMAGE, + IDC_IMAGE4, + 10, 160, 100, 100, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 130, 140, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "image - middle", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_IMAGE, + IDC_IMAGE5, + 130, 160, 100, 100, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 250, 140, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "image - bottom", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_IMAGE, + IDC_IMAGE6, + 250, 160, 100, 100, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 10, 270, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "bitmap - scaled", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_IMAGE, + IDC_IMAGE7, + 10, 290, 280, 150, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 300, 270, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "bitmap - tiled", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_IMAGE, + IDC_IMAGE8, + 300, 290, 280, 150, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate }, + {MSG_CLOSE, mymain_onClose }, + {0, NULL } +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 600, 480, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "image Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/ledlabel.c b/programming-guide-zh/samples/ledlabel.c new file mode 100644 index 0000000..02616a9 --- /dev/null +++ b/programming-guide-zh/samples/ledlabel.c @@ -0,0 +1,141 @@ +/* + * ** ledlabel.c: Sample program for mGNCS Programming Guide + * ** A mGNCS application for mLEDLabel. + * ** + * ** Copyright (C) 2009 ~ 2019 FMSoft Technologies. + * */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define IDC_LEDLBL1 100 +#define IDC_SATAICN 107 + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //TODO : initialize + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + + +//Propties for +static NCS_PROP_ENTRY static1_props [] = { + { NCSP_LEDLBL_COLOR, 0xFF0000FF}, + { NCSP_LEDLBL_WIDTH, 10}, + { NCSP_LEDLBL_HEIGHT, 15}, + { NCSP_STATIC_ALIGN, NCS_ALIGN_RIGHT }, + { NCSP_STATIC_AUTOWRAP, 0 }, + {0, 0} +}; + +static NCS_PROP_ENTRY static2_props [] = { + { NCSP_LEDLBL_COLOR, 0xFF0000FF}, + { NCSP_LEDLBL_WIDTH, 60}, + { NCSP_LEDLBL_HEIGHT, 90}, + { NCSP_STATIC_VALIGN, NCS_VALIGN_CENTER }, + { NCSP_STATIC_ALIGN, NCS_ALIGN_CENTER }, + {0, 0} +}; + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_LEDLABEL , + IDC_LEDLBL1+0, + 10, 10, 160, 50, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "ABC 123", + NULL, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_LEDLABEL , + IDC_LEDLBL1+2, + 10, 70, 160, 30, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "2 4 6 8 0 ", + static1_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_LEDLABEL , + IDC_LEDLBL1+5, + 180, 10, 100, 100, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "4", + static2_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 300, 150, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "LEDLabel Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/listbox.c b/programming-guide-zh/samples/listbox.c new file mode 100644 index 0000000..6506f17 --- /dev/null +++ b/programming-guide-zh/samples/listbox.c @@ -0,0 +1,153 @@ +/** + * listbox.c: Sample program for mGNCS Programming Guide + * The demo application for ListBox. + * + * Copyright (C) 2009 ~ 2019 FMSoft Technologies. + */ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define IDC_LIST 100 +#define IDC_DELETE 200 + +static char* items[] = { + "Apples", + "Apricots", + "Bananas", + "Grapefruit", + "Kiwi", + "Oranges", + "Peaches", + "The Longest String" +}; + +static void lstbox_init(mDialogBox *dialog) +{ + NCS_LSTBOX_ITEMINFO iteminfo; + mListBox *lstboxObj; + int i; + + lstboxObj = (mListBox *)ncsGetChildObj(dialog->hwnd, IDC_LIST); + +// START_OF_ADDITEMS + iteminfo.flag = NCSF_LSTBOX_CMBLANK; + iteminfo.image = 0; + for (i = 0; i < TABLESIZE(items); i++) { + iteminfo.string = items[i]; + _c(lstboxObj)->addString (lstboxObj, &iteminfo); + } +// END_OF_ADDITEMS +} + +// START_OF_BTNHANDLERS +static void btn_notify(mWidget *self, int id, int nc, DWORD add_data) +{ + mListBox *lstboxObj = + (mListBox *)ncsGetChildObj(GetParent(self->hwnd), IDC_LIST); +// START_OF_DELITEMS + int sel = _c(lstboxObj)->getCurSel(lstboxObj); + int count = _c(lstboxObj)->getItemCount(lstboxObj); + + if (sel >= 0) { + _c(lstboxObj)->delString(lstboxObj, sel); + + if (sel == count -1) + sel --; + + _c(lstboxObj)->setCurSel(lstboxObj, sel); + } +// END_OF_DELITEMS +} + +static NCS_EVENT_HANDLER btn_handlers [] = { + NCS_MAP_NOTIFY(NCSN_BUTTON_PUSHED, btn_notify), + {0, NULL} +}; +// END_OF_BTNHANDLERS +static NCS_WND_TEMPLATE _ctrl_tmpl[] = { + { + NCSCTRL_LISTBOX, + IDC_LIST, + 20, 15, 170, 200, + WS_BORDER | WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDC_DELETE, + 15, 230, 80, 30, + WS_VISIBLE | WS_TABSTOP, + WS_EX_NONE, + "Delete", + NULL, + NULL, + btn_handlers, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDCANCEL, + 115, 230, 80, 30, + WS_VISIBLE | WS_TABSTOP, + WS_EX_NONE, + "Cancel", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, +}; + + +static NCS_MNWND_TEMPLATE mainwnd_tmpl = { + NCSCTRL_DIALOGBOX, + 1, + 100, 100, 220, 300, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "ListBox Demo", + NULL, + NULL, + NULL, + _ctrl_tmpl, + sizeof(_ctrl_tmpl)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + + mDialogBox* dialog = + (mDialogBox *)ncsCreateMainWindowIndirect (&mainwnd_tmpl, HWND_DESKTOP); + + lstbox_init(dialog); + _c(dialog)->doModal(dialog, TRUE); + + MainWindowThreadCleanup(dialog->hwnd); + ncsUninitialize(); + return 0; +} diff --git a/programming-guide-zh/samples/listview.c b/programming-guide-zh/samples/listview.c new file mode 100644 index 0000000..62c4926 --- /dev/null +++ b/programming-guide-zh/samples/listview.c @@ -0,0 +1,293 @@ +/** + * listview.c: Sample program for mGNCS Programming Guide + * The demo application for ListView. + * + * Copyright (C) 2009 ~ 2019 FMSoft Technologies. + */ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define IDC_LISTVIEW 100 +#define IDC_BTN1 101 +#define IDC_SLEDIT 102 + +#define COL_NR TABLESIZE(caption) +#define SCORE_NUM TABLESIZE(scores) +#define CLASS_NUM TABLESIZE(classes) +#define SUB_NUM 3 + +typedef struct _SCORE +{ + char *name; + int scr[SUB_NUM]; +} SCORE; +static char * caption [] = +{ + "Name", "Chinese", "Math", "English" +}; + +static char *classes [] = +{ + "Grade 1", "Grade 3", "Grade 2" +}; + +static SCORE scores[] = +{ + {"Tom", {81, 96, 75}}, + {"Jack", {98, 62, 84}}, + {"Merry", {79, 88, 89}}, + {"Bob", {79, 88, 89}}, +}; + +static NCS_RDR_INFO rdr_info = { + "classic","classic",NULL +}; + +static void btn_notify(mWidget *button, int id, int nc, DWORD add_data) +{ + mListView *lstvObj; + mSlEdit *sleObj; + HITEM gradeItem, hItem; + int i, j, score; + float average = 0; + char buff[20]; + + lstvObj = (mListView *)ncsGetChildObj(GetParent(button->hwnd), IDC_LISTVIEW); + sleObj = (mSlEdit *)ncsGetChildObj(GetParent(button->hwnd), IDC_SLEDIT); + if (!lstvObj) + return; + + + gradeItem = _c(lstvObj)->getChildItem(lstvObj, 0, 0); + for (i = 0; i < SCORE_NUM; i++) { + hItem = _c(lstvObj)->getChildItem(lstvObj, gradeItem, i); + + for (j = 0; j < SUB_NUM; j++) { + sscanf(_c(lstvObj)->getItemText(lstvObj, hItem, 0, j+1), "%d", &score); + average += score; + } + } + average = average / (SCORE_NUM * SUB_NUM); + + sprintf (buff, "%4.1f", average); + + _c(sleObj)->setContent(sleObj, buff, 0, strlen(buff)); +} + +static NCS_EVENT_HANDLER btn_handlers [] = { + NCS_MAP_NOTIFY(NCSN_WIDGET_CLICKED, btn_notify), + {0, NULL} +}; + +static NCS_WND_TEMPLATE _ctrl_tmpl[] = { + { + NCSCTRL_LISTVIEW, + IDC_LISTVIEW, + 10, 10, 320, 220, + WS_BORDER | WS_VISIBLE | NCSS_LISTV_SORT | NCSS_LISTV_LOOP, + WS_EX_NONE, + "score table", + NULL, + &rdr_info, + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDC_BTN1, + 240, 255, 80, 30, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "everage score", + NULL, + NULL, + btn_handlers, + NULL, + 0, + 0 + }, + { + NCSCTRL_SLEDIT, + IDC_SLEDIT, + 100, 256, 80, 28, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, +}; + +static NCS_EVENT_HANDLER mainwnd_handlers[] = { + {0, NULL} +}; + +static NCS_MNWND_TEMPLATE mainwnd_tmpl = { + NCSCTRL_DIALOGBOX, + 7, + 0, 0, 350, 340, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "ListView Demo", + NULL, + &rdr_info, + mainwnd_handlers, + _ctrl_tmpl, + sizeof(_ctrl_tmpl)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +static HITEM add_class_item (mListView *self, NCS_LISTV_ITEMINFO *info) +{ +// START_OF_ADDITEMS + NCS_LISTV_ITEMDATA subdata; + HITEM hItem; + + subdata.row = info->index; + subdata.col = 0; + subdata.text= classes[info->index]; + subdata.textColor = 0; + subdata.flags = 0; + subdata.image = 0; + + info->dataSize = 1; + info->data = &subdata; + + hItem = _c(self)->addItem (self, info); +// END_OF_ADDITEMS + + return hItem; +} + +static HITEM add_score_item (mListView *self, NCS_LISTV_ITEMINFO *info) +{ + char buff[3][20]; + HITEM hItem; + int i = info->index, j; + +// START_OF_ADDSUBITEMS + NCS_LISTV_ITEMDATA subdata[4]; + + for (j = 0; j < SCORE_NUM; j ++) { + subdata[j].flags = 0; + subdata[j].image = 0; + subdata[j].row = info->index; + subdata[j].col = j; + if (j == 0) { + subdata[j].text = scores[i].name; + subdata[j].textColor = 0; + } + else { + sprintf (buff[j-1], "%d", scores[i].scr[j-1]); + subdata[j].text = buff[j-1]; + if (scores[i].scr[j-1] > 90) + subdata[j].textColor = 0x0000FF; + else + subdata[j].textColor = 0; + } + } + + info->dataSize = SCORE_NUM; + info->data = subdata; + + hItem = _c(self)->addItem (self, info); +// END_OF_ADDSUBITEMS + + if (!hItem) + return 0; + + return hItem; +} + +static BOOL lstv_init(mDialogBox* self) +{ + int i, j; + int color; + HITEM hItem = 0, subItem; + HWND lstvWnd = GetDlgItem (self->hwnd, IDC_LISTVIEW); + mListView *lstvObj; + NCS_LISTV_ITEMINFO info; + NCS_LISTV_CLMINFO lstv_clminfo; + + lstvObj = (mListView*)ncsObjFromHandle(lstvWnd); + + if (!lstvObj) + return FALSE; + + _c(lstvObj)->freeze(lstvObj, TRUE); + //add column + +// START_OF_ADDCLMS + for (i = 0; i < COL_NR; i++) { + lstv_clminfo.index = i; + lstv_clminfo.text = caption[i]; + lstv_clminfo.width = 74; + lstv_clminfo.pfnCmp = NULL; + lstv_clminfo.flags = NCSF_LSTCLM_CENTERALIGN | NCSF_LSTHDR_CENTERALIGN; + _c(lstvObj)->addColumn(lstvObj, &lstv_clminfo); + } +// END_OF_ADDCLMS + + info.height = 25; + info.flags = 0; + info.foldIcon = 0; + info.unfoldIcon = 0; + for (i = 0; i < CLASS_NUM; i++) { + info.parent = 0; + info.index = i; + hItem = add_class_item (lstvObj, &info); + + for (j = 0; j < SCORE_NUM; j++) { + info.parent = hItem; + info.index = j; + subItem = add_score_item (lstvObj, &info); + } + + } + +// START_OF_SETBGCLR + color = 0xFFFF00; + _c(lstvObj)->setBackground(lstvObj, 1, 1, &color); + color = 0xFF0000; + _c(lstvObj)->setBackground(lstvObj, 3, 2, &color); + color = 0x007777; + _c(lstvObj)->setBackground(lstvObj, 5, -1, &color); +// END_OF_SETBGCLR + + _c(lstvObj)->freeze(lstvObj, FALSE); + + return TRUE; +} + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* dialog = + (mDialogBox *)ncsCreateMainWindowIndirect (&mainwnd_tmpl, HWND_DESKTOP); + + lstv_init(dialog); + _c(dialog)->doModal(dialog, TRUE); + + MainWindowThreadCleanup(dialog->hwnd); + ncsUninitialize(); + + return 0; +} diff --git a/programming-guide-zh/samples/menubutton.c b/programming-guide-zh/samples/menubutton.c new file mode 100644 index 0000000..1835fcc --- /dev/null +++ b/programming-guide-zh/samples/menubutton.c @@ -0,0 +1,129 @@ +/* +** menubutton.c: Sample program for mGNCS Programming Guide +** The first mGNCS application. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define ID_BTN 101 + +// START_OF_HANDLERS +static void menubutton_onitemchanged(mMenuButton *self, int id, int nc, + DWORD add_data) +{ + char szText[100]; + sprintf(szText,"id=%d",id); + MessageBox(self->hwnd, szText,"Menu ID",0); +} + +static NCS_EVENT_HANDLER menubutton_handlers[] = { + NCS_MAP_NOTIFY(NCSN_MNUBTN_ITEMCHANGED, menubutton_onitemchanged), + {0, NULL} +}; + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + mPopMenuMgr * popmenu = NEW(mPopMenuMgr); + + _c(popmenu)->addItem(popmenu,0, "menuitem 1", NULL, 200, 0, NULL, 0); + _c(popmenu)->addItem(popmenu,0, "menuitem 2", NULL, 201, 0, NULL, 0); + _c(popmenu)->addItem(popmenu,0, "menuitem 3", NULL, 202, 0, NULL, 0); + + mButton *mb1 = (mButton*)ncsGetChildObj(self->hwnd, ID_BTN); + if(mb1) + { + _c(mb1)->setProperty(mb1, NCSP_MNUBTN_POPMENU, (DWORD)popmenu); + } + + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; +// END_OF_HANDLERS + +// START_OF_RDRINFO +NCS_RDR_ELEMENT btn_rdr_elements[] = +{ + { NCS_MODE_USEFLAT, 1}, + { -1, 0 } +}; +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"skin", "skin", NULL}, +}; +// END_OF_RDRINFO + +// START_OF_TEMPLATE +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_MENUBUTTON, + ID_BTN, + 40, 40, 100, 30, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "menu button", + NULL, //props, + btn_rdr_info, //rdr_info + menubutton_handlers, //handlers, + NULL, //controls + 0, + 0 //add data + }, +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 260, 180, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Menu button", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; +// END_OF_TEMPLATE + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/panel.c b/programming-guide-zh/samples/panel.c new file mode 100644 index 0000000..9a66dfe --- /dev/null +++ b/programming-guide-zh/samples/panel.c @@ -0,0 +1,177 @@ +/* +** panel.c: Sample program for mGNCS Programming Guide +** The demo application for Panel. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define ID_PANEL_GROUP1 101 +#define ID_PANEL_GROUP2 102 + +#define ID_RED1 201 +#define ID_RED2 202 +#define ID_BLUE1 301 +#define ID_BLUE2 302 + +// START_OF_REDGROUP +static NCS_WND_TEMPLATE _ctrl_group1[] = { + { + NCSCTRL_BUTTON, + ID_RED1, + 30, 40, 80, 30, + WS_VISIBLE, + WS_EX_NONE, + "RED 1", + NULL, + NULL, + NULL, + NULL, + 0, + }, + { + NCSCTRL_BUTTON, + ID_RED2, + 30, 110, 80, 30, + WS_VISIBLE, + WS_EX_NONE, + "RED 2", + NULL, + NULL, + NULL, + NULL, + 0, + }, +}; +// END_OF_REDGROUP + +// START_OF_BLUEGROUP +static NCS_WND_TEMPLATE _ctrl_group2[] = { + { + NCSCTRL_BUTTON, + ID_BLUE1, + 30, 40, 80, 30, + WS_VISIBLE, + WS_EX_NONE, + "BLUE 1", + NULL, + NULL, + NULL, + NULL, + 0, + }, + { + NCSCTRL_BUTTON, + ID_BLUE2, + 30, 110, 80, 30, + WS_VISIBLE, + WS_EX_NONE, + "BLUE 2", + NULL, + NULL, + NULL, + NULL, + 0, + }, +}; +// END_OF_BLUEGROUP + +// START_OF_PANEL +static NCS_WND_TEMPLATE panel_tmpl[] = { + { + NCSCTRL_PANEL, + ID_PANEL_GROUP1, + 10, 10, 140, 180, + WS_VISIBLE, + WS_EX_NONE, + "Red Group", + NULL, + NULL, + NULL, + _ctrl_group1, + sizeof(_ctrl_group1)/sizeof(NCS_WND_TEMPLATE), + 0, + 0xFF0000FF, + }, + { + NCSCTRL_PANEL, + ID_PANEL_GROUP2, + 160, 10, 140, 180, + WS_VISIBLE, + WS_EX_NONE, + "Blue Group", + NULL, + NULL, + NULL, + _ctrl_group2, + sizeof(_ctrl_group2)/sizeof(NCS_WND_TEMPLATE), + 0, + 0xFFFF0000, + }, +}; +// END_OF_PANEL + +// START_OF_HANDLERS +static BOOL mainwnd_onCreate(mWidget* self, DWORD add_data) +{ + _c(self)->addChildren(self, panel_tmpl, \ + sizeof(panel_tmpl)/sizeof(NCS_WND_TEMPLATE)); + return TRUE; +} + +static void mainwnd_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + + +static NCS_EVENT_HANDLER mainwnd_handlers[] = { + {MSG_CREATE, mainwnd_onCreate}, + {MSG_CLOSE, mainwnd_onClose}, + {0, NULL} +}; +// END_OF_HANDLERS + +int MiniGUIMain(int argc, const char* argv[]) +{ + MSG Msg; + + ncsInitialize (); + + mWidget* mainwnd = ncsCreateMainWindow ( + NCSCTRL_MAINWND, "Panel Demo", + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + 1, + 0, 0, 320,240, + HWND_DESKTOP, + 0, 0, + NULL, + NULL, + mainwnd_handlers, + 0); + +// START_OF_MSGLOOP + while (GetMessage (&Msg, mainwnd->hwnd)) { + TranslateMessage (&Msg); + DispatchMessage (&Msg); + } +// END_OF_MSGLOOP + + MainWindowThreadCleanup (mainwnd->hwnd); + ncsUninitialize (); + + return 0; +} diff --git a/programming-guide-zh/samples/progressbar.c b/programming-guide-zh/samples/progressbar.c new file mode 100644 index 0000000..541875d --- /dev/null +++ b/programming-guide-zh/samples/progressbar.c @@ -0,0 +1,157 @@ +/* +** wnd_template.c: Sample program for mGNCS Programming Guide +** Using progressbar. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define ID_BTN 101 +#define ID_PROG 200 + +static BOOL mymain_onCreate (mWidget* _this, DWORD add_data) +{ + SetTimer (_this->hwnd, 100, 20); + return TRUE; +} + +static void mymain_onClose (mWidget* _this, int message) +{ + DestroyMainWindow (_this->hwnd); + PostQuitMessage (_this->hwnd); +} + +static void mymain_onTimer (mWidget *_this, int id, DWORD count) +{ +//START_OF_SET_PROPERTY + static int pb_pos = 0; + + mProgressBar *pb = (mProgressBar*)ncsGetChildObj (_this->hwnd, ID_PROG); + if (pb) + { + pb_pos++; + _c(pb)->setProperty(pb, NCSP_PROG_CURPOS, pb_pos); + + if (pb_pos == _c(pb)->getProperty(pb, NCSP_PROG_MAXPOS)) + { + DestroyMainWindow (_this->hwnd); + PostQuitMessage (_this->hwnd); + } + } +//END_OF_SET_PROPERTY +} + +static void mymain_onPaint(mWidget *self, HDC hdc, const CLIPRGN* inv) +{ + SetBkMode (hdc, BM_TRANSPARENT); + TextOut (hdc, 10, 10, "Installing ......"); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {MSG_PAINT, mymain_onPaint}, + {MSG_TIMER, mymain_onTimer}, + {0, NULL} +}; + +static void btn_onClicked(mWidget* _this, int id, int nc, HWND hCtrl) +{ + if(nc == NCSN_WIDGET_CLICKED) + { + PostMessage(GetParent(_this->hwnd), MSG_CLOSE, 0, 0); + } +}; + +static NCS_EVENT_HANDLER btn_handlers[] = +{ + {NCS_NOTIFY_CODE(NCSN_WIDGET_CLICKED), btn_onClicked}, + {0, NULL} +}; + +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"fashion","fashion", NULL} +}; + +//START_OF_INITIAL_PROPS +static NCS_PROP_ENTRY progress_props[] = +{ + {NCSP_PROG_MAXPOS, 100}, + {NCSP_PROG_MINPOS, 0 }, + {NCSP_PROG_LINESTEP, 1}, + {NCSP_PROG_CURPOS, 0 }, + { 0, 0 } +}; +//END_OF_INITIAL_PROPS + +//START_OF_TEMPLATE +static NCS_WND_TEMPLATE _ctrl_templ[] = +{ + { + NCSCTRL_PROGRESSBAR, + ID_PROG, + 10, 33, 290, 25, + WS_BORDER | WS_VISIBLE | NCSS_PRGBAR_SHOWPERCENT, + WS_EX_NONE, + "", + progress_props, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_BUTTON, + ID_BTN, + 120, 70, 80, 25, + WS_VISIBLE | NCSS_NOTIFY, + WS_EX_NONE, + "Cancel", + NULL, + btn_rdr_info, + btn_handlers, NULL, 0, 0 + }, +}; +//END_OF_TEMPLATE + +static NCS_MNWND_TEMPLATE mymain_templ = +{ + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 320, 130, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Progressbar", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain (int argc, const char* argv[]) +{ + ncsInitialize (); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal (mydlg, TRUE); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/propsheet.c b/programming-guide-zh/samples/propsheet.c new file mode 100644 index 0000000..8bd969f --- /dev/null +++ b/programming-guide-zh/samples/propsheet.c @@ -0,0 +1,272 @@ +/* +** propsheet.c: Sample program for mGNCS Programming Guide +** The demo application for PropSheet. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define PAGE_VERSION 1 +#define PAGE_CPU 2 +#define PAGE_MEMINFO 3 +#define PAGE_PARTITION 4 +#define PAGE_MINIGUI 5 + +#define BUF_LEN 10240 +#define IDC_PROPSHEET 100 +#define IDC_SYSINFO 101 +#define IDC_REFRESH 102 + +static size_t read_sysinfo (const char* file, char* buff, size_t buf_len) +{ + size_t size; + FILE *fp = fopen (file, "r"); + + if (fp == NULL) return 0; + + size = fread (buff, 1, buf_len, fp); + + fclose (fp); + return size; +} + +static void get_systeminfo (mPage* page) +{ + int type; + HWND hwnd; + char buff [BUF_LEN + 1]; + size_t size = 0; + + type = (int)GetWindowAdditionalData (page->hwnd); + hwnd = GetDlgItem(_c(page)->getPanel(page), IDC_SYSINFO); + buff [BUF_LEN] = 0; + + switch (type) { + case PAGE_VERSION: + size = read_sysinfo ("/proc/version", buff, BUF_LEN); + buff [size] = 0; + break; + + case PAGE_CPU: + size = read_sysinfo ("/proc/cpuinfo", buff, BUF_LEN); + buff [size] = 0; + break; + + case PAGE_MEMINFO: + size = read_sysinfo ("/proc/meminfo", buff, BUF_LEN); + buff [size] = 0; + break; + + case PAGE_PARTITION: + size = read_sysinfo ("/proc/partitions", buff, BUF_LEN); + buff [size] = 0; + break; + + case PAGE_MINIGUI: + size = snprintf (buff, BUF_LEN, + "MiniGUI version %d.%d.%d.\n" + "Copyright (C) 1998-2009 ~ 2019 FMSoft Technologies.\n\n" + "MiniGUI is a mature, rich-featured, embedded " + "GUI support system.\n\n" + "For more information, please visit\n\n" + "http://www.minigui.com\n", + MINIGUI_MAJOR_VERSION, MINIGUI_MINOR_VERSION, MINIGUI_MICRO_VERSION); + break; + } + + if (size) { + SetWindowText (hwnd, buff); + } + GetWindowText(hwnd, buff, BUF_LEN+1); +} + +// START_OF_PAGEHANDLERS +static void mypage_onInitPage(mWidget* self, DWORD add_data) +{ + get_systeminfo ((mPage*)self); +} + +static int mypage_onShowPage(mWidget* self, HWND hwnd, int show_cmd) +{ + return 1; +} + +static int mypage_onSheetCmd(mWidget* self, DWORD wParam, DWORD lParam) +{ + if (wParam == IDC_REFRESH) { + get_systeminfo ((mPage*)self); + } + + return 0; +} + +static NCS_EVENT_HANDLER mypage_handlers[] = { + {MSG_INITPAGE, mypage_onInitPage}, + {MSG_SHOWPAGE, mypage_onShowPage}, + {MSG_SHEETCMD, mypage_onSheetCmd}, + {0 , NULL } +}; +// END_OF_PAGEHANDLERS + +static void btn_notify(mWidget *self, int id, int nc, DWORD add_data) +{ + mPropSheet *obj = + (mPropSheet *)ncsGetChildObj(GetParent(self->hwnd), IDC_PROPSHEET); + + if (obj) { + _c(obj)->broadCastMsg(obj, IDC_REFRESH, 0); + } +} + +static NCS_EVENT_HANDLER btn_handlers [] = { + NCS_MAP_NOTIFY(NCSN_BUTTON_PUSHED, btn_notify), + {0, NULL} +}; + +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"classic","classic", NULL} +}; + +static NCS_WND_TEMPLATE _ctrl_tmpl[] = { + { + NCSCTRL_BUTTON, + IDC_REFRESH, + 10, 240, 70, 25, + WS_VISIBLE | WS_TABSTOP, + WS_EX_NONE, + "Refresh", + NULL, + btn_rdr_info, + btn_handlers, + NULL, + 0, + 0 + }, + { + NCSCTRL_BUTTON, + IDCANCEL, + 330, 240, 70, 25, + WS_VISIBLE | WS_TABSTOP, + WS_EX_NONE, + "Close", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + }, +}; + +static DLGTEMPLATE PageSysInfo = +{ + WS_BORDER | WS_CAPTION, + WS_EX_NONE, + 0, 0, 0, 0, + "", + 0, 0, + 1, NULL, + 0 +}; + +static CTRLDATA CtrlSysInfo [] = +{ + { + CTRL_STATIC, + WS_VISIBLE | SS_LEFT, + 10, 10, 370, 180, + IDC_SYSINFO, + "test", + 0 + } +}; + +static NCS_RDR_INFO prop_rdr_info[] = +{ + {"classic", "classic", NULL}, +}; + +static int init_propsheet (mDialogBox* self) +{ +// START_OF_CREATEPRPSHT + mPropSheet *propsheet = + (mPropSheet*) ncsCreateWindow (NCSCTRL_PROPSHEET, + "", WS_VISIBLE | NCSS_PRPSHT_SCROLLABLE, WS_EX_NONE, + IDC_PROPSHEET, + 10, 10, 390, 225, self->hwnd, + NULL, prop_rdr_info, NULL, 0); +// END_OF_CREATEPRPSHT + + if (!propsheet) { + fprintf (stderr, "Error> Create propsheet failure.\n"); + return 1; + } + +// START_OF_ADDPAGES + PageSysInfo.controls = CtrlSysInfo; + PageSysInfo.caption = "Version Info"; + PageSysInfo.dwAddData = PAGE_VERSION; + _c(propsheet)->addPage(propsheet, &PageSysInfo, mypage_handlers); + + PageSysInfo.caption = "CPU Info"; + PageSysInfo.dwAddData = PAGE_CPU; + _c(propsheet)->addPage(propsheet, &PageSysInfo, mypage_handlers); + + PageSysInfo.caption = "MEM Info"; + PageSysInfo.dwAddData = PAGE_MEMINFO; + _c(propsheet)->addPage(propsheet, &PageSysInfo, mypage_handlers); + + PageSysInfo.caption = "Partition Info"; + PageSysInfo.dwAddData = PAGE_PARTITION; + _c(propsheet)->addPage(propsheet, &PageSysInfo, mypage_handlers); + + PageSysInfo.caption = "MiniGUI Info"; + PageSysInfo.dwAddData = PAGE_MINIGUI; + _c(propsheet)->addPage(propsheet, &PageSysInfo, mypage_handlers); +// END_OF_ADDPAGES + + return 0; +} + +static NCS_MNWND_TEMPLATE mymain_tmpl = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 420, 305, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "PropSheet Demo", + NULL, + NULL, + NULL, + _ctrl_tmpl, + sizeof(_ctrl_tmpl)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_tmpl, HWND_DESKTOP); + + init_propsheet(mydlg); + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + ncsUninitialize(); + return 0; +} diff --git a/programming-guide-zh/samples/radiogroup.c b/programming-guide-zh/samples/radiogroup.c new file mode 100644 index 0000000..d4796a4 --- /dev/null +++ b/programming-guide-zh/samples/radiogroup.c @@ -0,0 +1,164 @@ +/* +** radiogroup.c: Sample program for mGNCS Programming Guide +** The first mGNCS application. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define ID_GROUP 200 +#define ID_BTN1 101 +#define ID_BTN2 102 + +// START_OF_HANDLERS +static BOOL mymain_onRadioChanged(mMainWnd* self, mButtonGroup* sender, + int event_id, DWORD param) +{ + mWidget* sel = (mWidget*)_c(sender)->getProperty(sender, NCSP_BTNGRP_SELOBJ); + + if(sel) + { + MessageBox(self->hwnd, (const char*)_c(sel)->getProperty(sel, + NCSP_WIDGET_TEXT), "Info", 0); + } + + return TRUE; +} + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //connect + ncsAddEventListener((mObject*)(_c(self)->getChild(self, ID_GROUP)), + (mObject*)self, (NCS_CB_ONOBJEVENT)mymain_onRadioChanged, + NCSN_BTNGRP_SELCHANGED); + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE,mymain_onCreate}, + {MSG_CLOSE,mymain_onClose}, + {0, NULL} +}; +// END_OF_HANDLERS + +// START_OF_RDRINFO +static NCS_RDR_INFO btn_rdr_info[] = +{ + {"skin", "skin", NULL}, +}; +// END_OF_RDRINFO + +// START_OF_TEMPLATE +static NCS_PROP_ENTRY radioGroup_props [] = { + {NCSP_BUTTON_GROUPID, 200}, + {0, 0} +}; + +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_BUTTONGROUP , + ID_GROUP, + 5, 10, 200, 120, + WS_VISIBLE|NCSS_NOTIFY, + WS_EX_NONE, + "Button Group", + NULL, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_RADIOBUTTON, + ID_BTN1, + 20, 30, 80, 25, + WS_VISIBLE, + WS_EX_NONE, + "option1", + radioGroup_props, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_RADIOBUTTON, + ID_BTN2, + 20, 60, 80, 25, + WS_VISIBLE, + WS_EX_NONE, + "option2", + radioGroup_props, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_RADIOBUTTON, + ID_BTN2, + 20, 90, 80, 25, + WS_VISIBLE, + WS_EX_NONE, + "option3", + radioGroup_props, //props, + btn_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 260, 180, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Radio button", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; +// END_OF_TEMPLATE + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide-zh/samples/rectangle.c b/programming-guide-zh/samples/rectangle.c new file mode 100644 index 0000000..d404173 --- /dev/null +++ b/programming-guide-zh/samples/rectangle.c @@ -0,0 +1,206 @@ +/* + * ** rectangle.c: Sample program for mGNCS Programming Guide + * ** A mGNCS application for mRect. + * ** + * ** Copyright (C) 2009 ~ 2019 FMSoft Technologies. + * */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define ID_RECT1 101 +#define ID_RECT2 102 +#define ID_RECT3 103 +#define ID_RECT4 104 + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //TODO : initialize + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + + +//Propties for +static NCS_PROP_ENTRY rect1_props [] = { + {NCSP_RECTANGLE_BORDERSIZE, 3}, + {NCSP_RECTANGLE_BORDERCOLOR, 0xFFFF0000}, + {NCSP_RECTANGLE_FILLCOLOR, 0x00000000}, + {0, 0} +}; + +static NCS_PROP_ENTRY rect2_props [] = { + {NCSP_RECTANGLE_BORDERSIZE, 2}, + {NCSP_RECTANGLE_BORDERCOLOR, 0xFFFFFFF}, + {NCSP_RECTANGLE_FILLCOLOR, 0xFF0F0F0F}, + {0, 0} +}; + +static NCS_PROP_ENTRY rect3_props [] = { + {NCSP_RECTANGLE_BORDERSIZE, 0}, + {NCSP_RECTANGLE_BORDERCOLOR, 0xFF0C0000}, + {NCSP_RECTANGLE_FILLCOLOR, 0xFF00FFFF}, + {0, 0} +}; + +static NCS_PROP_ENTRY rect4_props [] = { + {NCSP_RECTANGLE_BORDERSIZE, 5}, + {NCSP_RECTANGLE_BORDERCOLOR, 0xFF0000FF}, + {NCSP_RECTANGLE_FILLCOLOR, 0xFF00FF00}, + {NCSP_RECTANGLE_XRADIUS, 4}, + {NCSP_RECTANGLE_YRADIUS, 4}, + {0, 0} +}; + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_STATIC, + 0, + 10, 10, 80, 40, + WS_VISIBLE, WS_EX_NONE, + "Normal rectangle:", + NULL, NULL, NULL, NULL, + 0, 0 + }, + { + NCSCTRL_RECTANGLE, + ID_RECT1, + 110, 10, 80, 40, + WS_VISIBLE, + WS_EX_NONE, + "", + rect1_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 10, 60, 80, 40, + WS_VISIBLE, WS_EX_NONE, + "Filled rectangle:", + NULL, NULL, NULL, NULL, + 0, 0 + }, + { + NCSCTRL_RECTANGLE, + ID_RECT2, + 110, 60, 80, 40, + WS_VISIBLE, + WS_EX_NONE, + "", + rect2_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 10, 110, 80, 40, + WS_VISIBLE, WS_EX_NONE, + "no Border rectangle:", + NULL, NULL, NULL, NULL, + 0, 0 + }, + { + NCSCTRL_RECTANGLE, + ID_RECT3, + 110, 110, 80, 40, + WS_VISIBLE, + WS_EX_NONE, + "", + rect3_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + 0, + 10, 160, 80, 40, + WS_VISIBLE, WS_EX_NONE, + "Round rectangle:", + NULL, NULL, NULL, NULL, + 0, 0 + }, + { + NCSCTRL_RECTANGLE, + ID_RECT4, + 110, 160, 80, 40, + WS_VISIBLE, + WS_EX_NONE, + "", + rect4_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate }, + {MSG_CLOSE, mymain_onClose }, + {0, NULL } +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 320, 320, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Rectangle Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + printf("NCSP_RECTANGLE_BORDERSIZE=%d\n",NCSP_RECTANGLE_BORDERSIZE); + + _c(mydlg)->doModal(mydlg, TRUE); + + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/resmgr.c b/programming-guide-zh/samples/resmgr.c new file mode 100644 index 0000000..3eab361 --- /dev/null +++ b/programming-guide-zh/samples/resmgr.c @@ -0,0 +1,39 @@ +/* +** resmgr.c: Sample program for mGNCS Programming Guide +** Create main window by resource managerment. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "resource.h" +#include "ncs-windows.h" + +static NCS_EVENT_HANDLER_INFO mainwnd_Mainwnd1_handlers[] = { + + {-1, NULL} +}; + +NCS_WND_EXPORT mMainWnd* ntCreateMainwnd1Ex(HPACKAGE package, HWND hParent, HICON h_icon, HMENU h_menu, DWORD user_data) +{ +// START_OF_UIWINDOW + return ncsCreateMainWindowIndirectFromID(package, + ID_MAINWND1, + hParent, + h_icon, + h_menu, + mainwnd_Mainwnd1_handlers, + NULL, + user_data); +// END_OF_UIWINDOW +} diff --git a/programming-guide-zh/samples/resmgr_main.c b/programming-guide-zh/samples/resmgr_main.c new file mode 100644 index 0000000..a942d4f --- /dev/null +++ b/programming-guide-zh/samples/resmgr_main.c @@ -0,0 +1,63 @@ +/* +** resmgr_main.c: Sample program for mGNCS Programming Guide +** The application entry of resource managerment. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "resource.h" +#include "ncs-windows.h" + +HPACKAGE hPackage = HPACKAGE_NULL; + +int MiniGUIMain(int argc, const char* argv[]) +{ +#ifdef ntStartWindowEx + MSG Msg; + char f_package[MAX_PATH]; + mMainWnd *mWin; + + ncsInitialize(); +// START_OF_LOADRESPKG + sprintf(f_package, "%s", "resmgr_demo.res"); + SetResPath("./"); + + hPackage = ncsLoadResPackage (f_package); + if (hPackage == HPACKAGE_NULL) { + printf ("load resource package:%s failure.\n", f_package); + return 1; + } +// END_OF_LOADRESPKG + +// START_OF_GETSTRING + SetDefaultWindowElementRenderer(ncsGetString(hPackage, NCSRM_SYSSTR_DEFRDR)); +// END_OF_GETSTRING + + mWin = ntStartWindowEx(hPackage, HWND_DESKTOP, (HICON)0, (HMENU)0, (DWORD)0); + + while(GetMessage(&Msg, mWin->hwnd)) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + + MainWindowThreadCleanup(mWin->hwnd); +// START_OF_UNLOADPKG + ncsUnloadResPackage(hPackage); +// END_OF_UNLOADPKG + ncsUninitialize(); +#endif + + return 0; +} diff --git a/programming-guide-zh/samples/scrollbar.c b/programming-guide-zh/samples/scrollbar.c new file mode 100644 index 0000000..9c1974e --- /dev/null +++ b/programming-guide-zh/samples/scrollbar.c @@ -0,0 +1,145 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define ID_SB1 100 +#define ID_SB2 101 + +static RECT rcCircle = {0, 0, 400, 400}; +static int radius_x = 0; +static int radius_y = 0; + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + return TRUE; +} +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +static void mymain_onPaint(mWidget* self, HDC hdc, const PCLIPRGN clip_rgn) +{ + ClipRectIntersect(hdc, &rcCircle); + Ellipse(hdc, 130, 200, radius_x, radius_y); +} + +//define the progress properites +static NCS_PROP_ENTRY scrollbar_props [] = { + {NCSP_SCRLBR_MAXPOS, 255}, + {NCSP_SCRLBR_MINPOS, 0 }, + {NCSP_SCRLBR_LINESTEP, 5}, + {NCSP_SCRLBR_CURPOS, 10 }, + { 0, 0 } +}; + + +static void scrollbar_notify(mScrollBar* self, int id, int code, DWORD add_data) +{ + HWND hWnd = GetParent(self->hwnd); + + if(id == ID_SB1) + radius_x = _c(self)->getProperty(self, NCSP_SCRLBR_CURPOS); + + if(id == ID_SB2) + radius_y = _c(self)->getProperty(self, NCSP_SCRLBR_CURPOS); + + InvalidateRect(hWnd, &rcCircle, TRUE); +} + +static NCS_EVENT_HANDLER scrollbar_notifies[] = { + NCS_MAP_NOTIFY(NCSN_SCRLBR_CHANGED, scrollbar_notify), + {0, NULL} +}; + +static NCS_RDR_INFO sb_rdr_info[] = +{ + {"flat", "flat", NULL}, + //{"skin", "skin", NULL}, + //{"fashion","fashion", NULL} +}; + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_SCROLLBAR, + ID_SB1, + 0, 440, 270, 25, + WS_BORDER | NCSS_NOTIFY | WS_VISIBLE | NCSS_SCRLBR_ARROWS, + WS_EX_NONE, + "", + scrollbar_props, //props, + sb_rdr_info, //rdr_info + scrollbar_notifies, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_SCROLLBAR, + ID_SB2, + 270, 10, 20, 430, + WS_BORDER | NCSS_NOTIFY | WS_VISIBLE \ + | NCSS_SCRLBR_ARROWS | NCSS_SCRLBR_VERTICAL, + WS_EX_NONE, + "", + scrollbar_props, //props, + sb_rdr_info, //rdr_info + scrollbar_notifies, + NULL, //controls + 0, + 0 //add data + }, +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {MSG_PAINT, mymain_onPaint}, + {0, NULL} +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 300, 500, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "scrollbar Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + if(argc>1) + { + sb_rdr_info[0].glb_rdr = argv[1]; + sb_rdr_info[0].ctl_rdr = argv[1]; + } + + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} diff --git a/programming-guide-zh/samples/scrollview.c b/programming-guide-zh/samples/scrollview.c new file mode 100644 index 0000000..1f60916 --- /dev/null +++ b/programming-guide-zh/samples/scrollview.c @@ -0,0 +1,219 @@ +/* +** scrollview.c: Sample program for mGNCS Programming Guide +** The demo application for ScrollView. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +// START_OF_INCS +#include +#include +#include +#include + +#include +// END_OF_INCS + +#define IDC_SCROLLVIEW 100 + +static const char *people[] = +{ + "cao cao", + "sun quan", + "liu bei", + "zhu ge liang", + "guan yu", + "pang tong", + "si ma yu", +}; + +static NCS_RDR_INFO rdr_info = { + "classic","classic",NULL +}; + +// START_OF_HANDLERS +static void scrlv_notify (mWidget *self, int id, int nc, DWORD add_data) +{ + if (nc == NCSN_SCRLV_CLICKED) + { + if (self) { + const char* info; + mIconView *cls = (mIconView*)self; + + info = (const char*)_c(cls)->getAddData(cls, (HITEM)add_data); + + fprintf (stderr, "current item's data %s \n", info); + } + } +} + +static NCS_EVENT_HANDLER scrlv_handlers[] = { + NCS_MAP_NOTIFY(NCSN_SCRLV_CLICKED, scrlv_notify), + {0, NULL } +}; +// END_OF_HANDLERS + +static NCS_WND_TEMPLATE _ctrl_tmpl[] = { + { + NCSCTRL_SCROLLVIEW, + IDC_SCROLLVIEW, + 10, 10, 320, 150, + WS_BORDER | WS_VISIBLE | NCSS_NOTIFY | NCSS_SCRLV_SORT, + WS_EX_NONE, + "", + NULL, + &rdr_info, + scrlv_handlers, + NULL, + 0, + 0 + }, +}; + +static BOOL dialog_onKeyDown(mWidget* self, + int message, int code, DWORD key_status) +{ + if (message == MSG_KEYDOWN) { + if (code == SCANCODE_REMOVE) { + mScrollView *scrlvObj; + int curSel, count; + HITEM delItem; + + scrlvObj = + (mScrollView*)ncsObjFromHandle(GetDlgItem(self->hwnd, IDC_SCROLLVIEW)); + count = _c(scrlvObj)->getItemCount(scrlvObj); + + if (scrlvObj) { + curSel = _c(scrlvObj)->getCurSel(scrlvObj); + + if (curSel >= 0) { + delItem = _c(scrlvObj)->getItem(scrlvObj, curSel); + _c(scrlvObj)->removeItem(scrlvObj, delItem); + if (curSel == count -1) + curSel--; + _c(scrlvObj)->setCurSel(scrlvObj, curSel); + } + } + } + } + return FALSE; +} + +static NCS_EVENT_HANDLER dialog_handlers[] = { + {MSG_KEYDOWN, dialog_onKeyDown}, + {0, NULL } +}; + +static NCS_MNWND_TEMPLATE dialog_tmpl = { + NCSCTRL_DIALOGBOX, + 7, + 0, 0, 350, 200, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "ScrollView Demo", + NULL, + &rdr_info, + dialog_handlers, + _ctrl_tmpl, + sizeof(_ctrl_tmpl)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +// START_OF_ITEMFUNCS +static int scrlv_cmp_item (mItemManager *manager, HITEM hItem1, HITEM hItem2) +{ + mScrollView *scrlvObj = (mScrollView*)manager->obj; + const char *name1; + const char *name2; + + if (scrlvObj) { + name1 = (const char*)_c(scrlvObj)->getAddData(scrlvObj, hItem1); + name2 = (const char*)_c(scrlvObj)->getAddData(scrlvObj, hItem2); + return strcmp (name1, name2); + } + return 0; +} + +static void scrlv_draw_item (mItemView *self, HITEM hItem, HDC hdc, RECT *rcDraw) +{ + const char *name = (const char*)_c(self)->getAddData(self, hItem); + gal_pixel oldBrushClr = 0, oldTextClr = 0; + BOOL isHilite = FALSE; + int top; + RECT rcText; + + SetBkMode (hdc, BM_TRANSPARENT); + + top = rcDraw->top; + if (_c(self)->indexOf(self, hItem) > 0) { + top --; + } + + if (_c(self)->isHilight(self, hItem)) { + isHilite = TRUE; + oldBrushClr = SetBrushColor (hdc, PIXEL_blue); + FillBox (hdc, rcDraw->left + 1, + top + 1, RECTWP(rcDraw) - 2, RECTHP(rcDraw) - 1); + oldTextClr = SetTextColor (hdc, PIXEL_lightwhite); + } + + Rectangle (hdc, rcDraw->left, top, rcDraw->right - 1, rcDraw->bottom - 1); + + CopyRect(&rcText, rcDraw); + rcText.left += 5; + DrawText(hdc, name, -1, &rcText, DT_VCENTER | DT_SINGLELINE); + + if (isHilite) { + SetBrushColor (hdc, oldBrushClr); + SetTextColor (hdc, oldTextClr); + } +} +// END_OF_ITEMFUNCS + +static BOOL scrlv_init(mDialogBox* self) +{ + int i; + HWND scrlvWnd; + mScrollView *scrlvObj; + NCS_SCRLV_ITEMINFO info; + + scrlvWnd = GetDlgItem (self->hwnd, IDC_SCROLLVIEW); + scrlvObj = (mScrollView*)ncsObjFromHandle(scrlvWnd); + + if (!scrlvObj) + return FALSE; + +// START_OF_ADDITEMS + _c(scrlvObj)->freeze(scrlvObj, TRUE); + _c(scrlvObj)->setItemCmpFunc(scrlvObj, scrlv_cmp_item); + _c(scrlvObj)->setItemDraw(scrlvObj, scrlv_draw_item); + + for (i = 0; i < TABLESIZE(people); i++) { + info.height = 32; + info.index = i; + info.addData = (DWORD)people[i]; + _c(scrlvObj)->addItem(scrlvObj, &info, NULL); + } + _c(scrlvObj)->freeze(scrlvObj, FALSE); +// END_OF_ADDITEMS + return TRUE; +} + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = + (mDialogBox *)ncsCreateMainWindowIndirect (&dialog_tmpl, HWND_DESKTOP); + + scrlv_init(mydlg); + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + ncsUninitialize(); + return 0; +} diff --git a/programming-guide-zh/samples/separator.c b/programming-guide-zh/samples/separator.c new file mode 100644 index 0000000..cfef602 --- /dev/null +++ b/programming-guide-zh/samples/separator.c @@ -0,0 +1,105 @@ +/* + * ** separator.c: Sample program for mGNCS Programming Guide + * ** A mGNCS application for mSeparator. + * ** + * ** Copyright (C) 2009 ~ 2019 FMSoft Technologies. + * */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define ID_GROUP 101 + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //TODO : initialize + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_SEPARATOR , + ID_GROUP, + 10, 10, 280, 5, + WS_VISIBLE, + WS_EX_NONE, + "groupbox", + NULL, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_SEPARATOR , + ID_GROUP, + 100, 20, 5, 200, + WS_VISIBLE|NCSS_SPRTR_VERT, + WS_EX_NONE, + "groupbox", + NULL, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate }, + {MSG_CLOSE, mymain_onClose }, + {0, NULL } +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 320, 240, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Separator Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/spinbox.c b/programming-guide-zh/samples/spinbox.c new file mode 100644 index 0000000..765cb33 --- /dev/null +++ b/programming-guide-zh/samples/spinbox.c @@ -0,0 +1,180 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +//START_SPINBOX +#define ID_SPINBOX1 101 +#define ID_SPINBOX2 102 +#define ID_SPINBOX3 103 +#define ID_SPINBOX4 104 + +static char * item [] = +{ + "SpinBox item-1st", + "SpinBox item-2nd", + "SpinBox item-3rd", + "SpinBox item-4th" +}; + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + int i; + mSpinBox *spinner3, *spinner4; + + spinner3 = (mSpinBox *)_c(self)->getChild(self, ID_SPINBOX3); + spinner4 = (mSpinBox *)_c(self)->getChild(self, ID_SPINBOX4); + + for (i = 0; i < sizeof(item)/sizeof(char*); i++) + { + + _c(spinner3)->addItem (spinner3, item[i]); + + _c(spinner4)->addItem (spinner4, item[i]); + + } + + return TRUE; +} + + +//Propties for +static NCS_PROP_ENTRY spinner_props [] = { + + {NCSP_SPNBOX_MAXPOS, 12}, + {NCSP_SPNBOX_MINPOS, 0}, + {NCSP_SPNBOX_CURPOS, 0}, + {NCSP_SPNBOX_LINESTEP, 1}, + {0, 0} +}; + +//END_SPINBOX + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + + + +static NCS_RDR_INFO spin_rdr_info[] = +{ + {"fashion", "fashion", NULL} +}; + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_SPINBOX , + ID_SPINBOX1, + 20, 10, 100, 20, + WS_VISIBLE | NCSS_SPNBOX_HORIZONTAL | NCSS_SPNBOX_NUMBER | NCSS_SPNBOX_READONLY, + WS_EX_NONE, + "spinbox", + spinner_props, //props, + spin_rdr_info, //NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_SPINBOX , + ID_SPINBOX2, + 20, 40, 100, 20, + WS_VISIBLE | NCSS_SPNBOX_VERTICAL | NCSS_SPNBOX_NUMBER | NCSS_SPNBOX_AUTOLOOP, + WS_EX_NONE, + "spinbox", + spinner_props, //props, + spin_rdr_info, //NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_SPINBOX , + ID_SPINBOX3, + 150, 10, 150, 20, + WS_VISIBLE | NCSS_SPNBOX_HORIZONTAL | NCSS_SPNBOX_STRING, + WS_EX_NONE, + "spinbox", + NULL, //props, + spin_rdr_info, //NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_SPINBOX , + ID_SPINBOX4, + 150, 40, 150, 20, + WS_VISIBLE | NCSS_SPNBOX_VERTICAL | NCSS_SPNBOX_STRING, + WS_EX_NONE, + "spinbox", + NULL, //props, + spin_rdr_info, //NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + } +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE,mymain_onCreate}, + {MSG_CLOSE,mymain_onClose}, + {0, NULL} +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 340, 150, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "SpinBox Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + if(argc>1) + { + spin_rdr_info[0].glb_rdr = argv[1]; + spin_rdr_info[0].ctl_rdr = argv[1]; + } + + + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/spinner.c b/programming-guide-zh/samples/spinner.c new file mode 100644 index 0000000..102ba92 --- /dev/null +++ b/programming-guide-zh/samples/spinner.c @@ -0,0 +1,187 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define ID_SPINNER1 101 +#define ID_SHOWSPINNER1 201 +#define ID_SPINNER2 102 +#define ID_SHOWSPINNER2 202 + +#define MINVALUE 0 +#define MAXVALUE 10 +#define CURVALUE 5 + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //START_GET_CTRLS + mSpinner * spn1, *spn2; + mStatic * show1, * show2; + spn1 = (mSpinner*)_c(self)->getChild(self, ID_SPINNER1); + spn2 = (mSpinner*)_c(self)->getChild(self, ID_SPINNER2); + show1 = (mStatic*)_c(self)->getChild(self, ID_SHOWSPINNER1); + show2 = (mStatic*)_c(self)->getChild(self, ID_SHOWSPINNER2); + //END_GET_CTRLS + + //START_CONNECT_PROPS + ncsConnectBindProps( + NCS_CMPT_PROP(spn1, NCSN_SPNR_CHANGED, NCSP_SPNR_CURPOS, NCS_BT_INT, NCS_PROP_FLAG_READ), + NCS_CMPT_PROP(show1, 0, NCSP_WIDGET_TEXT, NCS_BT_STR, NCS_PROP_FLAG_WRITE), + NCS_BPT_SIGNALE); + + ncsConnectBindProps( + NCS_CMPT_PROP(spn2, NCSN_SPNR_CHANGED, NCSP_SPNR_CURPOS, NCS_BT_INT, NCS_PROP_FLAG_READ), + NCS_CMPT_PROP(show2, 0, NCSP_WIDGET_TEXT, NCS_BT_STR, NCS_PROP_FLAG_WRITE), + NCS_BPT_SIGNALE); + //END_CONNECT_PROPS + + //START_UPDATE_CTRLS + ncsRaiseComponentBindProps((mComponent*)spn1, NCSN_SPNR_CHANGED); + ncsRaiseComponentBindProps((mComponent*)spn2, NCSN_SPNR_CHANGED); + //END_UPDATE_CTRLS + + + return TRUE; +} + +static void mymain_onClose (mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +//START_SET_PROPS +//Propties for +static NCS_PROP_ENTRY spinbox_props [] = { + {NCSP_SPNR_MINPOS, MINVALUE}, + {NCSP_SPNR_MAXPOS, MAXVALUE}, + {NCSP_SPNR_CURPOS, CURVALUE}, + {NCSP_SPNR_LINESTEP, 1}, + {0, 0} +}; +//END_SET_PROPS + +static NCS_RDR_INFO spin_rdr_info[] = +{ + {"skin", "skin", NULL}, + //{"fashion", "fashion", NULL}, + //{"flat", "flat", NULL}, +}; + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_STATIC, + ID_SHOWSPINNER1, + 100,40, 100,20, + WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, + 0, + 0 + }, + { + NCSCTRL_SPINNER , + ID_SPINNER1, + 30, 40, 20, 20, + WS_VISIBLE | NCSS_SPNBOX_VERTICAL | NCSS_NOTIFY, + WS_EX_NONE, + "spinbox", + spinbox_props, //props, + spin_rdr_info, //NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC, + ID_SHOWSPINNER2, + 100, 100, 100, 20, + WS_VISIBLE, + WS_EX_NONE, + "", + NULL, + NULL, + 0, + 0 + }, + + { + NCSCTRL_SPINNER , + ID_SPINNER2, + 30, 100, 20, 20, + WS_VISIBLE | NCSS_SPNBOX_HORIZONTAL | NCSS_NOTIFY, + WS_EX_NONE, + "spinbox", + spinbox_props, //props, + spin_rdr_info, //NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + } +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE,mymain_onCreate}, + {MSG_CLOSE,mymain_onClose}, + {0, NULL} +}; + +static NCS_RDR_INFO mymain_rdr_info[] = +{ + {"skin", "skin", NULL}, +}; + + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 260, 200, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Spinner Test ....", + NULL, + mymain_rdr_info, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + if(argc>1) + { + spin_rdr_info[0].glb_rdr = argv[1]; + spin_rdr_info[0].ctl_rdr = argv[1]; + } + + + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/static.c b/programming-guide-zh/samples/static.c new file mode 100644 index 0000000..d3c6b43 --- /dev/null +++ b/programming-guide-zh/samples/static.c @@ -0,0 +1,203 @@ +/* + * ** static.c: Sample program for mGNCS Programming Guide + * ** A mGNCS application for mStatic. + * ** + * ** Copyright (C) 2009 ~ 2019 FMSoft Technologies. + * */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define IDC_STATIC1 100 +#define IDC_SATAICN 107 + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //TODO : initialize + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + + +//Propties for +static NCS_PROP_ENTRY static1_props [] = { + { NCSP_STATIC_ALIGN, NCS_ALIGN_CENTER }, + {0, 0} +}; +static NCS_PROP_ENTRY static2_props [] = { + { NCSP_STATIC_ALIGN, NCS_ALIGN_RIGHT }, + {0, 0} +}; +static NCS_PROP_ENTRY static4_props [] = { + { NCSP_STATIC_VALIGN, NCS_VALIGN_TOP }, + {0, 0} +}; + +static NCS_PROP_ENTRY static5_props [] = { + { NCSP_STATIC_VALIGN, NCS_VALIGN_BOTTOM }, + {0, 0} +}; + +static NCS_PROP_ENTRY static6_props [] = { + { NCSP_STATIC_AUTOWRAP, 0 }, + {0, 0} +}; + + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_STATIC , + IDC_STATIC1+0, + 10, 10, 160, 30, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Default Text", + NULL, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC , + IDC_STATIC1+1, + 10, 50, 160, 30, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Center Text", + static1_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC , + IDC_STATIC1+2, + 10, 90, 160, 30, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Right Text", + static2_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC , + IDC_STATIC1+3, + 220, 10, 80, 120, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Defalut VCenter ", + NULL, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC , + IDC_STATIC1+4, + 315, 10, 70, 120, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Top Text", + static4_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC , + IDC_STATIC1+5, + 400, 10, 70, 120, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Bottom Text", + static5_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + { + NCSCTRL_STATIC , + IDC_STATIC1+6, + 10, 160, 220, 30, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "This static control shows the Single Line Text", + static6_props, //props, + NULL, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 480, 270, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "static Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/timer.c b/programming-guide-zh/samples/timer.c new file mode 100644 index 0000000..2d7c9ce --- /dev/null +++ b/programming-guide-zh/samples/timer.c @@ -0,0 +1,141 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +//START_UPDATE_TIME +static BOOL update_time(mStatic *listener, + mTimer* sender, + int id, + DWORD total_count) +{ + char szText[100]; + time_t tim; + struct tm *ptm; + static int old_count = 0; + + time(&tim); + ptm = localtime(&tim); + + sprintf(szText, + "%02d:%02d:%d", + ptm->tm_hour, + ptm->tm_min, + ptm->tm_sec); + old_count = total_count; + + SetWindowText(listener->hwnd, szText); + InvalidateRect(listener->hwnd, NULL, TRUE); + + return FALSE; +} +//END_UPDATE_TIME + + +//START_TIMER_CONNECT +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + //TODO : initialize + mTimer * timer = SAFE_CAST(mTimer, + _c(self)->getChild(self, 100)); + if(timer) + { + ncsAddEventListener((mObject*)timer, + (mObject*)ncsGetChildObj(self->hwnd, 101), + (NCS_CB_ONPIECEEVENT)update_time, + MSG_TIMER); + _c(timer)->start(timer); + } + return TRUE; +} +//END_TIMER_CONNECT + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +//Controls +//START_DECLARE_TIMER +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_TIMER, + 100, + 10, 10, 0, 0, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + NULL, //props, + NULL, //rdr_info + NULL, //timer_props, //handlers, + NULL, //controls + 0, + 0 //add data + }, +//END_DECLARE_TIMER + { + NCSCTRL_STATIC, + 101, + 10,10, 100, 30, + WS_VISIBLE, + 0, + "", + NULL, + NULL, + NULL, + NULL, + 0, + 0 + } +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {0, NULL} +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 150, 80, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Digital Clock", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + +#ifdef _MGRM_THREADS +#include +#endif + diff --git a/programming-guide-zh/samples/trackbar.c b/programming-guide-zh/samples/trackbar.c new file mode 100644 index 0000000..dcdde16 --- /dev/null +++ b/programming-guide-zh/samples/trackbar.c @@ -0,0 +1,176 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define ID_TRB1 101 +#define ID_TRB2 102 +#define ID_RECT 200 + +static BOOL mymain_onCreate(mWidget* self, DWORD add_data) +{ + return TRUE; +} + +static void mymain_onClose(mWidget* self, int message) +{ + DestroyMainWindow(self->hwnd); + PostQuitMessage(0); +} + +static NCS_PROP_ENTRY trk_props [] = { + {NCSP_TRKBAR_MINPOS, 0}, + {NCSP_TRKBAR_MAXPOS, 25}, + {NCSP_TRKBAR_CURPOS, 0}, + {NCSP_TRKBAR_LINESTEP, 5}, + {NCSP_TRKBAR_PAGESTEP, 5}, + {0, 0} +}; + +static void trackbar_notify(mTrackBar* self, int id, int code, DWORD add_data) +{ + mRectangle *rect = (mRectangle*)ncsGetChildObj(GetParent(self->hwnd), ID_RECT); + + if(rect) + { + DWORD fill_color = _c(rect)->getProperty(rect, NCSP_RECTANGLE_FILLCOLOR); + int r = GetRValue(fill_color); + int g = GetGValue(fill_color); + int b = GetBValue(fill_color); + int v = _c(self)->getProperty(self, NCSP_TRKBAR_CURPOS); + switch(id) + { + case ID_TRB1: + r = 10 * v; + break; + case ID_TRB2: + g = 10 * v; + break; + } + + fill_color = MakeRGBA(r, g, b,255); + + const RECT rc = {10, 10, 230, 230}; + + _c(rect)->setProperty(rect, NCSP_RECTANGLE_FILLCOLOR, fill_color); + InvalidateRect(rect->hwnd, &rc, TRUE); + } +} +static NCS_RDR_INFO track_rdr_info[] = +{ + {"flat", "flat", NULL}, + //{"skin", "skin", NULL}, + //{"classic", "classic", NULL}, + //{"fashion","fashion",NULL} +}; + + +static NCS_EVENT_HANDLER trk1_handlers[] = { + NCS_MAP_NOTIFY(NCSN_TRKBAR_CHANGED, trackbar_notify), + {0, NULL} +}; + +static NCS_EVENT_HANDLER trk2_handlers[] = { + NCS_MAP_NOTIFY(NCSN_TRKBAR_CHANGED, trackbar_notify), + {0, NULL} +}; + + +//Controls +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_RECTANGLE, + ID_RECT, + 10, 10, 230, 230, + WS_VISIBLE, + WS_EX_NONE, + "", + NULL, //props, + NULL,//btn2_rdr_info, //rdr_info + NULL, //handlers, + NULL, //controls + 0, + 0 //add data + }, + + { + NCSCTRL_TRACKBAR, + ID_TRB1, + 10, 260, 240, 40, + WS_BORDER | WS_VISIBLE | NCSS_TRKBAR_NOTICK | NCSS_NOTIFY , + WS_EX_TRANSPARENT, + "", + trk_props, //props, + track_rdr_info, //rdr_info + trk1_handlers, //handlers, + NULL, //controls + 0, + 0, //add data + MakeRGBA(255,0,0,255) + }, + { + NCSCTRL_TRACKBAR, + ID_TRB2, + 260, 10, 40, 240, + WS_BORDER | WS_VISIBLE | NCSS_NOTIFY | NCSS_TRKBAR_VERTICAL, + WS_EX_NONE, + "", + trk_props, //props, + track_rdr_info, //rdr_info + trk2_handlers, //handlers, + NULL, //controls + 0, + 0 //add data + }, +}; + + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate }, + {MSG_CLOSE, mymain_onClose }, + {0, NULL } +}; + +//define the main window template +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 320, 330, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Trackbar Test ....", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + MakeRGBA(255,255,255,255) +}; + +int MiniGUIMain(int argc, const char* argv[]) +{ + if(argc>1) + { + track_rdr_info[0].glb_rdr = argv[1]; + track_rdr_info[0].ctl_rdr = argv[1]; + } + + + ncsInitialize(); + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal(mydlg, TRUE); + + MainWindowThreadCleanup(mydlg->hwnd); + return 0; +} + diff --git a/programming-guide-zh/samples/wnd_template.c b/programming-guide-zh/samples/wnd_template.c new file mode 100644 index 0000000..e17bef5 --- /dev/null +++ b/programming-guide-zh/samples/wnd_template.c @@ -0,0 +1,150 @@ +/* +** wnd_template.c: Sample program for mGNCS Programming Guide +** Using window template. +** +** Copyright (C) 2009 ~ 2019 FMSoft Technologies. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define ID_BTN 101 +#define ID_PROG 200 + +// START_OF_HANDLERS +static BOOL mymain_onCreate (mWidget* _this, DWORD add_data) +{ + SetTimer (_this->hwnd, 100, 20); + return TRUE; +} + +// START_OF_ONTIMER +static void mymain_onTimer (mWidget *_this, int id, DWORD count) +{ + static int pb_pos = 0; + mProgressBar *pb = (mProgressBar*)ncsGetChildObj (_this->hwnd, ID_PROG); + if (pb) + _c(pb)->setProperty(pb, NCSP_PROG_CURPOS, pb_pos++); +} +// END_OF_ONTIMER + +static void mymain_onClose (mWidget* _this, int message) +{ + DestroyMainWindow (_this->hwnd); + PostQuitMessage (_this->hwnd); +} + +static NCS_EVENT_HANDLER mymain_handlers[] = { + {MSG_CREATE, mymain_onCreate}, + {MSG_CLOSE, mymain_onClose}, + {MSG_TIMER, mymain_onTimer}, + {0, NULL} +}; +// END_OF_HANDLERS + +// START_OF_RDRINFO +static NCS_RDR_ELEMENT btn_rdr_elements[] = +{ + { NCS_MODE_USEFLAT, 1}, + { -1, 0 } +}; + +static NCS_RDR_INFO btn1_rdr_info[] = +{ + {"fashion","fashion", btn_rdr_elements} +}; + +static NCS_RDR_INFO btn2_rdr_info[] = +{ + {"flat", "flat", NULL} +}; +// END_OF_RDRINFO + +// START_OF_PROPERTIES +static NCS_PROP_ENTRY progress_props [] = { + {NCSP_PROG_MAXPOS, 100}, + {NCSP_PROG_MINPOS, 0 }, + {NCSP_PROG_LINESTEP, 1}, + {NCSP_PROG_CURPOS, 0 }, + { 0, 0 } +}; +// END_OF_PROPERTIES + +// START_OF_TEMPLATE +static NCS_WND_TEMPLATE _ctrl_templ[] = { + { + NCSCTRL_PROGRESSBAR, + ID_PROG, + 10, 10, 290, 30, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "", + progress_props, + NULL, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_BUTTON, + ID_BTN, + 10, 50, 100, 25, + WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "button1", + NULL, + btn1_rdr_info, + NULL, NULL, 0, 0 + }, + { + NCSCTRL_BUTTON, + ID_BTN, + 200, 50, 100, 25, + WS_VISIBLE, + WS_EX_NONE, + "button2", + NULL, + btn2_rdr_info, + NULL, NULL, 0, 0 + }, + +}; + +static NCS_MNWND_TEMPLATE mymain_templ = { + NCSCTRL_DIALOGBOX, + 1, + 0, 0, 320, 110, + WS_CAPTION | WS_BORDER | WS_VISIBLE, + WS_EX_NONE, + "Window Template", + NULL, + NULL, + mymain_handlers, + _ctrl_templ, + sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE), + 0, + 0, 0, +}; +// END_OF_TEMPLATE + +int MiniGUIMain (int argc, const char* argv[]) +{ + ncsInitialize (); + + mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect + (&mymain_templ, HWND_DESKTOP); + + _c(mydlg)->doModal (mydlg, TRUE); + + ncsUninitialize (); + + return 0; +} + diff --git a/programming-guide/.DS_Store b/programming-guide/.DS_Store new file mode 100644 index 0000000..6163feb Binary files /dev/null and b/programming-guide/.DS_Store differ