Merge pull request #769 from JunielKatarn/wx_3.0

Upgrade wxWidgets to version 3.0.2
This commit is contained in:
zilmar 2015-11-22 16:58:28 +11:00
commit b5a4dc4eef
1288 changed files with 304945 additions and 98479 deletions

View File

@ -25,7 +25,7 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WIN32;_WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

View File

@ -0,0 +1,161 @@
/* XPM */
static const char *const wxwin16x16_xpm[] = {
"16 16 142 2",
" c None",
". c #7171C0",
"+ c #7D7DC7",
"@ c #8181CE",
"# c #7979CE",
"$ c #7171CE",
"% c #6868CD",
"& c #5050C0",
"* c #7C7CCB",
"= c #D3D3FC",
"- c #C0C0FF",
"; c #B1B1FF",
"> c #A4A4FF",
", c #9696FF",
"' c #6B6BE3",
") c #3E3EC0",
"! c #7B7BD3",
"~ c #CFCFFF",
"{ c #A7A7FF",
"] c #8989FF",
"^ c #7B7BFF",
"/ c #5E5EEB",
"( c #3333BF",
"_ c #6969D3",
": c #BEBEFF",
"< c #8E8EFF",
"[ c #5E5EFF",
"} c #4C4CFD",
"| c #6464C6",
"1 c #A4A478",
"2 c #BFBF63",
"3 c #BFBF5C",
"4 c #BFBF56",
"5 c #BFBF51",
"6 c #C17474",
"7 c #BF7070",
"8 c #BF6969",
"9 c #BF6363",
"0 c #544AC7",
"a c #A8A8FF",
"b c #7070FF",
"c c #5050FF",
"d c #3F3FFF",
"e c #8C8CBA",
"f c #F6F6C8",
"g c #FBFBBB",
"h c #FBFBAE",
"i c #FBFBA1",
"j c #F9F993",
"k c #D7D760",
"l c #D28D8D",
"m c #EEB8B8",
"n c #EFAAAA",
"o c #EF9E9E",
"p c #7C5ABC",
"q c #8D8DFF",
"r c #4747FF",
"s c #3535FF",
"t c #2B2BFF",
"u c #AAAAA7",
"v c #FFFFD2",
"w c #FFFFA9",
"x c #FFFF9A",
"y c #FFFF8D",
"z c #FFFF80",
"A c #E4E45B",
"B c #E39F9F",
"C c #FFCCCC",
"D c #FFA9A9",
"E c #FF9C9C",
"F c #B469A0",
"G c #3E3DE7",
"H c #2828EF",
"I c #1E1EEF",
"J c #1515EF",
"K c #A5A595",
"L c #FFFFC2",
"M c #FFFF8F",
"N c #F7F765",
"O c #F2F251",
"P c #DBDB3A",
"Q c #E48E8E",
"R c #FFBABA",
"S c #FF8E8E",
"T c #FF8181",
"U c #FF6868",
"V c #E54D60",
"W c #AC2E56",
"X c #0B0BBF",
"Y c #0606BF",
"Z c #C8C85D",
"` c #FEFEB1",
" . c #FEFE74",
".. c #F4F456",
"+. c #EFEF42",
"@. c #EFEF38",
"#. c #D7D725",
"$. c #E47676",
"%. c #FFA8A8",
"&. c #FF7373",
"*. c #FF5555",
"=. c #FF4343",
"-. c #FF3939",
";. c #DA2323",
">. c #CFCF3C",
",. c #F6F694",
"'. c #F0F047",
"). c #EFEF2E",
"!. c #EFEF24",
"~. c #D7D715",
"{. c #E45757",
"]. c #FF8888",
"^. c #FF4646",
"/. c #FF2F2F",
"(. c #FF2525",
"_. c #DA1414",
":. c #C3C328",
"<. c #EBEB55",
"[. c #ECEC2F",
"}. c #ECEC24",
"|. c #ECEC1A",
"1. c #EBEB10",
"2. c #CDCD06",
"3. c #DD3A3A",
"4. c #FF6060",
"5. c #FF1B1B",
"6. c #FE1111",
"7. c #D10707",
"8. c #B8B819",
"9. c #B7B715",
"0. c #B7B710",
"a. c #B7B70B",
"b. c #B7B706",
"c. c #B7B701",
"d. c #B7B700",
"e. c #BF1A1A",
"f. c #CC1919",
"g. c #CE1414",
"h. c #CE0E0E",
"i. c #CE0808",
"j. c #C90202",
"k. c #C00000",
" ",
" ",
" . + @ # $ % & ",
" * = - ; > , ' ) ",
" ! ~ { , ] ^ / ( ",
" _ : < ^ [ } | 1 2 3 4 5 ",
"6 7 8 9 0 a b c d e f g h i j k ",
"l m n o p q r s t u v w x y z A ",
"B C D E F G H I J K L M z N O P ",
"Q R S T U V W X Y Z ` ...+.@.#.",
"$.%.&.*.=.-.;. >.,.'.@.).!.~.",
"{.].^.-./.(._. :.<.[.}.|.1.2.",
"3.4./.(.5.6.7. 8.9.0.a.b.c.d.",
"e.f.g.h.i.j.k. ",
" ",
" "};

View File

@ -0,0 +1,442 @@
/* XPM */
static const char *const wxwin32x32_xpm[] = {
"32 32 407 2",
" c None",
". c #7373C1",
"+ c #6E6EBF",
"@ c #6B6BBF",
"# c #6868BF",
"$ c #6464BF",
"% c #6161BF",
"& c #5E5EBF",
"* c #5A5ABF",
"= c #5959C0",
"- c #7171C0",
"; c #7272C1",
"> c #8686CE",
", c #8686D0",
"' c #8282D0",
") c #7D7DD0",
"! c #7979D0",
"~ c #7575D0",
"{ c #7171D0",
"] c #6D6DD0",
"^ c #6666CD",
"/ c #5151C1",
"( c #4C4CBF",
"_ c #7171C1",
": c #7272C2",
"< c #C1C1F2",
"[ c #D7D7FF",
"} c #C9C9FF",
"| c #C2C2FF",
"1 c #BBBBFF",
"2 c #B4B4FF",
"3 c #AEAEFF",
"4 c #A7A7FF",
"5 c #A0A0FF",
"6 c #9A9AFF",
"7 c #8484F2",
"8 c #4949C2",
"9 c #4444C1",
"0 c #6A6AC0",
"a c #8989D4",
"b c #DADAFF",
"c c #C0C0FF",
"d c #9393FF",
"e c #8C8CFF",
"f c #8686FF",
"g c #5454D4",
"h c #3E3EC0",
"i c #6363BF",
"j c #8686D8",
"k c #D4D4FF",
"l c #D2D2FF",
"m c #7F7FFF",
"n c #7878FF",
"o c #4F4FD7",
"p c #3737BF",
"q c #5C5CBF",
"r c #7D7DD8",
"s c #CCCCFF",
"t c #CACAFF",
"u c #A8A8FF",
"v c #7070FF",
"w c #6B6BFF",
"x c #4545D7",
"y c #3030BF",
"z c #5555BF",
"A c #7373D8",
"B c #C3C3FF",
"C c #9C9CFF",
"D c #8D8DFF",
"E c #7777FF",
"F c #6262FF",
"G c #5252FF",
"H c #4B4BFF",
"I c #4848FF",
"J c #3232D7",
"K c #2626BF",
"L c #4E4EBF",
"M c #6A6AD8",
"N c #B9B9FF",
"O c #9090FF",
"P c #6F6FFF",
"Q c #5555FF",
"R c #4646FF",
"S c #4B4BF5",
"T c #8282B4",
"U c #93938E",
"V c #B1B173",
"W c #BFBF68",
"X c #BFBF65",
"Y c #BFBF62",
"Z c #BFBF5E",
"` c #BFBF5B",
" . c #BFBF57",
".. c #BFBF54",
"+. c #BFBF51",
"@. c #5858D8",
"#. c #B2B2FF",
"$. c #B1B1FF",
"%. c #8484FF",
"&. c #7272FF",
"*. c #6767FF",
"=. c #4F4FFF",
"-. c #4747FF",
";. c #4242FF",
">. c #4141FA",
",. c #ABAB8A",
"'. c #E4E4AA",
"). c #F5F5C3",
"!. c #F6F6BE",
"~. c #F6F6B7",
"{. c #F6F6B1",
"]. c #F6F6AB",
"^. c #F6F6A5",
"/. c #F6F69E",
"(. c #F6F698",
"_. c #F1F18C",
":. c #D0D05F",
"<. c #BFBF48",
"[. c #C17474",
"}. c #C07171",
"|. c #BF6E6E",
"1. c #BF6B6B",
"2. c #BF6868",
"3. c #BF6464",
"4. c #BF6161",
"5. c #7C498C",
"6. c #4242D8",
"7. c #A4A4FF",
"8. c #5959FF",
"9. c #3D3DFF",
"0. c #3838FF",
"a. c #6666CA",
"b. c #DCDC98",
"c. c #FFFFDD",
"d. c #FFFFD7",
"e. c #FFFFC0",
"f. c #FFFFB8",
"g. c #FFFFB2",
"h. c #FFFFAB",
"i. c #FFFFA4",
"j. c #FFFF9D",
"k. c #FFFF97",
"l. c #FFFF90",
"m. c #FBFB85",
"n. c #C2C244",
"o. c #C37676",
"p. c #DA9B9B",
"q. c #DF9F9F",
"r. c #DF9A9A",
"s. c #DF9494",
"t. c #DF8F8F",
"u. c #DF8A8A",
"v. c #B47094",
"w. c #3B3BD8",
"x. c #9292FF",
"y. c #5656FF",
"z. c #3333FF",
"A. c #2E2EFF",
"B. c #7070B6",
"C. c #E7E79F",
"D. c #FFFFDE",
"E. c #FFFFCF",
"F. c #FFFFB5",
"G. c #FFFF9E",
"H. c #FFFF8A",
"I. c #FFFF83",
"J. c #FFFF7C",
"K. c #C8C843",
"L. c #C06D6D",
"M. c #F1BEBE",
"N. c #FFDBDB",
"O. c #FFCBCB",
"P. c #FFC0C0",
"Q. c #FFBABA",
"R. c #FFB3B3",
"S. c #FFACAC",
"T. c #CE89AC",
"U. c #3333D7",
"V. c #8787FF",
"W. c #4D4DFF",
"X. c #2929FF",
"Y. c #2424FF",
"Z. c #6B6BB3",
"`. c #E7E795",
" + c #FFFFC6",
".+ c #FFFFA8",
"++ c #FFFF76",
"@+ c #FFFF6F",
"#+ c #C8C83C",
"$+ c #C77474",
"%+ c #FFD3D3",
"&+ c #FFDEDE",
"*+ c #FFC4C4",
"=+ c #FFA6A6",
"-+ c #FF9F9F",
";+ c #F3929A",
">+ c #2F29C3",
",+ c #4C4CFB",
"'+ c #6868FF",
")+ c #3939FF",
"!+ c #1F1FFF",
"~+ c #1A1AFF",
"{+ c #6666B0",
"]+ c #E7E78A",
"^+ c #FFFFD0",
"/+ c #FFFFBD",
"(+ c #FFFF9B",
"_+ c #FFFF91",
":+ c #FAFA6E",
"<+ c #F5F55F",
"[+ c #F5F558",
"}+ c #F7F756",
"|+ c #C7C732",
"1+ c #C86E6E",
"2+ c #FFC9C9",
"3+ c #FFD7D7",
"4+ c #FFB8B8",
"5+ c #FF9898",
"6+ c #FF9292",
"7+ c #FF8B8B",
"8+ c #B16098",
"9+ c #2420C6",
"0+ c #2222DD",
"a+ c #1F1FDF",
"b+ c #1B1BDF",
"c+ c #1818DF",
"d+ c #1414DF",
"e+ c #1010DF",
"f+ c #0C0CDF",
"g+ c #5F5F9C",
"h+ c #E7E77F",
"i+ c #FFFFC9",
"j+ c #FFFFB4",
"k+ c #FFFF8E",
"l+ c #FFFF7D",
"m+ c #FEFE75",
"n+ c #F4F45D",
"o+ c #EFEF4F",
"p+ c #EFEF4A",
"q+ c #EFEF44",
"r+ c #EFEF3F",
"s+ c #BFBF22",
"t+ c #C86666",
"u+ c #FFBFBF",
"v+ c #FFD0D0",
"w+ c #FFADAD",
"x+ c #FF8484",
"y+ c #FF7E7E",
"z+ c #FF7373",
"A+ c #E75F70",
"B+ c #B0457F",
"C+ c #9A3776",
"D+ c #5F1D7C",
"E+ c #0C0CBF",
"F+ c #0909BF",
"G+ c #0707BF",
"H+ c #0404BF",
"I+ c #878766",
"J+ c #E6E674",
"K+ c #FFFFC2",
"L+ c #FFFF82",
"M+ c #FEFE6E",
"N+ c #F3F355",
"O+ c #EFEF45",
"P+ c #EFEF40",
"Q+ c #EFEF3B",
"R+ c #EFEF36",
"S+ c #BFBF1C",
"T+ c #C85F5F",
"U+ c #FFB4B4",
"V+ c #FFA2A2",
"W+ c #FF7575",
"X+ c #FF5E5E",
"Y+ c #FF5050",
"Z+ c #FF4A4A",
"`+ c #FF4545",
" @ c #E73535",
".@ c #BF2121",
"+@ c #B7B733",
"@@ c #DCDC55",
"#@ c #FDFDB7",
"$@ c #FFFFA2",
"%@ c #FFFF75",
"&@ c #FCFC64",
"*@ c #F2F24E",
"=@ c #EFEF31",
"-@ c #EFEF2C",
";@ c #BFBF16",
">@ c #C85656",
",@ c #FFAAAA",
"'@ c #FFC2C2",
")@ c #FF9797",
"!@ c #FF7777",
"~@ c #FF6E6E",
"{@ c #FF5454",
"]@ c #FF4040",
"^@ c #FF3B3B",
"/@ c #E72C2C",
"(@ c #BF1919",
"_@ c #B7B72E",
":@ c #DADA48",
"<@ c #F7F7A6",
"[@ c #F6F689",
"}@ c #F2F254",
"|@ c #EFEF27",
"1@ c #EFEF22",
"2@ c #BFBF10",
"3@ c #C84040",
"4@ c #FF9A9A",
"5@ c #FFBBBB",
"6@ c #FF7171",
"7@ c #FF6666",
"8@ c #FF4E4E",
"9@ c #FF4646",
"0@ c #FF4141",
"a@ c #FF3C3C",
"b@ c #FF3737",
"c@ c #FF3232",
"d@ c #E72424",
"e@ c #BF1414",
"f@ c #B7B729",
"g@ c #DADA3F",
"h@ c #F7F7A1",
"i@ c #F4F480",
"j@ c #F0F047",
"k@ c #EFEF1D",
"l@ c #EFEF18",
"m@ c #BFBF0B",
"n@ c #C83636",
"o@ c #FFABAB",
"p@ c #FF7676",
"q@ c #FF2D2D",
"r@ c #FF2828",
"s@ c #E71C1C",
"t@ c #BF0F0F",
"u@ c #B7B724",
"v@ c #D1D132",
"w@ c #F4F478",
"x@ c #EFEF13",
"y@ c #ECEC0E",
"z@ c #BABA05",
"A@ c #C83030",
"B@ c #FF6161",
"C@ c #FF2323",
"D@ c #FF1E1E",
"E@ c #E71414",
"F@ c #BF0A0A",
"G@ c #B8B820",
"H@ c #B9B91F",
"I@ c #DADA2C",
"J@ c #E9E931",
"K@ c #EAEA2A",
"L@ c #EAEA25",
"M@ c #EAEA20",
"N@ c #EAEA1C",
"O@ c #EAEA17",
"P@ c #EAEA12",
"Q@ c #EAEA0D",
"R@ c #E5E508",
"S@ c #C7C703",
"T@ c #B7B701",
"U@ c #C52929",
"V@ c #FF5858",
"W@ c #FF1919",
"X@ c #FF1414",
"Y@ c #E30C0C",
"Z@ c #BF0606",
"`@ c #B8B819",
" # c #B7B717",
".# c #B7B714",
"+# c #B7B711",
"@# c #B7B70F",
"## c #B7B70C",
"$# c #B7B70A",
"%# c #B7B707",
"&# c #B7B705",
"*# c #B7B702",
"=# c #B7B700",
"-# c #BF2020",
";# c #E63131",
"># c #FF5555",
",# c #FF3A3A",
"'# c #FF0F0F",
")# c #FA0A0A",
"!# c #C90303",
"~# c #C00202",
"{# c #C01C1C",
"]# c #CB1B1B",
"^# c #D01A1A",
"/# c #D01616",
"(# c #D01313",
"_# c #D01010",
":# c #D00D0D",
"<# c #D00A0A",
"[# c #D00707",
"}# c #CF0303",
"|# c #C30101",
"1# c #C00000",
"2# c #C21414",
"3# c #BF1111",
"4# c #BF0E0E",
"5# c #BF0C0C",
"6# c #BF0909",
"7# c #BF0707",
"8# c #BF0404",
"9# c #BF0202",
"0# c #C50000",
" ",
" ",
" ",
" ",
" . + @ # $ % & * = ",
" - ; > , ' ) ! ~ { ] ^ / ( ",
" _ : < [ } | 1 2 3 4 5 6 7 8 9 ",
" 0 a b b c 2 3 4 5 6 d e f g h ",
" i j k l 2 4 5 6 d e f m n o p ",
" q r s t u 6 d e f m n v w x y ",
" z A B | C D f m E F G H I J K ",
" L M 1 N O m n P Q H R S T U V W X Y Z ` ...+. ",
" p @.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.",
" [.}.|.1.2.3.4.5.6.6 7.&.8.I ;.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.",
"}.o.p.q.r.s.t.u.v.w.O x.y.;.9.0.z.A.B.C.D.E.F.h.i.G.k.l.H.I.J.K.",
"L.M.N.O.P.Q.R.S.T.U.V.e W.0.z.A.X.Y.Z.`.d. +.+G.k.l.H.I.J.++@+#+",
"$+%+&+*+R.S.=+-+;+>+,+'+)+A.X.Y.!+~+{+]+^+/+(+_+H.I.J.:+<+[+}+|+",
"1+2+3+4+=+-+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+I.l+m+n+o+p+q+r+s+",
"t+u+v+w+5+6+7+x+y+z+A+B+C+D+E+F+G+H+I+J+K+h.L+++M+N+p+O+P+Q+R+S+",
"T+U+2+V+7+x+y+W+X+Y+Z+`+ @.@ +@@@#@$@%@&@*@O+P+Q+R+=@-@;@",
">@,@'@)@y+!@~@{@Z+`+]@^@/@(@ _@:@<@[@}@O+P+Q+R+=@-@|@1@2@",
"3@4@5@7+6@7@8@9@0@a@b@c@d@e@ f@g@h@i@j@Q+R+=@-@|@1@k@l@m@",
"n@y+o@p@{@9@0@a@b@c@q@r@s@t@ u@v@i@w@Q+=@-@|@1@k@l@x@y@z@",
"A@p@-+B@0@a@b@c@q@r@C@D@E@F@ G@H@I@J@K@L@M@N@O@P@Q@R@S@T@",
"U@7@4@V@b@c@q@r@C@D@W@X@Y@Z@ `@ #.#+#@###$#%#&#*#=#=# ",
"-#;#>#,#q@r@C@D@W@X@'#)#!#~# ",
"{#(@]#^#/#(#_#:#<#[#}#|#1# ",
" 2#3#4#5#6#7#8#9#1#0# ",
" ",
" ",
" ",
" "};

View File

@ -1,241 +1,256 @@
/////////////////////////////////////////////////////////////////////////////
// Name: msvc/wx/msw/setup.h
// Name: msvc/wx/setup.h
// Purpose: wrapper around the real wx/setup.h for Visual C++
// Author: Vadim Zeitlin
// Modified by:
// Created: 2004-12-12
// RCS-ID: $Id: setup.h 43687 2006-11-27 15:03:59Z VZ $
// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER
#error "This file should only be included when using Microsoft Visual C++"
#endif
// VC++ IDE predefines _DEBUG and _UNICODE for the new projects itself, but
// the other symbols (WXUSINGDLL, __WXUNIVERSAL__, ...) should be defined
// explicitly!
#ifdef _MSC_VER
#include "wx/version.h"
#include "wx/cpp.h"
// notice that wxSUFFIX_DEBUG is a string but wxSUFFIX itself must be an
// identifier as string concatenation is not done inside #include where we
// need it
#ifdef _DEBUG
#define wxSUFFIX_DEBUG "d"
#ifdef _UNICODE
#ifdef WXUSINGDLL
#ifdef _DEBUG
#include "../../../lib/vc_dll/mswud/wx/setup.h"
#else
#include "../../../lib/vc_dll/mswu/wx/setup.h"
#endif
#else
#ifdef _DEBUG
#include "../../../lib/vc_lib/mswud/wx/setup.h"
#else
#include "../../../lib/vc_lib/mswu/wx/setup.h"
#endif
#endif
#ifdef _DEBUG
#pragma comment(lib,"wxbase28ud")
#pragma comment(lib,"wxbase28ud_net")
#pragma comment(lib,"wxbase28ud_xml")
#if wxUSE_REGEX
#pragma comment(lib,"wxregexud")
#endif
#if wxUSE_GUI
#if wxUSE_XML
#pragma comment(lib,"wxexpatd")
#endif
#if wxUSE_LIBJPEG
#pragma comment(lib,"wxjpegd")
#endif
#if wxUSE_LIBPNG
#pragma comment(lib,"wxpngd")
#endif
#if wxUSE_LIBTIFF
#pragma comment(lib,"wxtiffd")
#endif
#if wxUSE_ZLIB
#pragma comment(lib,"wxzlibd")
#endif
#pragma comment(lib,"wxmsw28ud_adv")
#pragma comment(lib,"wxmsw28ud_core")
#pragma comment(lib,"wxmsw28ud_html")
#if wxUSE_GLCANVAS
#pragma comment(lib,"wxmsw28ud_gl")
#endif
#if wxUSE_DEBUGREPORT
#pragma comment(lib,"wxmsw28ud_qa")
#endif
#if wxUSE_XRC
#pragma comment(lib,"wxmsw28ud_xrc")
#endif
#if wxUSE_AUI
#pragma comment(lib,"wxmsw28ud_aui")
#endif
#if wxUSE_RICHTEXT
#pragma comment(lib,"wxmsw28ud_richtext")
#endif
#if wxUSE_MEDIACTRL
#pragma comment(lib,"wxmsw28ud_media")
#endif
#if wxUSE_ODBC
#pragma comment(lib,"wxbase28ud_odbc")
#endif
#endif // wxUSE_GUI
#else // release
#pragma comment(lib,"wxbase28u")
#pragma comment(lib,"wxbase28u_net")
#pragma comment(lib,"wxbase28u_xml")
#if wxUSE_REGEX
#pragma comment(lib,"wxregexu")
#endif
#if wxUSE_GUI
#if wxUSE_XML
#pragma comment(lib,"wxexpat")
#endif
#if wxUSE_LIBJPEG
#pragma comment(lib,"wxjpeg")
#endif
#if wxUSE_LIBPNG
#pragma comment(lib,"wxpng")
#endif
#if wxUSE_LIBTIFF
#pragma comment(lib,"wxtiff")
#endif
#if wxUSE_ZLIB
#pragma comment(lib,"wxzlib")
#endif
#pragma comment(lib,"wxmsw28u_adv")
#pragma comment(lib,"wxmsw28u_core")
#pragma comment(lib,"wxmsw28u_html")
#if wxUSE_GLCANVAS
#pragma comment(lib,"wxmsw28u_gl")
#endif
#if wxUSE_DEBUGREPORT
#pragma comment(lib,"wxmsw28u_qa")
#endif
#if wxUSE_XRC
#pragma comment(lib,"wxmsw28u_xrc")
#endif
#if wxUSE_AUI
#pragma comment(lib,"wxmsw28u_aui")
#endif
#if wxUSE_RICHTEXT
#pragma comment(lib,"wxmsw28u_richtext")
#endif
#if wxUSE_MEDIACTRL
#pragma comment(lib,"wxmsw28u_media")
#endif
#if wxUSE_ODBC
#pragma comment(lib,"wxbase28u_odbc")
#endif
#endif // wxUSE_GUI
#endif // debug/release
#define wxSUFFIX ud
#else // !_UNICODE
#ifdef WXUSINGDLL
#ifdef _DEBUG
#include "../../../lib/vc_dll/mswd/wx/setup.h"
#else
#include "../../../lib/vc_dll/msw/wx/setup.h"
#endif
#else // static lib
#ifdef _DEBUG
#include "../../../lib/vc_lib/mswd/wx/setup.h"
#else
#include "../../../lib/vc_lib/msw/wx/setup.h"
#endif
#endif // shared/static
#ifdef _DEBUG
#pragma comment(lib,"wxbase28d")
#if wxUSE_REGEX
#pragma comment(lib,"wxregexd")
#endif
#if wxUSE_GUI
#if wxUSE_XML
#pragma comment(lib,"wxexpatd")
#endif
#if wxUSE_LIBJPEG
#pragma comment(lib,"wxjpegd")
#endif
#if wxUSE_LIBPNG
#pragma comment(lib,"wxpngd")
#endif
#if wxUSE_LIBTIFF
#pragma comment(lib,"wxtiffd")
#endif
#if wxUSE_ZLIB
#pragma comment(lib,"wxzlibd")
#endif
#pragma comment(lib,"wxmsw28d_core")
#if wxUSE_GLCANVAS
#pragma comment(lib,"wxmsw28d_gl")
#endif
#if wxUSE_DEBUGREPORT
#pragma comment(lib,"wxmsw28d_qa")
#endif
#if wxUSE_XRC
#pragma comment(lib,"wxmsw28d_xrc")
#endif
#if wxUSE_AUI
#pragma comment(lib,"wxmsw28d_aui")
#endif
#if wxUSE_RICHTEXT
#pragma comment(lib,"wxmsw28d_richtext")
#endif
#if wxUSE_MEDIACTRL
#pragma comment(lib,"wxmsw28d_media")
#endif
#if wxUSE_ODBC
#pragma comment(lib,"wxbase28d_odbc")
#endif
#endif // wxUSE_GUI
#else // release
#pragma comment(lib,"wxbase28")
#if wxUSE_REGEX
#pragma comment(lib,"wxregex")
#endif
#if wxUSE_GUI
#if wxUSE_XML
#pragma comment(lib,"wxexpat")
#endif
#if wxUSE_LIBJPEG
#pragma comment(lib,"wxjpeg")
#endif
#if wxUSE_LIBPNG
#pragma comment(lib,"wxpng")
#endif
#if wxUSE_LIBTIFF
#pragma comment(lib,"wxtiff")
#endif
#if wxUSE_ZLIB
#pragma comment(lib,"wxzlib")
#endif
#pragma comment(lib,"wxmsw28_core")
#if wxUSE_GLCANVAS
#pragma comment(lib,"wxmsw28_gl")
#endif
#if wxUSE_DEBUGREPORT
#pragma comment(lib,"wxmsw28_qa")
#endif
#if wxUSE_XRC
#pragma comment(lib,"wxmsw28_xrc")
#endif
#if wxUSE_AUI
#pragma comment(lib,"wxmsw28_aui")
#endif
#if wxUSE_RICHTEXT
#pragma comment(lib,"wxmsw28_richtext")
#endif
#if wxUSE_MEDIACTRL
#pragma comment(lib,"wxmsw28_media")
#endif
#if wxUSE_ODBC
#pragma comment(lib,"wxbase28_odbc")
#endif
#endif // wxUSE_GUI
#endif // debug/release
#define wxSUFFIX d
#endif // _UNICODE/!_UNICODE
#else
#error "This file should only be included when using Microsoft Visual C++"
#define wxSUFFIX_DEBUG ""
#ifdef _UNICODE
#define wxSUFFIX u
#else // !_UNICODE
// don't define wxSUFFIX at all as preprocessor operations don't work
// with empty values so we need to check for this case specially below
#endif // _UNICODE/!_UNICODE
#endif
// compiler-specific prefix: by default it's always just "vc" for compatibility
// reasons but if you use multiple MSVC versions you probably build them with
// COMPILER_PREFIX=vcXX and in this case you may want to either predefine
// wxMSVC_VERSION as "XX" or define wxMSVC_VERSION_AUTO to use the appropriate
// version depending on the compiler used
#ifdef wxMSVC_VERSION
#define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION)
#elif defined(wxMSVC_VERSION_AUTO)
#if _MSC_VER == 1200
#define wxCOMPILER_PREFIX vc60
#elif _MSC_VER == 1300
#define wxCOMPILER_PREFIX vc70
#elif _MSC_VER == 1310
#define wxCOMPILER_PREFIX vc71
#elif _MSC_VER == 1400
#define wxCOMPILER_PREFIX vc80
#elif _MSC_VER == 1500
#define wxCOMPILER_PREFIX vc90
#elif _MSC_VER == 1600
#define wxCOMPILER_PREFIX vc100
#elif _MSC_VER == 1700
#define wxCOMPILER_PREFIX vc110
#elif _MSC_VER == 1800
#define wxCOMPILER_PREFIX vc120
#else
#error "Unknown MSVC compiler version, please report to wx-dev."
#endif
#else
#define wxCOMPILER_PREFIX vc
#endif
// architecture-specific part: not used (again, for compatibility), for x86
#if defined(_M_X64)
#define wxARCH_SUFFIX// _x64//Project64: Disable arch suffix.
#elif defined(_M_IA64)
#define wxARCH_SUFFIX// _ia64//Project64: Disable arch suffix.
#else // assume _M_IX86
#define wxARCH_SUFFIX
#endif
// Ensure the library configuration is defined
#ifndef wxCFG
#define wxCFG
#endif
// Construct the path for the subdirectory under /lib/ that the included setup.h
// will be used from
#ifdef WXUSINGDLL
#define wxLIB_SUBDIR \
wxCONCAT4(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _dll, wxCFG)
#else // !DLL
#define wxLIB_SUBDIR \
wxCONCAT4(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _lib, wxCFG)
#endif // DLL/!DLL
// The user can predefine a different prefix if not using the default MSW port
// with MSVC.
#ifndef wxTOOLKIT_PREFIX
#if defined(__WXGTK__)
#define wxTOOLKIT_PREFIX gtk2
#else
#define wxTOOLKIT_PREFIX msw
#endif
#endif // wxTOOLKIT_PREFIX
// the real setup.h header file we need is in the build-specific directory,
// construct the path to it
#ifdef wxSUFFIX
#define wxSETUPH_PATH \
wxCONCAT6(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, wxSUFFIX, /wx/setup.h)
#else // suffix is empty
#define wxSETUPH_PATH \
wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, /wx/setup.h)
#endif
#define wxSETUPH_PATH_STR wxSTRINGIZE(wxSETUPH_PATH)
#include wxSETUPH_PATH_STR
// the library names depend on the build, these macro builds the correct
// library name for the given base name
#ifdef wxSUFFIX
#define wxSUFFIX_STR wxSTRINGIZE(wxSUFFIX)
#else // suffix is empty
#define wxSUFFIX_STR ""
#endif
#define wxSHORT_VERSION_STRING \
wxSTRINGIZE(wxMAJOR_VERSION) wxSTRINGIZE(wxMINOR_VERSION)
#define wxWX_LIB_NAME(name, subname) \
"wx" name wxSHORT_VERSION_STRING wxSUFFIX_STR subname
#define wxBASE_LIB_NAME(name) wxWX_LIB_NAME("base", "_" name)
#define wxTOOLKIT_LIB_NAME(name) wxWX_LIB_NAME(wxSTRINGIZE(wxTOOLKIT_PREFIX), "_" name)
// This one is for 3rd party libraries: they don't have the version number
// in their names and usually exist in ANSI version only (except for regex)
//
// 3rd party libraries are also are not linked in when using DLLs as they're
// embedded inside our own DLLs and don't need to be linked with the user code.
#define wx3RD_PARTY_LIB_NAME(name) "wx" name wxSUFFIX_DEBUG
// special version for regex as it does have a Unicode version
#define wx3RD_PARTY_LIB_NAME_U(name) "wx" name wxSUFFIX_STR
#pragma comment(lib, wxWX_LIB_NAME("base", ""))
#ifndef wxNO_NET_LIB
#ifndef WXUSINGDLL
#pragma comment(lib, "wsock32")
#endif
#pragma comment(lib, wxBASE_LIB_NAME("net"))
#endif
#if wxUSE_XML && !defined(wxNO_XML_LIB)
#pragma comment(lib, wxBASE_LIB_NAME("xml"))
#endif
#if wxUSE_REGEX && !defined(wxNO_REGEX_LIB) && !defined(WXUSINGDLL)
#pragma comment(lib, wx3RD_PARTY_LIB_NAME_U("regex"))
#endif
#if wxUSE_GUI
#if wxUSE_XML && !defined(wxNO_EXPAT_LIB) && !defined(WXUSINGDLL)
#pragma comment(lib, wx3RD_PARTY_LIB_NAME("expat"))
#endif
#if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) && !defined(WXUSINGDLL)
#pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg"))
#endif
#if wxUSE_LIBPNG && !defined(wxNO_PNG_LIB) && !defined(WXUSINGDLL)
#pragma comment(lib, wx3RD_PARTY_LIB_NAME("png"))
#endif
#if wxUSE_LIBTIFF && !defined(wxNO_TIFF_LIB) && !defined(WXUSINGDLL)
#pragma comment(lib, wx3RD_PARTY_LIB_NAME("tiff"))
#endif
#if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB) && !defined(WXUSINGDLL)
#pragma comment(lib, wx3RD_PARTY_LIB_NAME("zlib"))
#endif
#pragma comment(lib, wxTOOLKIT_LIB_NAME("core"))
#ifndef wxNO_ADV_LIB
#pragma comment(lib, wxTOOLKIT_LIB_NAME("adv"))
#endif
#if wxUSE_HTML && !defined(wxNO_HTML_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("html"))
#endif
#if wxUSE_GLCANVAS && !defined(wxNO_GL_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("gl"))
#endif
#if wxUSE_DEBUGREPORT && !defined(wxNO_QA_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("qa"))
#endif
#if wxUSE_XRC && !defined(wxNO_XRC_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("xrc"))
#endif
#if wxUSE_AUI && !defined(wxNO_AUI_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("aui"))
#endif
#if wxUSE_PROPGRID && !defined(wxNO_PROPGRID_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("propgrid"))
#endif
#if wxUSE_RIBBON && !defined(wxNO_RIBBON_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("ribbon"))
#endif
#if wxUSE_RICHTEXT && !defined(wxNO_RICHTEXT_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("richtext"))
#endif
#if wxUSE_MEDIACTRL && !defined(wxNO_MEDIA_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("media"))
#endif
#if wxUSE_STC && !defined(wxNO_STC_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("stc"))
#ifndef WXUSINGDLL
#pragma comment(lib, wx3RD_PARTY_LIB_NAME("scintilla"))
#endif
#endif
#if wxUSE_WEBVIEW && !defined(wxNO_WEBVIEW_LIB)
#pragma comment(lib, wxTOOLKIT_LIB_NAME("webview"))
#endif
#endif // wxUSE_GUI
#ifndef WXUSINGDLL
// Make sure all required system libraries are added to the linker too when
// using static libraries.
#pragma comment(lib, "kernel32")
#pragma comment(lib, "user32")
#pragma comment(lib, "gdi32")
#pragma comment(lib, "comdlg32")
#pragma comment(lib, "winspool")
#pragma comment(lib, "winmm")
#pragma comment(lib, "shell32")
#pragma comment(lib, "comctl32")
#pragma comment(lib, "ole32")
#pragma comment(lib, "oleaut32")
#pragma comment(lib, "uuid")
#pragma comment(lib, "rpcrt4")
#pragma comment(lib, "advapi32")
#if wxUSE_URL_NATIVE
#pragma comment(lib, "wininet")
#endif
#ifdef __WXGTK__
#pragma comment(lib, "gtk-win32-2.0.lib")
#pragma comment(lib, "gdk-win32-2.0.lib")
#pragma comment(lib, "pangocairo-1.0.lib")
#pragma comment(lib, "gdk_pixbuf-2.0.lib")
#pragma comment(lib, "cairo.lib")
#pragma comment(lib, "pango-1.0.lib")
#pragma comment(lib, "gobject-2.0.lib")
#pragma comment(lib, "gthread-2.0.lib")
#pragma comment(lib, "glib-2.0.lib")
#endif
#endif // !WXUSINGDLL

View File

@ -0,0 +1,169 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/aboutdlg.h
// Purpose: declaration of wxAboutDialog class
// Author: Vadim Zeitlin
// Created: 2006-10-07
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ABOUTDLG_H_
#define _WX_ABOUTDLG_H_
#include "wx/defs.h"
#if wxUSE_ABOUTDLG
#include "wx/app.h"
#include "wx/icon.h"
// ----------------------------------------------------------------------------
// wxAboutDialogInfo: information shown by the standard "About" dialog
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxAboutDialogInfo
{
public:
// all fields are initially uninitialized
wxAboutDialogInfo() { }
// accessors for various simply fields
// -----------------------------------
// name of the program, if not used defaults to wxApp::GetAppDisplayName()
void SetName(const wxString& name) { m_name = name; }
wxString GetName() const
{ return m_name.empty() ? wxTheApp->GetAppDisplayName() : m_name; }
// version should contain program version without "version" word (e.g.,
// "1.2" or "RC2") while longVersion may contain the full version including
// "version" word (e.g., "Version 1.2" or "Release Candidate 2")
//
// if longVersion is empty, it is automatically constructed from version
//
// generic and gtk native: use short version only, as a suffix to the
// program name msw and osx native: use long version
void SetVersion(const wxString& version,
const wxString& longVersion = wxString());
bool HasVersion() const { return !m_version.empty(); }
const wxString& GetVersion() const { return m_version; }
const wxString& GetLongVersion() const { return m_longVersion; }
// brief, but possibly multiline, description of the program
void SetDescription(const wxString& desc) { m_description = desc; }
bool HasDescription() const { return !m_description.empty(); }
const wxString& GetDescription() const { return m_description; }
// short string containing the program copyright information
void SetCopyright(const wxString& copyright) { m_copyright = copyright; }
bool HasCopyright() const { return !m_copyright.empty(); }
const wxString& GetCopyright() const { return m_copyright; }
// long, multiline string containing the text of the program licence
void SetLicence(const wxString& licence) { m_licence = licence; }
void SetLicense(const wxString& licence) { m_licence = licence; }
bool HasLicence() const { return !m_licence.empty(); }
const wxString& GetLicence() const { return m_licence; }
// icon to be shown in the dialog, defaults to the main frame icon
void SetIcon(const wxIcon& icon) { m_icon = icon; }
bool HasIcon() const { return m_icon.IsOk(); }
wxIcon GetIcon() const;
// web site for the program and its description (defaults to URL itself if
// empty)
void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString)
{
m_url = url;
m_urlDesc = desc.empty() ? url : desc;
}
bool HasWebSite() const { return !m_url.empty(); }
const wxString& GetWebSiteURL() const { return m_url; }
const wxString& GetWebSiteDescription() const { return m_urlDesc; }
// accessors for the arrays
// ------------------------
// the list of developers of the program
void SetDevelopers(const wxArrayString& developers)
{ m_developers = developers; }
void AddDeveloper(const wxString& developer)
{ m_developers.push_back(developer); }
bool HasDevelopers() const { return !m_developers.empty(); }
const wxArrayString& GetDevelopers() const { return m_developers; }
// the list of documentation writers
void SetDocWriters(const wxArrayString& docwriters)
{ m_docwriters = docwriters; }
void AddDocWriter(const wxString& docwriter)
{ m_docwriters.push_back(docwriter); }
bool HasDocWriters() const { return !m_docwriters.empty(); }
const wxArrayString& GetDocWriters() const { return m_docwriters; }
// the list of artists for the program art
void SetArtists(const wxArrayString& artists)
{ m_artists = artists; }
void AddArtist(const wxString& artist)
{ m_artists.push_back(artist); }
bool HasArtists() const { return !m_artists.empty(); }
const wxArrayString& GetArtists() const { return m_artists; }
// the list of translators
void SetTranslators(const wxArrayString& translators)
{ m_translators = translators; }
void AddTranslator(const wxString& translator)
{ m_translators.push_back(translator); }
bool HasTranslators() const { return !m_translators.empty(); }
const wxArrayString& GetTranslators() const { return m_translators; }
// implementation only
// -------------------
// "simple" about dialog shows only textual information (with possibly
// default icon but without hyperlink nor any long texts such as the
// licence text)
bool IsSimple() const
{ return !HasWebSite() && !HasIcon() && !HasLicence(); }
// get the description and credits (i.e. all of developers, doc writers,
// artists and translators) as a one long multiline string
wxString GetDescriptionAndCredits() const;
// returns the copyright with the (C) string substituted by the Unicode
// character U+00A9
wxString GetCopyrightToDisplay() const;
private:
wxString m_name,
m_version,
m_longVersion,
m_description,
m_copyright,
m_licence;
wxIcon m_icon;
wxString m_url,
m_urlDesc;
wxArrayString m_developers,
m_docwriters,
m_artists,
m_translators;
};
// functions to show the about dialog box
WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
#endif // wxUSE_ABOUTDLG
#endif // _WX_ABOUTDLG_H_

View File

@ -4,7 +4,6 @@
// Author: Julian Smart, Robert Roebling, Vadim Zeitlin
// Modified by:
// Created: 31.05.01 (extracted from other files)
// RCS-ID: $Id: accel.h 66927 2011-02-16 23:27:30Z JS $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -27,24 +26,25 @@ class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
// ----------------------------------------------------------------------------
// wxAcceleratorEntry flags
enum
enum wxAcceleratorEntryFlags
{
wxACCEL_NORMAL = 0x0000, // no modifiers
wxACCEL_ALT = 0x0001, // hold Alt key down
wxACCEL_CTRL = 0x0002, // hold Ctrl key down
wxACCEL_SHIFT = 0x0004, // hold Shift key down
#if defined(__WXMAC__) || defined(__WXCOCOA__)
wxACCEL_CMD = 0x0008 // Command key on OS X
wxACCEL_RAW_CTRL= 0x0008, //
#else
wxACCEL_CMD = wxACCEL_CTRL
wxACCEL_RAW_CTRL= wxACCEL_CTRL,
#endif
wxACCEL_CMD = wxACCEL_CTRL
};
// ----------------------------------------------------------------------------
// an entry in wxAcceleratorTable corresponds to one accelerator
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxAcceleratorEntry
class WXDLLIMPEXP_CORE wxAcceleratorEntry
{
public:
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0,
@ -68,7 +68,8 @@ public:
wxAcceleratorEntry& operator=(const wxAcceleratorEntry& entry)
{
Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item);
if (&entry != this)
Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item);
return *this;
}
@ -106,7 +107,7 @@ public:
bool IsOk() const
{
return m_keyCode != 0;
return m_keyCode != 0;
}
@ -115,8 +116,13 @@ public:
// returns a wxString for the this accelerator.
// this function formats it using the <flags>-<keycode> format
// where <flags> maybe a hyphen-separed list of "shift|alt|ctrl"
wxString ToString() const;
// where <flags> maybe a hyphen-separated list of "shift|alt|ctrl"
wxString ToString() const { return AsPossiblyLocalizedString(true); }
// same as above but without translating, useful if the string is meant to
// be stored in a file or otherwise stored, instead of being shown to the
// user
wxString ToRawString() const { return AsPossiblyLocalizedString(false); }
// returns true if the given string correctly initialized this object
// (i.e. if IsOk() returns true after this call)
@ -124,6 +130,8 @@ public:
private:
wxString AsPossiblyLocalizedString(bool localized) const;
// common part of Create() and FromString()
static bool ParseAccel(const wxString& str, int *flags, int *keycode);
@ -155,14 +163,14 @@ private:
#elif defined(__WXGTK__)
#include "wx/gtk1/accel.h"
#elif defined(__WXMAC__)
#include "wx/mac/accel.h"
#include "wx/osx/accel.h"
#elif defined(__WXCOCOA__)
#include "wx/generic/accel.h"
#elif defined(__WXPM__)
#include "wx/os2/accel.h"
#endif
extern WXDLLEXPORT_DATA(wxAcceleratorTable) wxNullAcceleratorTable;
extern WXDLLIMPEXP_DATA_CORE(wxAcceleratorTable) wxNullAcceleratorTable;
#endif // wxUSE_ACCEL

View File

@ -0,0 +1,376 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/access.h
// Purpose: Accessibility classes
// Author: Julian Smart
// Modified by:
// Created: 2003-02-12
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ACCESSBASE_H_
#define _WX_ACCESSBASE_H_
// ----------------------------------------------------------------------------
// headers we have to include here
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_ACCESSIBILITY
#include "wx/variant.h"
typedef enum
{
wxACC_FAIL,
wxACC_FALSE,
wxACC_OK,
wxACC_NOT_IMPLEMENTED,
wxACC_NOT_SUPPORTED
} wxAccStatus;
// Child ids are integer identifiers from 1 up.
// So zero represents 'this' object.
#define wxACC_SELF 0
// Navigation constants
typedef enum
{
wxNAVDIR_DOWN,
wxNAVDIR_FIRSTCHILD,
wxNAVDIR_LASTCHILD,
wxNAVDIR_LEFT,
wxNAVDIR_NEXT,
wxNAVDIR_PREVIOUS,
wxNAVDIR_RIGHT,
wxNAVDIR_UP
} wxNavDir;
// Role constants
typedef enum {
wxROLE_NONE,
wxROLE_SYSTEM_ALERT,
wxROLE_SYSTEM_ANIMATION,
wxROLE_SYSTEM_APPLICATION,
wxROLE_SYSTEM_BORDER,
wxROLE_SYSTEM_BUTTONDROPDOWN,
wxROLE_SYSTEM_BUTTONDROPDOWNGRID,
wxROLE_SYSTEM_BUTTONMENU,
wxROLE_SYSTEM_CARET,
wxROLE_SYSTEM_CELL,
wxROLE_SYSTEM_CHARACTER,
wxROLE_SYSTEM_CHART,
wxROLE_SYSTEM_CHECKBUTTON,
wxROLE_SYSTEM_CLIENT,
wxROLE_SYSTEM_CLOCK,
wxROLE_SYSTEM_COLUMN,
wxROLE_SYSTEM_COLUMNHEADER,
wxROLE_SYSTEM_COMBOBOX,
wxROLE_SYSTEM_CURSOR,
wxROLE_SYSTEM_DIAGRAM,
wxROLE_SYSTEM_DIAL,
wxROLE_SYSTEM_DIALOG,
wxROLE_SYSTEM_DOCUMENT,
wxROLE_SYSTEM_DROPLIST,
wxROLE_SYSTEM_EQUATION,
wxROLE_SYSTEM_GRAPHIC,
wxROLE_SYSTEM_GRIP,
wxROLE_SYSTEM_GROUPING,
wxROLE_SYSTEM_HELPBALLOON,
wxROLE_SYSTEM_HOTKEYFIELD,
wxROLE_SYSTEM_INDICATOR,
wxROLE_SYSTEM_LINK,
wxROLE_SYSTEM_LIST,
wxROLE_SYSTEM_LISTITEM,
wxROLE_SYSTEM_MENUBAR,
wxROLE_SYSTEM_MENUITEM,
wxROLE_SYSTEM_MENUPOPUP,
wxROLE_SYSTEM_OUTLINE,
wxROLE_SYSTEM_OUTLINEITEM,
wxROLE_SYSTEM_PAGETAB,
wxROLE_SYSTEM_PAGETABLIST,
wxROLE_SYSTEM_PANE,
wxROLE_SYSTEM_PROGRESSBAR,
wxROLE_SYSTEM_PROPERTYPAGE,
wxROLE_SYSTEM_PUSHBUTTON,
wxROLE_SYSTEM_RADIOBUTTON,
wxROLE_SYSTEM_ROW,
wxROLE_SYSTEM_ROWHEADER,
wxROLE_SYSTEM_SCROLLBAR,
wxROLE_SYSTEM_SEPARATOR,
wxROLE_SYSTEM_SLIDER,
wxROLE_SYSTEM_SOUND,
wxROLE_SYSTEM_SPINBUTTON,
wxROLE_SYSTEM_STATICTEXT,
wxROLE_SYSTEM_STATUSBAR,
wxROLE_SYSTEM_TABLE,
wxROLE_SYSTEM_TEXT,
wxROLE_SYSTEM_TITLEBAR,
wxROLE_SYSTEM_TOOLBAR,
wxROLE_SYSTEM_TOOLTIP,
wxROLE_SYSTEM_WHITESPACE,
wxROLE_SYSTEM_WINDOW
} wxAccRole;
// Object types
typedef enum {
wxOBJID_WINDOW = 0x00000000,
wxOBJID_SYSMENU = 0xFFFFFFFF,
wxOBJID_TITLEBAR = 0xFFFFFFFE,
wxOBJID_MENU = 0xFFFFFFFD,
wxOBJID_CLIENT = 0xFFFFFFFC,
wxOBJID_VSCROLL = 0xFFFFFFFB,
wxOBJID_HSCROLL = 0xFFFFFFFA,
wxOBJID_SIZEGRIP = 0xFFFFFFF9,
wxOBJID_CARET = 0xFFFFFFF8,
wxOBJID_CURSOR = 0xFFFFFFF7,
wxOBJID_ALERT = 0xFFFFFFF6,
wxOBJID_SOUND = 0xFFFFFFF5
} wxAccObject;
// Accessible states
#define wxACC_STATE_SYSTEM_ALERT_HIGH 0x00000001
#define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002
#define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004
#define wxACC_STATE_SYSTEM_ANIMATED 0x00000008
#define wxACC_STATE_SYSTEM_BUSY 0x00000010
#define wxACC_STATE_SYSTEM_CHECKED 0x00000020
#define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040
#define wxACC_STATE_SYSTEM_DEFAULT 0x00000080
#define wxACC_STATE_SYSTEM_EXPANDED 0x00000100
#define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200
#define wxACC_STATE_SYSTEM_FLOATING 0x00000400
#define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800
#define wxACC_STATE_SYSTEM_FOCUSED 0x00001000
#define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000
#define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000
#define wxACC_STATE_SYSTEM_MARQUEED 0x00008000
#define wxACC_STATE_SYSTEM_MIXED 0x00010000
#define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000
#define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000
#define wxACC_STATE_SYSTEM_PRESSED 0x00080000
#define wxACC_STATE_SYSTEM_PROTECTED 0x00100000
#define wxACC_STATE_SYSTEM_READONLY 0x00200000
#define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000
#define wxACC_STATE_SYSTEM_SELECTED 0x00800000
#define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000
#define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000
// Selection flag
typedef enum
{
wxACC_SEL_NONE = 0,
wxACC_SEL_TAKEFOCUS = 1,
wxACC_SEL_TAKESELECTION = 2,
wxACC_SEL_EXTENDSELECTION = 4,
wxACC_SEL_ADDSELECTION = 8,
wxACC_SEL_REMOVESELECTION = 16
} wxAccSelectionFlags;
// Accessibility event identifiers
#define wxACC_EVENT_SYSTEM_SOUND 0x0001
#define wxACC_EVENT_SYSTEM_ALERT 0x0002
#define wxACC_EVENT_SYSTEM_FOREGROUND 0x0003
#define wxACC_EVENT_SYSTEM_MENUSTART 0x0004
#define wxACC_EVENT_SYSTEM_MENUEND 0x0005
#define wxACC_EVENT_SYSTEM_MENUPOPUPSTART 0x0006
#define wxACC_EVENT_SYSTEM_MENUPOPUPEND 0x0007
#define wxACC_EVENT_SYSTEM_CAPTURESTART 0x0008
#define wxACC_EVENT_SYSTEM_CAPTUREEND 0x0009
#define wxACC_EVENT_SYSTEM_MOVESIZESTART 0x000A
#define wxACC_EVENT_SYSTEM_MOVESIZEEND 0x000B
#define wxACC_EVENT_SYSTEM_CONTEXTHELPSTART 0x000C
#define wxACC_EVENT_SYSTEM_CONTEXTHELPEND 0x000D
#define wxACC_EVENT_SYSTEM_DRAGDROPSTART 0x000E
#define wxACC_EVENT_SYSTEM_DRAGDROPEND 0x000F
#define wxACC_EVENT_SYSTEM_DIALOGSTART 0x0010
#define wxACC_EVENT_SYSTEM_DIALOGEND 0x0011
#define wxACC_EVENT_SYSTEM_SCROLLINGSTART 0x0012
#define wxACC_EVENT_SYSTEM_SCROLLINGEND 0x0013
#define wxACC_EVENT_SYSTEM_SWITCHSTART 0x0014
#define wxACC_EVENT_SYSTEM_SWITCHEND 0x0015
#define wxACC_EVENT_SYSTEM_MINIMIZESTART 0x0016
#define wxACC_EVENT_SYSTEM_MINIMIZEEND 0x0017
#define wxACC_EVENT_OBJECT_CREATE 0x8000
#define wxACC_EVENT_OBJECT_DESTROY 0x8001
#define wxACC_EVENT_OBJECT_SHOW 0x8002
#define wxACC_EVENT_OBJECT_HIDE 0x8003
#define wxACC_EVENT_OBJECT_REORDER 0x8004
#define wxACC_EVENT_OBJECT_FOCUS 0x8005
#define wxACC_EVENT_OBJECT_SELECTION 0x8006
#define wxACC_EVENT_OBJECT_SELECTIONADD 0x8007
#define wxACC_EVENT_OBJECT_SELECTIONREMOVE 0x8008
#define wxACC_EVENT_OBJECT_SELECTIONWITHIN 0x8009
#define wxACC_EVENT_OBJECT_STATECHANGE 0x800A
#define wxACC_EVENT_OBJECT_LOCATIONCHANGE 0x800B
#define wxACC_EVENT_OBJECT_NAMECHANGE 0x800C
#define wxACC_EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D
#define wxACC_EVENT_OBJECT_VALUECHANGE 0x800E
#define wxACC_EVENT_OBJECT_PARENTCHANGE 0x800F
#define wxACC_EVENT_OBJECT_HELPCHANGE 0x8010
#define wxACC_EVENT_OBJECT_DEFACTIONCHANGE 0x8011
#define wxACC_EVENT_OBJECT_ACCELERATORCHANGE 0x8012
// ----------------------------------------------------------------------------
// wxAccessible
// All functions return an indication of success, failure, or not implemented.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxAccessible;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxPoint;
class WXDLLIMPEXP_FWD_CORE wxRect;
class WXDLLIMPEXP_CORE wxAccessibleBase : public wxObject
{
wxDECLARE_NO_COPY_CLASS(wxAccessibleBase);
public:
wxAccessibleBase(wxWindow* win): m_window(win) {}
virtual ~wxAccessibleBase() {}
// Overridables
// Can return either a child object, or an integer
// representing the child element, starting from 1.
// pt is in screen coordinates.
virtual wxAccStatus HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId))
{ return wxACC_NOT_IMPLEMENTED; }
// Navigates from fromId to toId/toObject.
virtual wxAccStatus Navigate(wxNavDir WXUNUSED(navDir), int WXUNUSED(fromId),
int* WXUNUSED(toId), wxAccessible** WXUNUSED(toObject))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the name of the specified object.
virtual wxAccStatus GetName(int WXUNUSED(childId), wxString* WXUNUSED(name))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the number of children.
virtual wxAccStatus GetChildCount(int* WXUNUSED(childCount))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the specified child (starting from 1).
// If *child is NULL and return value is wxACC_OK,
// this means that the child is a simple element and
// not an accessible object.
virtual wxAccStatus GetChild(int WXUNUSED(childId), wxAccessible** WXUNUSED(child))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the parent, or NULL.
virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent))
{ return wxACC_NOT_IMPLEMENTED; }
// Performs the default action. childId is 0 (the action for this object)
// or > 0 (the action for a child).
// Return wxACC_NOT_SUPPORTED if there is no default action for this
// window (e.g. an edit control).
virtual wxAccStatus DoDefaultAction(int WXUNUSED(childId))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the default action for this object (0) or > 0 (the action for a child).
// Return wxACC_OK even if there is no action. actionName is the action, or the empty
// string if there is no action.
// The retrieved string describes the action that is performed on an object,
// not what the object does as a result. For example, a toolbar button that prints
// a document has a default action of "Press" rather than "Prints the current document."
virtual wxAccStatus GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the description for this object or a child.
virtual wxAccStatus GetDescription(int WXUNUSED(childId), wxString* WXUNUSED(description))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns help text for this object or a child, similar to tooltip text.
virtual wxAccStatus GetHelpText(int WXUNUSED(childId), wxString* WXUNUSED(helpText))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the keyboard shortcut for this object or child.
// Return e.g. ALT+K
virtual wxAccStatus GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a role constant.
virtual wxAccStatus GetRole(int WXUNUSED(childId), wxAccRole* WXUNUSED(role))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a state constant.
virtual wxAccStatus GetState(int WXUNUSED(childId), long* WXUNUSED(state))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a localized string representing the value for the object
// or child.
virtual wxAccStatus GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue))
{ return wxACC_NOT_IMPLEMENTED; }
// Selects the object or child.
virtual wxAccStatus Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the window with the keyboard focus.
// If childId is 0 and child is NULL, no object in
// this subhierarchy has the focus.
// If this object has the focus, child should be 'this'.
virtual wxAccStatus GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child))
{ return wxACC_NOT_IMPLEMENTED; }
#if wxUSE_VARIANT
// Gets a variant representing the selected children
// of this object.
// Acceptable values:
// - a null variant (IsNull() returns TRUE)
// - a list variant (GetType() == wxT("list"))
// - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long"))
// - a "void*" pointer to a wxAccessible child object
virtual wxAccStatus GetSelections(wxVariant* WXUNUSED(selections))
{ return wxACC_NOT_IMPLEMENTED; }
#endif // wxUSE_VARIANT
// Accessors
// Returns the window associated with this object.
wxWindow* GetWindow() { return m_window; }
// Sets the window associated with this object.
void SetWindow(wxWindow* window) { m_window = window; }
// Operations
// Each platform's implementation must define this
// static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType,
// int objectId);
private:
// Data members
wxWindow* m_window;
};
// ----------------------------------------------------------------------------
// now include the declaration of the real class
// ----------------------------------------------------------------------------
#if defined(__WXMSW__)
#include "wx/msw/ole/access.h"
#endif
#endif // wxUSE_ACCESSIBILITY
#endif // _WX_ACCESSBASE_H_

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/affinematrix2d.h
// Purpose: wxAffineMatrix2D class.
// Author: Based on wxTransformMatrix by Chris Breeze, Julian Smart
// Created: 2011-04-05
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AFFINEMATRIX2D_H_
#define _WX_AFFINEMATRIX2D_H_
#include "wx/defs.h"
#if wxUSE_GEOMETRY
#include "wx/affinematrix2dbase.h"
// A simple implementation of wxAffineMatrix2DBase interface done entirely in
// wxWidgets.
class WXDLLIMPEXP_CORE wxAffineMatrix2D : public wxAffineMatrix2DBase
{
public:
wxAffineMatrix2D() : m_11(1), m_12(0),
m_21(0), m_22(1),
m_tx(0), m_ty(0)
{
}
// Implement base class pure virtual methods.
virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr);
virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const;
virtual void Concat(const wxAffineMatrix2DBase& t);
virtual bool Invert();
virtual bool IsIdentity() const;
virtual bool IsEqual(const wxAffineMatrix2DBase& t) const;
virtual void Translate(wxDouble dx, wxDouble dy);
virtual void Scale(wxDouble xScale, wxDouble yScale);
virtual void Rotate(wxDouble cRadians);
protected:
virtual wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const;
virtual wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const;
private:
wxDouble m_11, m_12, m_21, m_22, m_tx, m_ty;
};
#endif // wxUSE_GEOMETRY
#endif // _WX_AFFINEMATRIX2D_H_

View File

@ -0,0 +1,127 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/affinematrix2dbase.h
// Purpose: Common interface for 2D transformation matrices.
// Author: Catalin Raceanu
// Created: 2011-04-06
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AFFINEMATRIX2DBASE_H_
#define _WX_AFFINEMATRIX2DBASE_H_
#include "wx/defs.h"
#if wxUSE_GEOMETRY
#include "wx/geometry.h"
struct wxMatrix2D
{
wxMatrix2D(wxDouble v11 = 1,
wxDouble v12 = 0,
wxDouble v21 = 0,
wxDouble v22 = 1)
{
m_11 = v11; m_12 = v12;
m_21 = v21; m_22 = v22;
}
wxDouble m_11, m_12, m_21, m_22;
};
// A 2x3 matrix representing an affine 2D transformation.
//
// This is an abstract base class implemented by wxAffineMatrix2D only so far,
// but in the future we also plan to derive wxGraphicsMatrix from it (it should
// also be documented then as currently only wxAffineMatrix2D itself is).
class WXDLLIMPEXP_CORE wxAffineMatrix2DBase
{
public:
wxAffineMatrix2DBase() {}
virtual ~wxAffineMatrix2DBase() {}
// sets the matrix to the respective values
virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr) = 0;
// gets the component valuess of the matrix
virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const = 0;
// concatenates the matrix
virtual void Concat(const wxAffineMatrix2DBase& t) = 0;
// makes this the inverse matrix
virtual bool Invert() = 0;
// return true if this is the identity matrix
virtual bool IsIdentity() const = 0;
// returns true if the elements of the transformation matrix are equal ?
virtual bool IsEqual(const wxAffineMatrix2DBase& t) const = 0;
bool operator==(const wxAffineMatrix2DBase& t) const { return IsEqual(t); }
bool operator!=(const wxAffineMatrix2DBase& t) const { return !IsEqual(t); }
//
// transformations
//
// add the translation to this matrix
virtual void Translate(wxDouble dx, wxDouble dy) = 0;
// add the scale to this matrix
virtual void Scale(wxDouble xScale, wxDouble yScale) = 0;
// add the rotation to this matrix (counter clockwise, radians)
virtual void Rotate(wxDouble ccRadians) = 0;
// add mirroring to this matrix
void Mirror(int direction = wxHORIZONTAL)
{
wxDouble x = (direction & wxHORIZONTAL) ? -1 : 1;
wxDouble y = (direction & wxVERTICAL) ? -1 : 1;
Scale(x, y);
}
// applies that matrix to the point
wxPoint2DDouble TransformPoint(const wxPoint2DDouble& src) const
{
return DoTransformPoint(src);
}
void TransformPoint(wxDouble* x, wxDouble* y) const
{
wxCHECK_RET( x && y, "Can't be NULL" );
const wxPoint2DDouble dst = DoTransformPoint(wxPoint2DDouble(*x, *y));
*x = dst.m_x;
*y = dst.m_y;
}
// applies the matrix except for translations
wxPoint2DDouble TransformDistance(const wxPoint2DDouble& src) const
{
return DoTransformDistance(src);
}
void TransformDistance(wxDouble* dx, wxDouble* dy) const
{
wxCHECK_RET( dx && dy, "Can't be NULL" );
const wxPoint2DDouble
dst = DoTransformDistance(wxPoint2DDouble(*dx, *dy));
*dx = dst.m_x;
*dy = dst.m_y;
}
protected:
virtual
wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const = 0;
virtual
wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const = 0;
};
#endif // wxUSE_GEOMETRY
#endif // _WX_AFFINEMATRIX2DBASE_H_

View File

@ -1,10 +1,9 @@
///////////////////////////////////////////////////////////////////////////////
// Name: include/wx/afterstd.h
// Name: wx/afterstd.h
// Purpose: #include after STL headers
// Author: Vadim Zeitlin
// Modified by:
// Created: 07/07/03
// RCS-ID: $Id: afterstd.h 61871 2009-09-09 22:29:51Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -13,7 +12,7 @@
See the comments in beforestd.h.
*/
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
#include "wx/msw/winundef.h"
#endif
@ -21,13 +20,6 @@
#if defined(__VISUALC__) && __VISUALC__ <= 1201
// MSVC 5 does not have this
#if _MSC_VER > 1100
// don't restore this one for VC6, it gives it in each try/catch which is a
// bit annoying to say the least
#if _MSC_VER >= 0x1300
// unreachable code
#pragma warning(default:4702)
#endif // VC++ >= 7
#pragma warning(pop)
#else
// 'expression' : signed/unsigned mismatch
@ -46,26 +38,7 @@
#endif
#endif
/*
Redefine _T if we undefined it in wx/beforestd.h (see comment there about
why do we do it) and if we need it (we always do when building wx itself
and might also need when compiling the user code but this must be indicated
by the special wxNEEDS__T macro)
*/
#if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
#if defined(WXBUILDING) || defined(wxNEEDS_T)
/*
Undefine _T in case it was defined in the standard header.
*/
#undef _T
/*
And define it again in the same way as it's done in wx/wxchar.h.
*/
#if wxUSE_UNICODE
#define _T(x) wxCONCAT_HELPER(L, x)
#else /* !Unicode */
#define _T(x) x
#endif /* Unicode/!Unicode */
#endif /* we need _T() to be defined */
#endif /* defined(__SUNPRO_CC) || defined(__SUNPRO_C) */
// see beforestd.h for explanation
#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY)
#pragma GCC visibility pop
#endif

View File

@ -2,7 +2,6 @@
// Name: wx/anidecod.h
// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation
// Author: Francesco Montorsi
// CVS-ID: $Id: anidecod.h 45563 2007-04-21 18:17:50Z VZ $
// Copyright: (c) 2006 Francesco Montorsi
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -12,7 +11,7 @@
#include "wx/defs.h"
#if wxUSE_STREAMS && wxUSE_ICO_CUR
#if wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF)
#include "wx/stream.h"
#include "wx/image.h"
@ -20,7 +19,7 @@
#include "wx/dynarray.h"
class /*WXDLLEXPORT*/ wxANIFrameInfo;
class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail
WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray);
WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray);
@ -29,7 +28,7 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray);
// wxANIDecoder class
// --------------------------------------------------------------------------
class WXDLLEXPORT wxANIDecoder : public wxAnimationDecoder
class WXDLLIMPEXP_CORE wxANIDecoder : public wxAnimationDecoder
{
public:
// constructor, destructor, etc.
@ -44,7 +43,7 @@ public:
virtual wxColour GetTransparentColour(unsigned int frame) const;
// implementation of wxAnimationDecoder's pure virtuals
virtual bool CanRead( wxInputStream& stream ) const;
virtual bool Load( wxInputStream& stream );
bool ConvertToImage(unsigned int frame, wxImage *image) const;
@ -55,6 +54,10 @@ public:
{ return wxANIMATION_TYPE_ANI; }
private:
// wxAnimationDecoder pure virtual:
virtual bool DoCanRead( wxInputStream& stream ) const;
// modifies current stream position (see wxAnimationDecoder::CanRead)
// frames stored as wxImage(s): ANI files are meant to be used mostly for animated
// cursors and thus they do not use any optimization to encode differences between
// two frames: they are just a list of images to display sequentially.
@ -68,10 +71,10 @@ private:
static wxCURHandler sm_handler;
DECLARE_NO_COPY_CLASS(wxANIDecoder)
wxDECLARE_NO_COPY_CLASS(wxANIDecoder);
};
#endif // wxUSE_STREAM && wxUSE_ICO_CUR
#endif // wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF)
#endif // _WX_ANIDECOD_H

View File

@ -0,0 +1,125 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/animate.h
// Purpose: wxAnimation and wxAnimationCtrl
// Author: Julian Smart and Guillermo Rodriguez Garcia
// Modified by: Francesco Montorsi
// Created: 13/8/99
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ANIMATE_H_
#define _WX_ANIMATE_H_
#include "wx/defs.h"
#if wxUSE_ANIMATIONCTRL
#include "wx/animdecod.h"
#include "wx/control.h"
#include "wx/timer.h"
#include "wx/bitmap.h"
class WXDLLIMPEXP_FWD_ADV wxAnimation;
extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation;
extern WXDLLIMPEXP_DATA_ADV(const char) wxAnimationCtrlNameStr[];
// ----------------------------------------------------------------------------
// wxAnimationBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxAnimationBase : public wxObject
{
public:
wxAnimationBase() {}
virtual bool IsOk() const = 0;
// can be -1
virtual int GetDelay(unsigned int frame) const = 0;
virtual unsigned int GetFrameCount() const = 0;
virtual wxImage GetFrame(unsigned int frame) const = 0;
virtual wxSize GetSize() const = 0;
virtual bool LoadFile(const wxString& name,
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
virtual bool Load(wxInputStream& stream,
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
protected:
DECLARE_ABSTRACT_CLASS(wxAnimationBase)
};
// ----------------------------------------------------------------------------
// wxAnimationCtrlBase
// ----------------------------------------------------------------------------
// do not autoresize to the animation's size when SetAnimation() is called
#define wxAC_NO_AUTORESIZE (0x0010)
// default style does not include wxAC_NO_AUTORESIZE, that is, the control
// auto-resizes by default to fit the new animation when SetAnimation() is called
#define wxAC_DEFAULT_STYLE (wxBORDER_NONE)
class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl
{
public:
wxAnimationCtrlBase() { }
// public API
virtual bool LoadFile(const wxString& filename,
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
virtual bool Load(wxInputStream& stream,
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
virtual void SetAnimation(const wxAnimation &anim) = 0;
virtual wxAnimation GetAnimation() const = 0;
virtual bool Play() = 0;
virtual void Stop() = 0;
virtual bool IsPlaying() const = 0;
virtual void SetInactiveBitmap(const wxBitmap &bmp);
// always return the original bitmap set in this control
wxBitmap GetInactiveBitmap() const
{ return m_bmpStatic; }
protected:
// the inactive bitmap as it was set by the user
wxBitmap m_bmpStatic;
// the inactive bitmap currently shown in the control
// (may differ in the size from m_bmpStatic)
wxBitmap m_bmpStaticReal;
// updates m_bmpStaticReal from m_bmpStatic if needed
virtual void UpdateStaticImage();
// called by SetInactiveBitmap
virtual void DisplayStaticImage() = 0;
private:
DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase)
};
// ----------------------------------------------------------------------------
// include the platform-specific version of the wxAnimationCtrl class
// ----------------------------------------------------------------------------
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/animate.h"
#else
#include "wx/generic/animate.h"
#endif
#endif // wxUSE_ANIMATIONCTRL
#endif // _WX_ANIMATE_H_

View File

@ -2,7 +2,6 @@
// Name: wx/animdecod.h
// Purpose: wxAnimationDecoder
// Author: Francesco Montorsi
// CVS-ID: $Id: animdecod.h 49563 2007-10-31 20:46:21Z VZ $
// Copyright: (c) 2006 Francesco Montorsi
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -16,8 +15,9 @@
#include "wx/colour.h"
#include "wx/gdicmn.h"
#include "wx/log.h"
#include "wx/stream.h"
class WXDLLIMPEXP_FWD_BASE wxInputStream;
class WXDLLIMPEXP_FWD_CORE wxImage;
/*
@ -30,15 +30,15 @@ class WXDLLIMPEXP_FWD_CORE wxImage;
wxAnimationDecoders always load an input stream using some optimized format
to store it which is format-depedent. This allows to store a (possibly big)
animation using a format which is a good compromise between required memory
and time required to blit in on the screen.
and time required to blit it on the screen.
2) wxAnimationDecoders contain the animation data in some internal var.
2) wxAnimationDecoders contain the animation data in some internal variable.
That's why they derive from wxObjectRefData: they are data which can be shared.
3) wxAnimationDecoders can be used by a wxImageHandler to retrieve a frame
in wxImage format; the viceversa cannot be done.
4) wxAnimationDecoders are decoders only, thus do not support save features.
4) wxAnimationDecoders are decoders only, thus they do not support save features.
5) wxAnimationDecoders are directly used by wxAnimation (generic implementation)
as wxObjectRefData while they need to be 'wrapped' by a wxImageHandler for
@ -61,11 +61,11 @@ enum wxAnimationDisposal
// Do not dispose. The graphic is to be left in place.
wxANIM_DONOTREMOVE = 0,
// Restore to background color. The area used by the graphic must be
// Restore to background color. The area used by the graphic must be
// restored to the background color.
wxANIM_TOBACKGROUND = 1,
// Restore to previous. The decoder is required to restore the area
// Restore to previous. The decoder is required to restore the area
// overwritten by the graphic with what was there prior to rendering the graphic.
wxANIM_TOPREVIOUS = 2
};
@ -84,19 +84,37 @@ enum wxAnimationType
// wxAnimationDecoder class
// --------------------------------------------------------------------------
class WXDLLEXPORT wxAnimationDecoder : public wxObjectRefData
class WXDLLIMPEXP_CORE wxAnimationDecoder : public wxObjectRefData
{
public:
wxAnimationDecoder()
{
m_background = wxNullColour;
m_nFrames = 0;
}
virtual ~wxAnimationDecoder() { }
virtual bool Load( wxInputStream& stream ) = 0;
virtual bool CanRead( wxInputStream& stream ) const = 0;
bool CanRead( wxInputStream& stream ) const
{
// NOTE: this code is the same of wxImageHandler::CallDoCanRead
if ( !stream.IsSeekable() )
return false; // can't test unseekable stream
wxFileOffset posOld = stream.TellI();
bool ok = DoCanRead(stream);
// restore the old position to be able to test other formats and so on
if ( stream.SeekI(posOld) == wxInvalidOffset )
{
wxLogDebug(wxT("Failed to rewind the stream in wxAnimationDecoder!"));
// reading would fail anyhow as we're not at the right position
return false;
}
return ok;
}
virtual wxAnimationDecoder *Clone() const = 0;
virtual wxAnimationType GetType() const = 0;
@ -132,6 +150,12 @@ public:
unsigned int GetFrameCount() const { return m_nFrames; }
protected:
// checks the signature of the data in the given stream and returns true if it
// appears to be a valid animation format recognized by the animation decoder;
// this function should modify the stream current position without taking care
// of restoring it since CanRead() will do it.
virtual bool DoCanRead(wxInputStream& stream) const = 0;
wxSize m_szAnimation;
unsigned int m_nFrames;
@ -140,7 +164,7 @@ protected:
wxColour m_background;
};
#endif // wxUSE_STREAMS
#endif // wxUSE_STREAM
#endif // _WX_ANIMDECOD_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,199 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/anybutton.h
// Purpose: wxAnyButtonBase class
// Author: Vadim Zetlin
// Created: 2000-08-15 (extracted from button.h)
// Copyright: (c) Vadim Zetlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ANYBUTTON_H_BASE_
#define _WX_ANYBUTTON_H_BASE_
#include "wx/defs.h"
#ifdef wxHAS_ANY_BUTTON
// ----------------------------------------------------------------------------
// wxAnyButton specific flags
// ----------------------------------------------------------------------------
// These flags affect label alignment
#define wxBU_LEFT 0x0040
#define wxBU_TOP 0x0080
#define wxBU_RIGHT 0x0100
#define wxBU_BOTTOM 0x0200
#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM )
// These two flags are obsolete
#define wxBU_NOAUTODRAW 0x0000
#define wxBU_AUTODRAW 0x0004
// by default, the buttons will be created with some (system dependent)
// minimal size to make them look nicer, giving this style will make them as
// small as possible
#define wxBU_EXACTFIT 0x0001
// this flag can be used to disable using the text label in the button: it is
// mostly useful when creating buttons showing bitmap and having stock id as
// without it both the standard label corresponding to the stock id and the
// bitmap would be shown
#define wxBU_NOTEXT 0x0002
#include "wx/bitmap.h"
#include "wx/control.h"
// ----------------------------------------------------------------------------
// wxAnyButton: common button functionality
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAnyButtonBase : public wxControl
{
public:
wxAnyButtonBase() { }
// show the image in the button in addition to the label: this method is
// supported on all (major) platforms
void SetBitmap(const wxBitmap& bitmap, wxDirection dir = wxLEFT)
{
SetBitmapLabel(bitmap);
SetBitmapPosition(dir);
}
wxBitmap GetBitmap() const { return DoGetBitmap(State_Normal); }
// Methods for setting individual images for different states: normal,
// selected (meaning pushed or pressed), focused (meaning normal state for
// a focused button), disabled or hover (a.k.a. hot or current).
//
// Remember that SetBitmap() itself must be called before any other
// SetBitmapXXX() methods (except for SetBitmapLabel() which is a synonym
// for it anyhow) and that all bitmaps passed to these functions should be
// of the same size.
void SetBitmapLabel(const wxBitmap& bitmap)
{ DoSetBitmap(bitmap, State_Normal); }
void SetBitmapPressed(const wxBitmap& bitmap)
{ DoSetBitmap(bitmap, State_Pressed); }
void SetBitmapDisabled(const wxBitmap& bitmap)
{ DoSetBitmap(bitmap, State_Disabled); }
void SetBitmapCurrent(const wxBitmap& bitmap)
{ DoSetBitmap(bitmap, State_Current); }
void SetBitmapFocus(const wxBitmap& bitmap)
{ DoSetBitmap(bitmap, State_Focused); }
wxBitmap GetBitmapLabel() const { return DoGetBitmap(State_Normal); }
wxBitmap GetBitmapPressed() const { return DoGetBitmap(State_Pressed); }
wxBitmap GetBitmapDisabled() const { return DoGetBitmap(State_Disabled); }
wxBitmap GetBitmapCurrent() const { return DoGetBitmap(State_Current); }
wxBitmap GetBitmapFocus() const { return DoGetBitmap(State_Focused); }
// set the margins around the image
void SetBitmapMargins(wxCoord x, wxCoord y) { DoSetBitmapMargins(x, y); }
void SetBitmapMargins(const wxSize& sz) { DoSetBitmapMargins(sz.x, sz.y); }
wxSize GetBitmapMargins() { return DoGetBitmapMargins(); }
// set the image position relative to the text, i.e. wxLEFT means that the
// image is to the left of the text (this is the default)
void SetBitmapPosition(wxDirection dir);
// Buttons on MSW can look bad if they are not native colours, because
// then they become owner-drawn and not theme-drawn. Disable it here
// in wxAnyButtonBase to make it consistent.
virtual bool ShouldInheritColours() const { return false; }
// wxUniv-compatible and deprecated equivalents to SetBitmapXXX()
#if WXWIN_COMPATIBILITY_2_8
void SetImageLabel(const wxBitmap& bitmap) { SetBitmap(bitmap); }
void SetImageMargins(wxCoord x, wxCoord y) { SetBitmapMargins(x, y); }
#endif // WXWIN_COMPATIBILITY_2_8
// backwards compatible names for pressed/current bitmaps: they're not
// deprecated as there is nothing really wrong with using them and no real
// advantage to using the new names but the new names are still preferred
wxBitmap GetBitmapSelected() const { return GetBitmapPressed(); }
wxBitmap GetBitmapHover() const { return GetBitmapCurrent(); }
void SetBitmapSelected(const wxBitmap& bitmap) { SetBitmapPressed(bitmap); }
void SetBitmapHover(const wxBitmap& bitmap) { SetBitmapCurrent(bitmap); }
// this enum is not part of wx public API, it is public because it is used
// in non wxAnyButton-derived classes internally
//
// also notice that MSW code relies on the values of the enum elements, do
// not change them without revising src/msw/button.cpp
enum State
{
State_Normal,
State_Current, // a.k.a. hot or "hovering"
State_Pressed, // a.k.a. "selected" in public API for some reason
State_Disabled,
State_Focused,
State_Max
};
// return true if this button shouldn't show the text label, either because
// it doesn't have it or because it was explicitly disabled with wxBU_NOTEXT
bool DontShowLabel() const
{
return HasFlag(wxBU_NOTEXT) || GetLabel().empty();
}
// return true if we do show the label
bool ShowsLabel() const
{
return !DontShowLabel();
}
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const
{ return wxBitmap(); }
virtual void DoSetBitmap(const wxBitmap& WXUNUSED(bitmap),
State WXUNUSED(which))
{ }
virtual wxSize DoGetBitmapMargins() const
{ return wxSize(0, 0); }
virtual void DoSetBitmapMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
{ }
virtual void DoSetBitmapPosition(wxDirection WXUNUSED(dir))
{ }
virtual bool DoGetAuthNeeded() const { return false; }
virtual void DoSetAuthNeeded(bool WXUNUSED(show)) { }
wxDECLARE_NO_COPY_CLASS(wxAnyButtonBase);
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/anybutton.h"
#elif defined(__WXMSW__)
#include "wx/msw/anybutton.h"
//#elif defined(__WXMOTIF__)
// #include "wx/motif/anybutton.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/anybutton.h"
//#elif defined(__WXGTK__)
// #include "wx/gtk1/anybutton.h"
#elif defined(__WXMAC__)
#include "wx/osx/anybutton.h"
//#elif defined(__WXCOCOA__)
// #include "wx/cocoa/anybutton.h"
//#elif defined(__WXPM__)
// #include "wx/os2/anybutton.h"
#else
typedef wxAnyButtonBase wxAnyButton;
#endif
#endif // wxHAS_ANY_BUTTON
#endif // _WX_ANYBUTTON_H_BASE_

View File

@ -0,0 +1,139 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/anystr.h
// Purpose: wxAnyStrPtr class declaration
// Author: Vadim Zeitlin
// Created: 2009-03-23
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ANYSTR_H_
#define _WX_ANYSTR_H_
#include "wx/string.h"
// ----------------------------------------------------------------------------
// wxAnyStrPtr
//
// Notice that this is an internal and intentionally not documented class. It
// is only used by wxWidgets itself to ensure compatibility with previous
// versions and shouldn't be used by user code. When you see a function
// returning it you should just know that you can treat it as a string pointer.
// ----------------------------------------------------------------------------
// This is a helper class convertible to either narrow or wide string pointer.
// It is similar to wxCStrData but, unlike it, can be NULL which is required to
// represent the return value of wxDateTime::ParseXXX() methods for example.
//
// NB: this class is fully inline and so doesn't need to be DLL-exported
class wxAnyStrPtr
{
public:
// ctors: this class must be created from the associated string or using
// its default ctor for an invalid NULL-like object; notice that it is
// immutable after creation.
// ctor for invalid pointer
wxAnyStrPtr()
: m_str(NULL)
{
}
// ctor for valid pointer into the given string (whose lifetime must be
// greater than ours and which should remain constant while we're used)
wxAnyStrPtr(const wxString& str, const wxString::const_iterator& iter)
: m_str(&str),
m_iter(iter)
{
}
// default copy ctor is ok and so is default dtor, in particular we do not
// free the string
// various operators meant to make this class look like a superposition of
// char* and wchar_t*
// this one is needed to allow boolean expressions involving these objects,
// e.g. "if ( FuncReturningAnyStrPtr() && ... )" (unfortunately using
// unspecified_bool_type here wouldn't help with ambiguity between all the
// different conversions to pointers)
operator bool() const { return m_str != NULL; }
// at least VC6 and VC7 also need this one or they complain about ambiguity
// for !anystr expressions
bool operator!() const { return !((bool)*this); }
// and these are the conversions operator which allow to assign the result
// of FuncReturningAnyStrPtr() to either char* or wxChar* (i.e. wchar_t*)
operator const char *() const
{
if ( !m_str )
return NULL;
// check if the string is convertible to char at all
//
// notice that this pointer points into wxString internal buffer
// containing its char* representation and so it can be kept for as
// long as wxString is not modified -- which is long enough for our
// needs
const char *p = m_str->c_str().AsChar();
if ( *p )
{
// find the offset of the character corresponding to this iterator
// position in bytes: we don't have any direct way to do it so we
// need to redo the conversion again for the part of the string
// before the iterator to find its length in bytes in current
// locale
//
// NB: conversion won't fail as it succeeded for the entire string
p += strlen(wxString(m_str->begin(), m_iter).mb_str());
}
//else: conversion failed, return "" as we can't do anything else
return p;
}
operator const wchar_t *() const
{
if ( !m_str )
return NULL;
// no complications with wide strings (as long as we discount
// surrogates as we do for now)
//
// just remember that this works as long as wxString keeps an internal
// buffer with its wide wide char representation, just as with AsChar()
// above
return m_str->c_str().AsWChar() + (m_iter - m_str->begin());
}
// Because the objects of this class are only used as return type for
// functions which can return NULL we can skip providing dereferencing
// operators: the code using this class must test it for NULL first and if
// it does anything else with it it has to assign it to either char* or
// wchar_t* itself, before dereferencing.
//
// IOW this
//
// if ( *FuncReturningAnyStrPtr() )
//
// is invalid because it could crash. And this
//
// const char *p = FuncReturningAnyStrPtr();
// if ( p && *p )
//
// already works fine.
private:
// the original string and the position in it we correspond to, if the
// string is NULL this object is NULL pointer-like
const wxString * const m_str;
const wxString::const_iterator m_iter;
wxDECLARE_NO_ASSIGN_CLASS(wxAnyStrPtr);
};
#endif // _WX_ANYSTR_H_

View File

@ -5,7 +5,6 @@
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: app.h 51592 2008-02-08 08:17:41Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -18,21 +17,29 @@
// ----------------------------------------------------------------------------
#include "wx/event.h" // for the base class
#include "wx/eventfilter.h" // (and another one)
#include "wx/build.h"
#include "wx/cmdargs.h" // for wxCmdLineArgsArray used by wxApp::argv
#include "wx/init.h" // we must declare wxEntry()
#include "wx/intl.h" // for wxLayoutDirection
#include "wx/log.h" // for wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()
class WXDLLIMPEXP_FWD_BASE wxAppConsole;
class WXDLLIMPEXP_FWD_BASE wxAppTraits;
class WXDLLIMPEXP_FWD_BASE wxCmdLineParser;
class WXDLLIMPEXP_FWD_BASE wxLog;
class WXDLLIMPEXP_FWD_BASE wxEventLoopBase;
class WXDLLIMPEXP_FWD_BASE wxMessageOutput;
#if wxUSE_GUI
class WXDLLIMPEXP_FWD_BASE wxEventLoop;
struct WXDLLIMPEXP_FWD_CORE wxVideoMode;
class WXDLLIMPEXP_FWD_CORE wxWindow;
#endif
// this macro should be used in any main() or equivalent functions defined in wx
#define wxDISABLE_DEBUG_SUPPORT() \
wxDISABLE_ASSERTS_IN_RELEASE_BUILD(); \
wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()
// ----------------------------------------------------------------------------
// typedefs
// ----------------------------------------------------------------------------
@ -51,15 +58,25 @@ enum
};
// ----------------------------------------------------------------------------
// wxAppConsole: wxApp for non-GUI applications
// global variables
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler
// use of this list is strongly deprecated, use wxApp ScheduleForDestruction()
// and IsScheduledForDestruction() methods instead of this list directly, it
// is here for compatibility purposes only
extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete;
// ----------------------------------------------------------------------------
// wxAppConsoleBase: wxApp for non-GUI applications
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxAppConsoleBase : public wxEvtHandler,
public wxEventFilter
{
public:
// ctor and dtor
wxAppConsole();
virtual ~wxAppConsole();
wxAppConsoleBase();
virtual ~wxAppConsoleBase();
// the virtual functions which may/must be overridden in the derived class
@ -81,17 +98,28 @@ public:
// class OnInit() to do it.
virtual bool OnInit();
// this is here only temporary hopefully (FIXME)
virtual bool OnInitGui() { return true; }
// This is the replacement for the normal main(): all program work should
// be done here. When OnRun() returns, the programs starts shutting down.
virtual int OnRun() = 0;
virtual int OnRun();
// Called before the first events are handled, called from within MainLoop()
virtual void OnLaunched();
// This is called by wxEventLoopBase::SetActive(): you should put the code
// which needs an active event loop here.
// Note that this function is called whenever an event loop is activated;
// you may want to use wxEventLoopBase::IsMain() to perform initialization
// specific for the app's main event loop.
virtual void OnEventLoopEnter(wxEventLoopBase* WXUNUSED(loop)) {}
// This is only called if OnInit() returned true so it's a good place to do
// any cleanup matching the initializations done there.
virtual int OnExit();
// This is called by wxEventLoopBase::OnExit() for each event loop which
// is exited.
virtual void OnEventLoopExit(wxEventLoopBase* WXUNUSED(loop)) {}
// This is the very last function called on wxApp object before it is
// destroyed. If you override it (instead of overriding OnExit() as usual)
// do not forget to call the base class version!
@ -117,12 +145,20 @@ public:
// be argv[0]
// set/get the application name
wxString GetAppName() const
{
return m_appName.empty() ? m_className : m_appName;
}
wxString GetAppName() const;
void SetAppName(const wxString& name) { m_appName = name; }
// set/get the application display name: the display name is the name
// shown to the user in titles, reports, etc while the app name is
// used for paths, config, and other places the user doesn't see
//
// by default the display name is the same as app name or a capitalized
// version of the program if app name was not set neither but it's
// usually better to set it explicitly to something nicer
wxString GetAppDisplayName() const;
void SetAppDisplayName(const wxString& name) { m_appDisplayName = name; }
// set/get the app class name
wxString GetClassName() const { return m_className; }
void SetClassName(const wxString& name) { m_className = name; }
@ -131,6 +167,19 @@ public:
const wxString& GetVendorName() const { return m_vendorName; }
void SetVendorName(const wxString& name) { m_vendorName = name; }
// set/get the vendor display name: the display name is shown
// in titles/reports/dialogs to the user, while the vendor name
// is used in some areas such as wxConfig, wxStandardPaths, etc
const wxString& GetVendorDisplayName() const
{
return m_vendorDisplayName.empty() ? GetVendorName()
: m_vendorDisplayName;
}
void SetVendorDisplayName(const wxString& name)
{
m_vendorDisplayName = name;
}
// cmd line parsing stuff
// ----------------------
@ -170,40 +219,68 @@ public:
// either should be configurable by the user (then he can change the
// default behaviour simply by overriding CreateTraits() and returning his
// own traits object) or which is GUI/console dependent as then wxAppTraits
// allows us to abstract the differences behind the common façade
// allows us to abstract the differences behind the common facade
wxAppTraits *GetTraits();
// the functions below shouldn't be used now that we have wxAppTraits
#if WXWIN_COMPATIBILITY_2_4
// this function provides safer access to traits object than
// wxTheApp->GetTraits() during startup or termination when the global
// application object itself may be unavailable
//
// of course, it still returns NULL in this case and the caller must check
// for it
static wxAppTraits *GetTraitsIfExists();
#if wxUSE_LOG
// override this function to create default log target of arbitrary
// user-defined class (default implementation creates a wxLogGui
// object) -- this log object is used by default by all wxLogXXX()
// functions.
wxDEPRECATED( virtual wxLog *CreateLogTarget() );
#endif // wxUSE_LOG
// Return some valid traits object.
//
// This method checks if we have wxTheApp and returns its traits if it does
// exist and the traits are non-NULL, similarly to GetTraitsIfExists(), but
// falls back to wxConsoleAppTraits to ensure that it always returns
// something valid.
static wxAppTraits& GetValidTraits();
// similar to CreateLogTarget() but for the global wxMessageOutput
// object
wxDEPRECATED( virtual wxMessageOutput *CreateMessageOutput() );
// returns the main event loop instance, i.e. the event loop which is started
// by OnRun() and which dispatches all events sent from the native toolkit
// to the application (except when new event loops are temporarily set-up).
// The returned value maybe NULL. Put initialization code which needs a
// non-NULL main event loop into OnEventLoopEnter().
wxEventLoopBase* GetMainLoop() const
{ return m_mainLoop; }
#endif // WXWIN_COMPATIBILITY_2_4
// This function sets the C locale to the default locale for the current
// environment. It is advised to call this to ensure that the underlying
// toolkit uses the locale in which the numbers and monetary amounts are
// shown in the format expected by user and so on.
//
// Notice that this does _not_ change the global C++ locale, you need to do
// it explicitly if you want.
//
// Finally, notice that while this function is virtual, it is not supposed
// to be overridden outside of the library itself.
virtual void SetCLocale();
// event processing functions
// --------------------------
// this method allows to filter all the events processed by the program, so
// you should try to return quickly from it to avoid slowing down the
// program to the crawl
//
// return value should be -1 to continue with the normal event processing,
// or TRUE or FALSE to stop further processing and pretend that the event
// had been already processed or won't be processed at all, respectively
// Implement the inherited wxEventFilter method but just return -1 from it
// to indicate that default processing should take place.
virtual int FilterEvent(wxEvent& event);
// return true if we're running event loop, i.e. if the events can
// (already) be dispatched
static bool IsMainLoopRunning();
#if wxUSE_EXCEPTIONS
// execute the functor to handle the given event
//
// this is a generalization of HandleEvent() below and the base class
// implementation of CallEventHandler() still calls HandleEvent() for
// compatibility for functors which are just wxEventFunctions (i.e. methods
// of wxEvtHandler)
virtual void CallEventHandler(wxEvtHandler *handler,
wxEventFunctor& functor,
wxEvent& event) const;
// call the specified handler on the given object with the given event
//
// this method only exists to allow catching the exceptions thrown by any
@ -214,33 +291,112 @@ public:
wxEvent& event) const;
// Called when an unhandled C++ exception occurs inside OnRun(): note that
// the exception type is lost by now, so if you really want to handle the
// exception you should override OnRun() and put a try/catch around
// MainLoop() call there or use OnExceptionInMainLoop()
virtual void OnUnhandledException() { }
// the main event loop has already terminated by now and the program will
// exit, if you need to really handle the exceptions you need to override
// OnExceptionInMainLoop()
virtual void OnUnhandledException();
// Function called if an uncaught exception is caught inside the main
// event loop: it may return true to continue running the event loop or
// false to stop it (in the latter case it may rethrow the exception as
// well)
virtual bool OnExceptionInMainLoop();
#endif // wxUSE_EXCEPTIONS
// process all events in the wxPendingEvents list -- it is necessary to
// call this function to process posted events. This happens during each
// pending events
// --------------
// IMPORTANT: all these methods conceptually belong to wxEventLoopBase
// but for many reasons we need to allow queuing of events
// even when there's no event loop (e.g. in wxApp::OnInit);
// this feature is used e.g. to queue events on secondary threads
// or in wxPython to use wx.CallAfter before the GUI is initialized
// process all events in the m_handlersWithPendingEvents list -- it is necessary
// to call this function to process posted events. This happens during each
// event loop iteration in GUI mode but if there is no main loop, it may be
// also called directly.
virtual void ProcessPendingEvents();
// doesn't do anything in this class, just a hook for GUI wxApp
virtual bool Yield(bool WXUNUSED(onlyIfNeeded) = false) { return true; }
// check if there are pending events on global pending event list
bool HasPendingEvents() const;
// make sure that idle events are sent again
virtual void WakeUpIdle() { }
// temporary suspends processing of the pending events
void SuspendProcessingOfPendingEvents();
// this is just a convenience: by providing its implementation here we
// avoid #ifdefs in the code using it
static bool IsMainLoopRunning() { return false; }
// resume processing of the pending events previously stopped because of a
// call to SuspendProcessingOfPendingEvents()
void ResumeProcessingOfPendingEvents();
// called by ~wxEvtHandler to (eventually) remove the handler from the list of
// the handlers with pending events
void RemovePendingEventHandler(wxEvtHandler* toRemove);
// adds an event handler to the list of the handlers with pending events
void AppendPendingEventHandler(wxEvtHandler* toAppend);
// moves the event handler from the list of the handlers with pending events
//to the list of the handlers with _delayed_ pending events
void DelayPendingEventHandler(wxEvtHandler* toDelay);
// deletes the current pending events
void DeletePendingEvents();
// delayed destruction
// -------------------
// If an object may have pending events for it, it shouldn't be deleted
// immediately as this would result in a crash when trying to handle these
// events: instead, it should be scheduled for destruction and really
// destroyed only after processing all pending events.
//
// Notice that this is only possible if we have a running event loop,
// otherwise the object is just deleted directly by ScheduleForDestruction()
// and IsScheduledForDestruction() always returns false.
// schedule the object for destruction in the near future
void ScheduleForDestruction(wxObject *object);
// return true if the object is scheduled for destruction
bool IsScheduledForDestruction(wxObject *object) const;
// wxEventLoop-related methods
// ---------------------------
// all these functions are forwarded to the corresponding methods of the
// currently active event loop -- and do nothing if there is none
virtual bool Pending();
virtual bool Dispatch();
virtual int MainLoop();
virtual void ExitMainLoop();
bool Yield(bool onlyIfNeeded = false);
virtual void WakeUpIdle();
// this method is called by the active event loop when there are no events
// to process
//
// by default it generates the idle events and if you override it in your
// derived class you should call the base class version to ensure that idle
// events are still sent out
virtual bool ProcessIdle();
// this virtual function is overridden in GUI wxApp to always return true
// as GUI applications always have an event loop -- but console ones may
// have it or not, so it simply returns true if already have an event loop
// running but false otherwise
virtual bool UsesEventLoop() const;
// debugging support
// -----------------
#ifdef __WXDEBUG__
// this function is called when an assert failure occurs, the base class
// version does the normal processing (i.e. shows the usual assert failure
// dialog box)
@ -260,16 +416,12 @@ public:
int line,
const wxChar *cond,
const wxChar *msg);
#endif // __WXDEBUG__
// check that the wxBuildOptions object (constructed in the application
// itself, usually the one from IMPLEMENT_APP() macro) matches the build
// itself, usually the one from wxIMPLEMENT_APP() macro) matches the build
// options of the library and abort if it doesn't
static bool CheckBuildOptions(const char *optionsSignature,
const char *componentName);
#if WXWIN_COMPATIBILITY_2_4
wxDEPRECATED( static bool CheckBuildOptions(const wxBuildOptions& buildOptions) );
#endif
// implementation only from now on
// -------------------------------
@ -289,37 +441,88 @@ public:
// command line arguments (public for backwards compatibility)
int argc;
wxChar **argv;
int argc;
// this object is implicitly convertible to either "char**" (traditional
// type of argv parameter of main()) or to "wchar_t **" (for compatibility
// with Unicode build in previous wx versions and because the command line
// can, in pr
#if wxUSE_UNICODE
wxCmdLineArgsArray argv;
#else
char **argv;
#endif
protected:
// delete all objects in wxPendingDelete list
//
// called from ProcessPendingEvents()
void DeletePendingObjects();
// the function which creates the traits object when GetTraits() needs it
// for the first time
virtual wxAppTraits *CreateTraits();
// function used for dynamic wxApp creation
static wxAppInitializerFunction ms_appInitFn;
// the one and only global application object
static wxAppConsole *ms_appInstance;
// create main loop from AppTraits or return NULL if
// there is no main loop implementation
wxEventLoopBase *CreateMainLoop();
// application info (must be set from the user code)
wxString m_vendorName, // vendor name (ACME Inc)
m_appName, // app name
m_className; // class name
wxString m_vendorName, // vendor name ("acme")
m_vendorDisplayName, // vendor display name (e.g. "ACME Inc")
m_appName, // app name ("myapp")
m_appDisplayName, // app display name ("My Application")
m_className; // class name
// the class defining the application behaviour, NULL initially and created
// by GetTraits() when first needed
wxAppTraits *m_traits;
// the main event loop of the application (may be NULL if the loop hasn't
// been started yet or has already terminated)
wxEventLoopBase *m_mainLoop;
// pending events management vars:
// the array of the handlers with pending events which needs to be processed
// inside ProcessPendingEvents()
wxEvtHandlerArray m_handlersWithPendingEvents;
// helper array used by ProcessPendingEvents() to store the event handlers
// which have pending events but of these events none can be processed right now
// (because of a call to wxEventLoop::YieldFor() which asked to selectively process
// pending events)
wxEvtHandlerArray m_handlersWithPendingDelayedEvents;
#if wxUSE_THREADS
// this critical section protects both the lists above
wxCriticalSection m_handlersWithPendingEventsLocker;
#endif
// flag modified by Suspend/ResumeProcessingOfPendingEvents()
bool m_bDoPendingEventProcessing;
friend class WXDLLIMPEXP_FWD_BASE wxEvtHandler;
// the application object is a singleton anyhow, there is no sense in
// copying it
DECLARE_NO_COPY_CLASS(wxAppConsole)
wxDECLARE_NO_COPY_CLASS(wxAppConsoleBase);
};
#if defined(__UNIX__) && !defined(__WINDOWS__)
#include "wx/unix/app.h"
#else
// this has to be a class and not a typedef as we forward declare it
class wxAppConsole : public wxAppConsoleBase { };
#endif
// ----------------------------------------------------------------------------
// wxAppBase: the common part of wxApp implementations for all platforms
// ----------------------------------------------------------------------------
@ -367,43 +570,9 @@ public:
// the worker functions - usually not used directly by the user code
// -----------------------------------------------------------------
// return true if we're running main loop, i.e. if the events can
// (already) be dispatched
static bool IsMainLoopRunning()
{
wxAppBase *app = wx_static_cast(wxAppBase *, GetInstance());
return app && app->m_mainLoop != NULL;
}
// execute the main GUI loop, the function returns when the loop ends
virtual int MainLoop();
// exit the main loop thus terminating the application
virtual void Exit();
// exit the main GUI loop during the next iteration (i.e. it does not
// stop the program immediately!)
virtual void ExitMainLoop();
// returns true if there are unprocessed events in the event queue
virtual bool Pending();
// process the first event in the event queue (blocks until an event
// appears if there are none currently, use Pending() if this is not
// wanted), returns false if the event loop should stop and true
// otherwise
virtual bool Dispatch();
// process all currently pending events right now
//
// it is an error to call Yield() recursively unless the value of
// onlyIfNeeded is true
//
// WARNING: this function is dangerous as it can lead to unexpected
// reentrancies (i.e. when called from an event handler it
// may result in calling the same event handler again), use
// with _extreme_ care or, better, don't use at all!
virtual bool Yield(bool onlyIfNeeded = false) = 0;
// safer alternatives to Yield(), using wxWindowDisabler
virtual bool SafeYield(wxWindow *win, bool onlyIfNeeded);
virtual bool SafeYieldFor(wxWindow *win, long eventsToProcess);
// this virtual function is called in the GUI mode when the application
// becomes idle and normally just sends wxIdleEvent to all interested
@ -412,18 +581,8 @@ public:
// it should return true if more idle events are needed, false if not
virtual bool ProcessIdle();
// Send idle event to window and all subwindows
// Returns true if more idle time is requested.
virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
#if wxUSE_EXCEPTIONS
// Function called if an uncaught exception is caught inside the main
// event loop: it may return true to continue running the event loop or
// false to stop it (in the latter case it may rethrow the exception as
// well)
virtual bool OnExceptionInMainLoop();
#endif // wxUSE_EXCEPTIONS
// override base class version: GUI apps always use an event loop
virtual bool UsesEventLoop() const { return true; }
// top level window functions
@ -455,15 +614,15 @@ public:
// ------------------------------------------------------------------------
// Get display mode that is used use. This is only used in framebuffer
// wxWin ports (such as wxMGL or wxDFB).
// wxWin ports such as wxDFB.
virtual wxVideoMode GetDisplayMode() const;
// Set display mode to use. This is only used in framebuffer wxWin
// ports (such as wxMGL or wxDFB). This method should be called from
// ports such as wxDFB. This method should be called from
// wxApp::OnInitGui
virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; }
// set use of best visual flag (see below)
void SetUseBestVisual( bool flag, bool forceTrueColour = false )
void SetUseBestVisual( bool flag, bool forceTrueColour = false )
{ m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; }
bool GetUseBestVisual() const { return m_useBestVisual; }
@ -478,6 +637,9 @@ public:
// if it's unknown
virtual wxLayoutDirection GetLayoutDirection() const;
// Change the theme used by the application, return true on success.
virtual bool SetNativeTheme(const wxString& WXUNUSED(theme)) { return false; }
// command line parsing (GUI-specific)
// ------------------------------------------------------------------------
@ -496,28 +658,16 @@ public:
virtual void SetActive(bool isActive, wxWindow *lastFocus);
#if WXWIN_COMPATIBILITY_2_6
// OBSOLETE: don't use, always returns true
//
// returns true if the program is successfully initialized
wxDEPRECATED( bool Initialized() );
wxDEPRECATED_MSG("always returns true now, don't call")
bool Initialized();
#endif // WXWIN_COMPATIBILITY_2_6
// perform standard OnIdle behaviour, ensure that this is always called
void OnIdle(wxIdleEvent& event);
protected:
// delete all objects in wxPendingDelete list
void DeletePendingObjects();
// override base class method to use GUI traits
virtual wxAppTraits *CreateTraits();
// the main event loop of the application (may be NULL if the loop hasn't
// been started yet or has already terminated)
wxEventLoop *m_mainLoop;
// the main top level window (may be NULL)
wxWindow *m_topWindow;
@ -541,47 +691,43 @@ protected:
// does any of our windows have focus?
bool m_isActive;
DECLARE_NO_COPY_CLASS(wxAppBase)
wxDECLARE_NO_COPY_CLASS(wxAppBase);
};
#if WXWIN_COMPATIBILITY_2_6
inline bool wxAppBase::Initialized() { return true; }
#endif // WXWIN_COMPATIBILITY_2_6
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// now include the declaration of the real class
// ----------------------------------------------------------------------------
#if wxUSE_GUI
#if defined(__WXPALMOS__)
#include "wx/palmos/app.h"
#elif defined(__WXMSW__)
#include "wx/msw/app.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/app.h"
#elif defined(__WXMGL__)
#include "wx/mgl/app.h"
#elif defined(__WXDFB__)
#include "wx/dfb/app.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/app.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/app.h"
#elif defined(__WXX11__)
#include "wx/x11/app.h"
#elif defined(__WXMAC__)
#include "wx/mac/app.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/app.h"
#elif defined(__WXPM__)
#include "wx/os2/app.h"
#endif
#if defined(__WXMSW__)
#include "wx/msw/app.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/app.h"
#elif defined(__WXDFB__)
#include "wx/dfb/app.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/app.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/app.h"
#elif defined(__WXX11__)
#include "wx/x11/app.h"
#elif defined(__WXMAC__)
#include "wx/osx/app.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/app.h"
#elif defined(__WXPM__)
#include "wx/os2/app.h"
#endif
#else // !GUI
// allow using just wxApp (instead of wxAppConsole) in console programs
typedef wxAppConsole wxApp;
// wxApp is defined in core and we cannot define another one in wxBase,
// so use the preprocessor to allow using wxApp in console programs too
#define wxApp wxAppConsole
#endif // GUI/!GUI
// ----------------------------------------------------------------------------
@ -592,12 +738,12 @@ protected:
// object of type wxApp
//
// note that instead of using of wxTheApp in application code you should
// consider using DECLARE_APP() after which you may call wxGetApp() which will
// consider using wxDECLARE_APP() after which you may call wxGetApp() which will
// return the object of the correct type (i.e. MyApp and not wxApp)
//
// the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in
// console mode it does nothing at all
#define wxTheApp wx_static_cast(wxApp*, wxApp::GetInstance())
#define wxTheApp static_cast<wxApp*>(wxApp::GetInstance())
// ----------------------------------------------------------------------------
// global functions
@ -607,20 +753,20 @@ protected:
// ------------------------------------------------------
// Force an exit from main loop
extern void WXDLLIMPEXP_BASE wxExit();
WXDLLIMPEXP_BASE void wxExit();
// avoid redeclaring this function here if it had been already declated by
// avoid redeclaring this function here if it had been already declared by
// wx/utils.h, this results in warnings from g++ with -Wredundant-decls
#ifndef wx_YIELD_DECLARED
#define wx_YIELD_DECLARED
// Yield to other apps/messages
extern bool WXDLLIMPEXP_BASE wxYield();
WXDLLIMPEXP_CORE bool wxYield();
#endif // wx_YIELD_DECLARED
// Yield to other apps/messages
extern void WXDLLIMPEXP_BASE wxWakeUpIdle();
WXDLLIMPEXP_BASE void wxWakeUpIdle();
// ----------------------------------------------------------------------------
// macros for dynamic creation of the application object
@ -637,34 +783,53 @@ public:
{ wxApp::SetInitializerFunction(fn); }
};
// the code below defines a IMPLEMENT_WXWIN_MAIN macro which you can use if
// the code below defines a wxIMPLEMENT_WXWIN_MAIN macro which you can use if
// your compiler really, really wants main() to be in your main program (e.g.
// hello.cpp). Now IMPLEMENT_APP should add this code if required.
// hello.cpp). Now wxIMPLEMENT_APP should add this code if required.
#define IMPLEMENT_WXWIN_MAIN_CONSOLE \
int main(int argc, char **argv) { return wxEntry(argc, argv); }
// For compilers that support it, prefer to use wmain() as this ensures any
// Unicode strings can be passed as command line parameters and not just those
// representable in the current locale.
#if wxUSE_UNICODE && defined(__VISUALC__)
#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
int wmain(int argc, wchar_t **argv) \
{ \
wxDISABLE_DEBUG_SUPPORT(); \
\
return wxEntry(argc, argv); \
}
#else // Use standard main()
#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
int main(int argc, char **argv) \
{ \
wxDISABLE_DEBUG_SUPPORT(); \
\
return wxEntry(argc, argv); \
}
#endif
// port-specific header could have defined it already in some special way
#ifndef IMPLEMENT_WXWIN_MAIN
#define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE
#endif // defined(IMPLEMENT_WXWIN_MAIN)
#ifndef wxIMPLEMENT_WXWIN_MAIN
#define wxIMPLEMENT_WXWIN_MAIN wxIMPLEMENT_WXWIN_MAIN_CONSOLE
#endif // defined(wxIMPLEMENT_WXWIN_MAIN)
#ifdef __WXUNIVERSAL__
#include "wx/univ/theme.h"
#ifdef wxUNIV_DEFAULT_THEME
#define IMPLEMENT_WX_THEME_SUPPORT \
#define wxIMPLEMENT_WX_THEME_SUPPORT \
WX_USE_THEME(wxUNIV_DEFAULT_THEME);
#else
#define IMPLEMENT_WX_THEME_SUPPORT
#define wxIMPLEMENT_WX_THEME_SUPPORT
#endif
#else
#define IMPLEMENT_WX_THEME_SUPPORT
#define wxIMPLEMENT_WX_THEME_SUPPORT
#endif
// Use this macro if you want to define your own main() or WinMain() function
// and call wxEntry() from there.
#define IMPLEMENT_APP_NO_MAIN(appname) \
#define wxIMPLEMENT_APP_NO_MAIN(appname) \
appname& wxGetApp() { return *static_cast<appname*>(wxApp::GetInstance()); } \
wxAppConsole *wxCreateApp() \
{ \
wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
@ -672,37 +837,53 @@ public:
return new appname; \
} \
wxAppInitializer \
wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
DECLARE_APP(appname) \
appname& wxGetApp() { return *wx_static_cast(appname*, wxApp::GetInstance()); }
wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp)
// Same as IMPLEMENT_APP() normally but doesn't include themes support in
// Same as wxIMPLEMENT_APP() normally but doesn't include themes support in
// wxUniversal builds
#define IMPLEMENT_APP_NO_THEMES(appname) \
IMPLEMENT_APP_NO_MAIN(appname) \
IMPLEMENT_WXWIN_MAIN
#define wxIMPLEMENT_APP_NO_THEMES(appname) \
wxIMPLEMENT_WXWIN_MAIN \
wxIMPLEMENT_APP_NO_MAIN(appname)
// Use this macro exactly once, the argument is the name of the wxApp-derived
// class which is the class of your application.
#define IMPLEMENT_APP(appname) \
IMPLEMENT_APP_NO_THEMES(appname) \
IMPLEMENT_WX_THEME_SUPPORT
#define wxIMPLEMENT_APP(appname) \
wxIMPLEMENT_WX_THEME_SUPPORT \
wxIMPLEMENT_APP_NO_THEMES(appname)
// Same as IMPLEMENT_APP(), but for console applications.
#define IMPLEMENT_APP_CONSOLE(appname) \
IMPLEMENT_APP_NO_MAIN(appname) \
IMPLEMENT_WXWIN_MAIN_CONSOLE
#define wxIMPLEMENT_APP_CONSOLE(appname) \
wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
wxIMPLEMENT_APP_NO_MAIN(appname)
// this macro can be used multiple times and just allows you to use wxGetApp()
// function
#define DECLARE_APP(appname) extern appname& wxGetApp();
#define wxDECLARE_APP(appname) \
extern appname& wxGetApp()
// declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed
// declare the stuff defined by wxIMPLEMENT_APP() macro, it's not really needed
// anywhere else but at the very least it suppresses icc warnings about
// defining extern symbols without prior declaration, and it shouldn't do any
// harm
extern wxAppConsole *wxCreateApp();
extern wxAppInitializer wxTheAppInitializer;
// ----------------------------------------------------------------------------
// Compatibility macro aliases
// ----------------------------------------------------------------------------
// deprecated variants _not_ requiring a semicolon after them
// (note that also some wx-prefixed macro do _not_ require a semicolon because
// it's not always possible to force the compire to require it)
#define IMPLEMENT_WXWIN_MAIN_CONSOLE wxIMPLEMENT_WXWIN_MAIN_CONSOLE
#define IMPLEMENT_WXWIN_MAIN wxIMPLEMENT_WXWIN_MAIN
#define IMPLEMENT_WX_THEME_SUPPORT wxIMPLEMENT_WX_THEME_SUPPORT
#define IMPLEMENT_APP_NO_MAIN(app) wxIMPLEMENT_APP_NO_MAIN(app);
#define IMPLEMENT_APP_NO_THEMES(app) wxIMPLEMENT_APP_NO_THEMES(app);
#define IMPLEMENT_APP(app) wxIMPLEMENT_APP(app);
#define IMPLEMENT_APP_CONSOLE(app) wxIMPLEMENT_APP_CONSOLE(app);
#define DECLARE_APP(app) wxDECLARE_APP(app);
#endif // _WX_APP_H_BASE_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 19.06.2003
// RCS-ID: $Id: apptrait.h 49804 2007-11-10 01:09:42Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -15,34 +14,44 @@
#include "wx/string.h"
#include "wx/platinfo.h"
class WXDLLIMPEXP_FWD_BASE wxObject;
class WXDLLIMPEXP_FWD_BASE wxAppTraits;
class WXDLLIMPEXP_FWD_BASE wxArrayString;
class WXDLLIMPEXP_FWD_BASE wxConfigBase;
class WXDLLIMPEXP_FWD_BASE wxEventLoopBase;
#if wxUSE_FONTMAP
class WXDLLIMPEXP_FWD_CORE wxFontMapper;
#endif // wxUSE_FONTMAP
class WXDLLIMPEXP_FWD_BASE wxLog;
class WXDLLIMPEXP_FWD_BASE wxMessageOutput;
class WXDLLIMPEXP_FWD_BASE wxObject;
class WXDLLIMPEXP_FWD_CORE wxRendererNative;
class WXDLLIMPEXP_FWD_BASE wxStandardPaths;
class WXDLLIMPEXP_FWD_BASE wxString;
class WXDLLIMPEXP_FWD_BASE wxTimer;
class WXDLLIMPEXP_FWD_BASE wxTimerImpl;
class GSocketGUIFunctionsTable;
class wxSocketManager;
// ----------------------------------------------------------------------------
// wxAppTraits: this class defines various configurable aspects of wxApp
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxStandardPathsBase;
class WXDLLIMPEXP_BASE wxAppTraitsBase
{
public:
// needed since this class declares virtual members
virtual ~wxAppTraitsBase() { }
// hooks for creating the global objects, may be overridden by the user
// hooks for working with the global objects, may be overridden by the user
// ------------------------------------------------------------------------
#if wxUSE_CONFIG
// create the default configuration object (base class version is
// implemented in config.cpp and creates wxRegConfig for wxMSW and
// wxFileConfig for all the other platforms)
virtual wxConfigBase *CreateConfig();
#endif // wxUSE_CONFIG
#if wxUSE_LOG
// create the default log target
virtual wxLog *CreateLogTarget() = 0;
@ -63,16 +72,14 @@ public:
// NB: returned pointer will be deleted by the caller
virtual wxRendererNative *CreateRenderer() = 0;
#if wxUSE_STDPATHS
// wxStandardPaths object is normally the same for wxBase and wxGUI
// except in the case of wxMac and wxCocoa
virtual wxStandardPathsBase& GetStandardPaths();
#endif // wxUSE_STDPATHS
virtual wxStandardPaths& GetStandardPaths();
// functions abstracting differences between GUI and console modes
// ------------------------------------------------------------------------
#ifdef __WXDEBUG__
// show the assert dialog with the specified message in GUI or just print
// the string to stderr in console mode
//
@ -81,53 +88,79 @@ public:
//
// return true to suppress subsequent asserts, false to continue as before
virtual bool ShowAssertDialog(const wxString& msg) = 0;
#endif // __WXDEBUG__
// return true if fprintf(stderr) goes somewhere, false otherwise
virtual bool HasStderr() = 0;
// managing "pending delete" list: in GUI mode we can't immediately delete
// some objects because there may be unprocessed events for them and so we
// only do it during the next idle loop iteration while this is, of course,
// unnecessary in wxBase, so we have a few functions to abstract these
// operations
// add the object to the pending delete list in GUI, delete it immediately
// in wxBase
virtual void ScheduleForDestroy(wxObject *object) = 0;
// remove this object from the pending delete list in GUI, do nothing in
// wxBase
virtual void RemoveFromPendingDelete(wxObject *object) = 0;
#if wxUSE_SOCKETS
// return table of GUI callbacks for GSocket code or NULL in wxBase. This
// is needed because networking classes are in their own library and so
// they can't directly call GUI functions (the same net library can be
// used in both GUI and base apps). To complicate it further, GUI library
// ("wxCore") doesn't depend on networking library and so only a functions
// table can be passed around
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0;
// this function is used by wxNet library to set the default socket manager
// to use: doing it like this allows us to keep all socket-related code in
// wxNet instead of having to pull it in wxBase itself as we'd have to do
// if we really implemented wxSocketManager here
//
// we don't take ownership of this pointer, it should have a lifetime
// greater than that of any socket (e.g. be a pointer to a static object)
static void SetDefaultSocketManager(wxSocketManager *manager)
{
ms_manager = manager;
}
// return socket manager: this is usually different for console and GUI
// applications (although some ports use the same implementation for both)
virtual wxSocketManager *GetSocketManager() { return ms_manager; }
#endif
// create a new, port specific, instance of the event loop used by wxApp
virtual wxEventLoopBase *CreateEventLoop() = 0;
#if wxUSE_TIMER
// return platform and toolkit dependent wxTimer implementation
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) = 0;
#endif
#if wxUSE_THREADS
virtual void MutexGuiEnter();
virtual void MutexGuiLeave();
#endif
// functions returning port-specific information
// ------------------------------------------------------------------------
// return information about the (native) toolkit currently used and its
// runtime (not compile-time) version.
// returns wxPORT_BASE for console applications and one of the remaining
// wxPORT_* values for GUI applications.
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const = 0;
virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const = 0;
// return true if the port is using wxUniversal for the GUI, false if not
virtual bool IsUsingUniversalWidgets() const = 0;
// return the name of the Desktop Environment such as
// "KDE" or "GNOME". May return an empty string.
virtual wxString GetDesktopEnvironment() const { return wxEmptyString; }
virtual wxString GetDesktopEnvironment() const = 0;
// returns a short string to identify the block of the standard command
// line options parsed automatically by current port: if this string is
// empty, there are no such options, otherwise the function also fills
// passed arrays with the names and the descriptions of those options.
virtual wxString GetStandardCmdLineOptions(wxArrayString& names,
wxArrayString& desc) const
{
wxUnusedVar(names);
wxUnusedVar(desc);
return wxEmptyString;
}
protected:
#if wxUSE_STACKWALKER && defined( __WXDEBUG__ )
#if wxUSE_STACKWALKER
// utility function: returns the stack frame as a plain wxString
virtual wxString GetAssertStackTrace();
#endif
private:
static wxSocketManager *ms_manager;
};
// ----------------------------------------------------------------------------
@ -137,14 +170,10 @@ protected:
// NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the
// Unix code (and otherwise __UNIX__ wouldn't be defined)
// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
#if defined(__WXPALMOS__)
#include "wx/palmos/apptbase.h"
#elif defined(__WIN32__)
#if defined(__WIN32__)
#include "wx/msw/apptbase.h"
#elif defined(__UNIX__) && !defined(__EMX__)
#include "wx/unix/apptbase.h"
#elif defined(__WXMAC__)
#include "wx/mac/apptbase.h"
#elif defined(__OS2__)
#include "wx/os2/apptbase.h"
#else // no platform-specific methods to add to wxAppTraits
@ -165,6 +194,10 @@ protected:
class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits
{
public:
#if !wxUSE_CONSOLE_EVENTLOOP
virtual wxEventLoopBase *CreateEventLoop() { return NULL; }
#endif // !wxUSE_CONSOLE_EVENTLOOP
#if wxUSE_LOG
virtual wxLog *CreateLogTarget();
#endif // wxUSE_LOG
@ -173,20 +206,12 @@ public:
virtual wxFontMapper *CreateFontMapper();
#endif // wxUSE_FONTMAP
virtual wxRendererNative *CreateRenderer();
#if wxUSE_SOCKETS
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable();
#endif
#ifdef __WXDEBUG__
virtual bool ShowAssertDialog(const wxString& msg);
#endif // __WXDEBUG__
virtual bool HasStderr();
virtual void ScheduleForDestroy(wxObject *object);
virtual void RemoveFromPendingDelete(wxObject *object);
// the GetToolkitVersion for console application is always the same
virtual wxPortId GetToolkitVersion(int *verMaj, int *verMin) const
virtual wxPortId GetToolkitVersion(int *verMaj = NULL, int *verMin = NULL) const
{
// no toolkits (wxBase is for console applications without GUI support)
// NB: zero means "no toolkit", -1 means "not initialized yet"
@ -197,6 +222,7 @@ public:
}
virtual bool IsUsingUniversalWidgets() const { return false; }
virtual wxString GetDesktopEnvironment() const { return wxEmptyString; }
};
// ----------------------------------------------------------------------------
@ -205,7 +231,7 @@ public:
#if wxUSE_GUI
class WXDLLEXPORT wxGUIAppTraitsBase : public wxAppTraits
class WXDLLIMPEXP_CORE wxGUIAppTraitsBase : public wxAppTraits
{
public:
#if wxUSE_LOG
@ -216,18 +242,10 @@ public:
virtual wxFontMapper *CreateFontMapper();
#endif // wxUSE_FONTMAP
virtual wxRendererNative *CreateRenderer();
#if wxUSE_SOCKETS
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable();
#endif
#ifdef __WXDEBUG__
virtual bool ShowAssertDialog(const wxString& msg);
#endif // __WXDEBUG__
virtual bool HasStderr();
virtual void ScheduleForDestroy(wxObject *object);
virtual void RemoveFromPendingDelete(wxObject *object);
virtual bool IsUsingUniversalWidgets() const
{
#ifdef __WXUNIVERSAL__
@ -236,6 +254,8 @@ public:
return false;
#endif
}
virtual wxString GetDesktopEnvironment() const { return wxEmptyString; }
};
#endif // wxUSE_GUI
@ -245,16 +265,12 @@ public:
// ----------------------------------------------------------------------------
// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
#if defined(__WXPALMOS__)
#include "wx/palmos/apptrait.h"
#elif defined(__WIN32__)
#if defined(__WIN32__)
#include "wx/msw/apptrait.h"
#elif defined(__OS2__)
#include "wx/os2/apptrait.h"
#elif defined(__UNIX__)
#include "wx/unix/apptrait.h"
#elif defined(__WXMAC__)
#include "wx/mac/apptrait.h"
#elif defined(__DOS__)
#include "wx/msdos/apptrait.h"
#else

View File

@ -2,7 +2,6 @@
// Name: wx/archive.h
// Purpose: Streams for archive formats
// Author: Mike Wetherell
// RCS-ID: $Id: archive.h 43445 2006-11-16 14:30:20Z MW $
// Copyright: (c) 2004 Mike Wetherell
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -225,7 +224,7 @@ public:
if (it.m_rep)
it.m_rep.AddRef();
if (m_rep)
m_rep.UnRef();
this->m_rep.UnRef();
m_rep = it.m_rep;
return *this;
}
@ -341,11 +340,13 @@ public:
const wxString& name,
wxPathFormat format = wxPATH_NATIVE) const = 0;
// FIXME-UTF8: remove these from this file, they are used for ANSI
// build only
void SetConv(wxMBConv& conv) { m_pConv = &conv; }
wxMBConv& GetConv() const
{ if (m_pConv) return *m_pConv; else return wxConvLocal; }
static const wxArchiveClassFactory *Find(const wxChar *protocol,
static const wxArchiveClassFactory *Find(const wxString& protocol,
wxStreamProtocolType type
= wxSTREAM_PROTOCOL);

View File

@ -4,9 +4,8 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 16.10.97
// RCS-ID: $Id: arrimpl.cpp 34241 2005-05-22 12:10:55Z JS $
// Copyright: (c) 1997 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows license
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/*****************************************************************************
@ -91,14 +90,14 @@ void name::Insert(const T& item, size_t uiIndex, size_t nInsert) \
base_array::operator[](uiIndex + i) = new T(item); \
} \
\
int name::Index(const T& Item, bool bFromEnd) const \
int name::Index(const T& item, bool bFromEnd) const \
{ \
if ( bFromEnd ) { \
if ( size() > 0 ) { \
size_t ui = size() - 1; \
do { \
if ( (T*)base_array::operator[](ui) == &Item ) \
return wx_static_cast(int, ui); \
if ( (T*)base_array::operator[](ui) == &item ) \
return static_cast<int>(ui); \
ui--; \
} \
while ( ui != 0 ); \
@ -106,8 +105,8 @@ int name::Index(const T& Item, bool bFromEnd) const \
} \
else { \
for( size_t ui = 0; ui < size(); ui++ ) { \
if( (T*)base_array::operator[](ui) == &Item ) \
return wx_static_cast(int, ui); \
if( (T*)base_array::operator[](ui) == &item ) \
return static_cast<int>(ui); \
} \
} \
\

View File

@ -1,10 +1,9 @@
///////////////////////////////////////////////////////////////////////////////
// Name: include/wx/arrstr.h
// Name: wx/arrstr.h
// Purpose: wxArrayString class
// Author: Mattia Barbon and Vadim Zeitlin
// Modified by:
// Created: 07/07/03
// RCS-ID: $Id: arrstr.h 61872 2009-09-09 22:37:05Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -15,10 +14,20 @@
#include "wx/defs.h"
#include "wx/string.h"
WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortAscending(wxString*, wxString*);
WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortDescending(wxString*, wxString*);
// these functions are only used in STL build now but we define them in any
// case for compatibility with the existing code outside of the library which
// could be using them
inline int wxCMPFUNC_CONV wxStringSortAscending(wxString* s1, wxString* s2)
{
return s1->Cmp(*s2);
}
#if wxUSE_STL
inline int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2)
{
return wxStringSortAscending(s2, s1);
}
#if wxUSE_STD_CONTAINERS
#include "wx/dynarray.h"
@ -42,10 +51,11 @@ public:
wxArrayString() { }
wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { }
wxArrayString(size_t sz, const wxChar** a);
wxArrayString(size_t sz, const char** a);
wxArrayString(size_t sz, const wchar_t** a);
wxArrayString(size_t sz, const wxString* a);
int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const;
int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const;
void Sort(bool reverseOrder = false);
void Sort(CompareFunction function);
@ -75,25 +85,37 @@ public:
Add(src[n]);
}
int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const;
int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const;
private:
void Insert()
{
wxFAIL_MSG( "wxSortedArrayString::Insert() is not to be used" );
}
void Sort()
{
wxFAIL_MSG( "wxSortedArrayString::Sort() is not to be used" );
}
};
#else // if !wxUSE_STL
#else // if !wxUSE_STD_CONTAINERS
// ----------------------------------------------------------------------------
// The string array uses it's knowledge of internal structure of the wxString
// class to optimize string storage. Normally, we would store pointers to
// string, but as wxString is, in fact, itself a pointer (sizeof(wxString) is
// sizeof(char *)) we store these pointers instead. The cast to "wxString *" is
// really all we need to turn such pointer into a string!
// this shouldn't be defined for compilers not supporting template methods or
// without std::distance()
//
// Of course, it can be called a dirty hack, but we use twice less memory and
// this approach is also more speed efficient, so it's probably worth it.
//
// Usage notes: when a string is added/inserted, a new copy of it is created,
// so the original string may be safely deleted. When a string is retrieved
// from the array (operator[] or Item() method), a reference is returned.
// ----------------------------------------------------------------------------
// FIXME-VC6: currently it's only not defined for VC6 in DLL build as it
// doesn't export template methods from DLL correctly so even though
// it compiles them fine, we get link errors when using wxArrayString
#if !defined(__VISUALC6__) || !(defined(WXMAKINGDLL) || defined(WXUSINGDLL))
#define wxHAS_VECTOR_TEMPLATE_ASSIGN
#endif
#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN
#include "wx/beforestd.h"
#include <iterator>
#include "wx/afterstd.h"
#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN
class WXDLLIMPEXP_BASE wxArrayString
{
@ -113,13 +135,14 @@ public:
//
// NB: the reason for using int and not bool is that like this we can avoid
// using this ctor for implicit conversions from "const char *" (which
// we'd like to be implicitly converted to wxString instead!)
//
// of course, using explicit would be even better - if all compilers
// supported it...
wxArrayString(int autoSort) { Init(autoSort != 0); }
// we'd like to be implicitly converted to wxString instead!). This
// wouldn't be needed if the 'explicit' keyword was supported by all
// compilers, or if this was protected ctor for wxSortedArrayString,
// but we're stuck with it now.
wxEXPLICIT wxArrayString(int autoSort) { Init(autoSort != 0); }
// C string array ctor
wxArrayString(size_t sz, const wxChar** a);
wxArrayString(size_t sz, const char** a);
wxArrayString(size_t sz, const wchar_t** a);
// wxString string array ctor
wxArrayString(size_t sz, const wxString* a);
// copy ctor
@ -149,38 +172,34 @@ public:
// items access (range checking is done in debug version)
// get item at position uiIndex
wxString& Item(size_t nIndex) const
wxString& Item(size_t nIndex)
{
wxASSERT_MSG( nIndex < m_nCount,
wxT("wxArrayString: index out of bounds") );
return *(wxString *)&(m_pItems[nIndex]);
return m_pItems[nIndex];
}
const wxString& Item(size_t nIndex) const { return const_cast<wxArrayString*>(this)->Item(nIndex); }
// same as Item()
wxString& operator[](size_t nIndex) const { return Item(nIndex); }
wxString& operator[](size_t nIndex) { return Item(nIndex); }
const wxString& operator[](size_t nIndex) const { return Item(nIndex); }
// get last item
wxString& Last() const
wxString& Last()
{
wxASSERT_MSG( !IsEmpty(),
wxT("wxArrayString: index out of bounds") );
return Item(Count() - 1);
return Item(GetCount() - 1);
}
const wxString& Last() const { return const_cast<wxArrayString*>(this)->Last(); }
// return a wxString[], useful for the controls which
// take one in their ctor. You must delete[] it yourself
// once you are done with it. Will return NULL if the
// ArrayString was empty.
#if WXWIN_COMPATIBILITY_2_4
wxDEPRECATED( wxString* GetStringArray() const );
#endif
// item management
// Search the element in the array, starting from the beginning if
// bFromEnd is false or from end otherwise. If bCase, comparison is case
// sensitive (default). Returns index of the first item matched or
// wxNOT_FOUND
int Index (const wxChar *sz, bool bCase = true, bool bFromEnd = false) const;
int Index (const wxString& str, bool bCase = true, bool bFromEnd = false) const;
// add new element at the end (if the array is not sorted), return its
// index
size_t Add(const wxString& str, size_t nInsert = 1);
@ -189,18 +208,15 @@ public:
// expand the array to have count elements
void SetCount(size_t count);
// remove first item matching this value
void Remove(const wxChar *sz);
void Remove(const wxString& sz);
// remove item by index
#if WXWIN_COMPATIBILITY_2_4
wxDEPRECATED( void Remove(size_t nIndex, size_t nRemove = 1) );
#endif
void RemoveAt(size_t nIndex, size_t nRemove = 1);
// sorting
// sort array elements in alphabetical order (or reversed alphabetical
// order if reverseOrder parameter is true)
void Sort(bool reverseOrder = false);
// sort array elements using specified comparaison function
// sort array elements using specified comparison function
void Sort(CompareFunction compareFunction);
void Sort(CompareFunction2 compareFunction);
@ -235,7 +251,7 @@ public:
public:
pointer m_ptr;
reverse_iterator() : m_ptr(NULL) { }
reverse_iterator(pointer ptr) : m_ptr(ptr) { }
wxEXPLICIT reverse_iterator(pointer ptr) : m_ptr(ptr) { }
reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { }
reference operator*() const { return *m_ptr; }
pointer operator->() const { return m_ptr; }
@ -261,7 +277,7 @@ public:
public:
pointer m_ptr;
const_reverse_iterator() : m_ptr(NULL) { }
const_reverse_iterator(pointer ptr) : m_ptr(ptr) { }
wxEXPLICIT const_reverse_iterator(pointer ptr) : m_ptr(ptr) { }
const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { }
const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
reference operator*() const { return *m_ptr; }
@ -278,13 +294,32 @@ public:
wxArrayString(const_iterator first, const_iterator last)
{ Init(false); assign(first, last); }
wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); }
void assign(const_iterator first, const_iterator last);
#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN
template <class Iterator>
void assign(Iterator first, Iterator last)
{
clear();
reserve(std::distance(first, last));
for(; first != last; ++first)
push_back(*first);
}
#else // !wxHAS_VECTOR_TEMPLATE_ASSIGN
void assign(const_iterator first, const_iterator last)
{
clear();
reserve(last - first);
for(; first != last; ++first)
push_back(*first);
}
#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN/!wxHAS_VECTOR_TEMPLATE_ASSIGN
void assign(size_type n, const_reference v)
{ clear(); Add(v, n); }
reference back() { return *(end() - 1); }
const_reference back() const { return *(end() - 1); }
iterator begin() { return (wxString *)&(m_pItems[0]); }
const_iterator begin() const { return (wxString *)&(m_pItems[0]); }
iterator begin() { return m_pItems; }
const_iterator begin() const { return m_pItems; }
size_type capacity() const { return m_nSize; }
void clear() { Clear(); }
bool empty() const { return IsEmpty(); }
@ -308,27 +343,36 @@ public:
void pop_back() { RemoveAt(GetCount() - 1); }
void push_back(const_reference v) { Add(v); }
reverse_iterator rbegin() { return reverse_iterator(end() - 1); }
const_reverse_iterator rbegin() const;
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(end() - 1); }
reverse_iterator rend() { return reverse_iterator(begin() - 1); }
const_reverse_iterator rend() const;
const_reverse_iterator rend() const
{ return const_reverse_iterator(begin() - 1); }
void reserve(size_type n) /* base::reserve*/;
void resize(size_type n, value_type v = value_type());
size_type size() const { return GetCount(); }
void swap(wxArrayString& other)
{
wxSwap(m_nSize, other.m_nSize);
wxSwap(m_nCount, other.m_nCount);
wxSwap(m_pItems, other.m_pItems);
wxSwap(m_autoSort, other.m_autoSort);
}
protected:
void Init(bool autoSort); // common part of all ctors
void Copy(const wxArrayString& src); // copies the contents of another array
private:
void Grow(size_t nIncrement = 0); // makes array bigger if needed
void Free(); // free all the strings stored
void DoSort(); // common part of all Sort() variants
// Allocate the new buffer big enough to hold m_nCount + nIncrement items and
// return the pointer to the old buffer, which must be deleted by the caller
// (if the old buffer is big enough, just return NULL).
wxString *Grow(size_t nIncrement);
size_t m_nSize, // current size of the array
m_nCount; // current number of elements
wxChar **m_pItems; // pointer to data
wxString *m_pItems; // pointer to data
bool m_autoSort; // if true, keep the array always sorted
};
@ -342,7 +386,7 @@ public:
{ Copy(array); }
};
#endif // !wxUSE_STL
#endif // !wxUSE_STD_CONTAINERS
// this class provides a temporary wxString* from a
// wxArrayString
@ -365,13 +409,110 @@ public:
return m_strings;
}
#if wxABI_VERSION >= 20810
wxString* Release();
#endif // wxABI_VERSION >= 20810
wxString* Release()
{
wxString *r = GetStrings();
m_strings = NULL;
return r;
}
private:
const wxArrayString& m_array;
wxString* m_strings;
};
#endif
// ----------------------------------------------------------------------------
// helper functions for working with arrays
// ----------------------------------------------------------------------------
// by default, these functions use the escape character to escape the
// separators occurring inside the string to be joined, this can be disabled by
// passing '\0' as escape
WXDLLIMPEXP_BASE wxString wxJoin(const wxArrayString& arr,
const wxChar sep,
const wxChar escape = wxT('\\'));
WXDLLIMPEXP_BASE wxArrayString wxSplit(const wxString& str,
const wxChar sep,
const wxChar escape = wxT('\\'));
// ----------------------------------------------------------------------------
// This helper class allows to pass both C array of wxStrings or wxArrayString
// using the same interface.
//
// Use it when you have two methods taking wxArrayString or (int, wxString[]),
// that do the same thing. This class lets you iterate over input data in the
// same way whether it is a raw array of strings or wxArrayString.
//
// The object does not take ownership of the data -- internally it keeps
// pointers to the data, therefore the data must be disposed of by user
// and only after this object is destroyed. Usually it is not a problem as
// only temporary objects of this class are used.
// ----------------------------------------------------------------------------
class wxArrayStringsAdapter
{
public:
// construct an adapter from a wxArrayString
wxArrayStringsAdapter(const wxArrayString& strings)
: m_type(wxSTRING_ARRAY), m_size(strings.size())
{
m_data.array = &strings;
}
// construct an adapter from a wxString[]
wxArrayStringsAdapter(unsigned int n, const wxString *strings)
: m_type(wxSTRING_POINTER), m_size(n)
{
m_data.ptr = strings;
}
// construct an adapter from a single wxString
wxArrayStringsAdapter(const wxString& s)
: m_type(wxSTRING_POINTER), m_size(1)
{
m_data.ptr = &s;
}
// default copy constructor is ok
// iteration interface
size_t GetCount() const { return m_size; }
bool IsEmpty() const { return GetCount() == 0; }
const wxString& operator[] (unsigned int i) const
{
wxASSERT_MSG( i < GetCount(), wxT("index out of bounds") );
if(m_type == wxSTRING_POINTER)
return m_data.ptr[i];
return m_data.array->Item(i);
}
wxArrayString AsArrayString() const
{
if(m_type == wxSTRING_ARRAY)
return *m_data.array;
return wxArrayString(GetCount(), m_data.ptr);
}
private:
// type of the data being held
enum wxStringContainerType
{
wxSTRING_ARRAY, // wxArrayString
wxSTRING_POINTER // wxString[]
};
wxStringContainerType m_type;
size_t m_size;
union
{
const wxString * ptr;
const wxArrayString * array;
} m_data;
wxDECLARE_NO_ASSIGN_CLASS(wxArrayStringsAdapter);
};
#endif // _WX_ARRSTR_H

View File

@ -4,7 +4,6 @@
// Author: Vaclav Slavik
// Modified by:
// Created: 18/03/2002
// RCS-ID: $Id: artprov.h 61872 2009-09-09 22:37:05Z VZ $
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -15,6 +14,7 @@
#include "wx/string.h"
#include "wx/bitmap.h"
#include "wx/icon.h"
#include "wx/iconbndl.h"
class WXDLLIMPEXP_FWD_CORE wxArtProvidersList;
class WXDLLIMPEXP_FWD_CORE wxArtProviderCache;
@ -27,10 +27,10 @@ class wxArtProviderModule;
typedef wxString wxArtClient;
typedef wxString wxArtID;
#define wxART_MAKE_CLIENT_ID_FROM_STR(id) (id + wxT("_C"))
#define wxART_MAKE_CLIENT_ID(id) wxT(#id) wxT("_C")
#define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + "_C")
#define wxART_MAKE_CLIENT_ID(id) (#id "_C")
#define wxART_MAKE_ART_ID_FROM_STR(id) (id)
#define wxART_MAKE_ART_ID(id) wxT(#id)
#define wxART_MAKE_ART_ID(id) (#id)
// ----------------------------------------------------------------------------
// Art clients
@ -44,6 +44,7 @@ typedef wxString wxArtID;
#define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER)
#define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX)
#define wxART_BUTTON wxART_MAKE_CLIENT_ID(wxART_BUTTON)
#define wxART_LIST wxART_MAKE_CLIENT_ID(wxART_LIST)
#define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER)
@ -64,6 +65,8 @@ typedef wxString wxArtID;
#define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN)
#define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT)
#define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME)
#define wxART_GOTO_FIRST wxART_MAKE_ART_ID(wxART_GOTO_FIRST)
#define wxART_GOTO_LAST wxART_MAKE_ART_ID(wxART_GOTO_LAST)
#define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN)
#define wxART_FILE_SAVE wxART_MAKE_ART_ID(wxART_FILE_SAVE)
#define wxART_FILE_SAVE_AS wxART_MAKE_ART_ID(wxART_FILE_SAVE_AS)
@ -99,6 +102,10 @@ typedef wxString wxArtID;
#define wxART_UNDO wxART_MAKE_ART_ID(wxART_UNDO)
#define wxART_REDO wxART_MAKE_ART_ID(wxART_REDO)
#define wxART_PLUS wxART_MAKE_ART_ID(wxART_PLUS)
#define wxART_MINUS wxART_MAKE_ART_ID(wxART_MINUS)
#define wxART_CLOSE wxART_MAKE_ART_ID(wxART_CLOSE)
#define wxART_QUIT wxART_MAKE_ART_ID(wxART_QUIT)
#define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND)
@ -109,12 +116,14 @@ typedef wxString wxArtID;
// wxArtProvider class
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxArtProvider : public wxObject
class WXDLLIMPEXP_CORE wxArtProvider : public wxObject
{
public:
// Dtor removes the provider from providers stack if it's still on it
virtual ~wxArtProvider();
// Does this platform implement native icons theme?
static bool HasNativeProvider();
// Add new provider to the top of providers stack (i.e. the provider will
// be queried first of all).
@ -122,11 +131,12 @@ public:
// Add new provider to the bottom of providers stack (i.e. the provider
// will be queried as the last one).
#if wxABI_VERSION >= 20810
static void PushBack(wxArtProvider *provider);
#if WXWIN_COMPATIBILITY_2_8
// use PushBack(), it's the same thing
static wxDEPRECATED( void Insert(wxArtProvider *provider) );
#endif
// same as PushBack()
static void Insert(wxArtProvider *provider);
// Remove latest added provider and delete it.
static bool Pop();
@ -150,26 +160,54 @@ public:
const wxArtClient& client = wxART_OTHER,
const wxSize& size = wxDefaultSize);
// Helper used by GetMessageBoxIcon(): return the art id corresponding to
// the standard wxICON_INFORMATION/WARNING/ERROR/QUESTION flags (only one
// can be set)
static wxArtID GetMessageBoxIconId(int flags);
// Helper used by several generic classes: return the icon corresponding to
// the standard wxICON_INFORMATION/WARNING/ERROR/QUESTION flags (only one
// can be set)
static wxIcon GetMessageBoxIcon(int flags)
{
return GetIcon(GetMessageBoxIconId(flags), wxART_MESSAGE_BOX);
}
// Query the providers for iconbundle with given ID and return it. Return
// wxNullIconBundle if no provider provides it.
static wxIconBundle GetIconBundle(const wxArtID& id,
const wxArtClient& client = wxART_OTHER);
// Gets native size for given 'client' or wxDefaultSize if it doesn't
// have native equivalent
static wxSize GetNativeSizeHint(const wxArtClient& client);
// Get the size hint of an icon from a specific wxArtClient, queries
// the topmost provider if platform_dependent = false
static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent = false);
#if WXWIN_COMPATIBILITY_2_6
// use the corresponding methods without redundant "Provider" suffix
wxDEPRECATED( static void PushProvider(wxArtProvider *provider) );
wxDEPRECATED( static void InsertProvider(wxArtProvider *provider) );
wxDEPRECATED( static bool PopProvider() );
static wxDEPRECATED( void PushProvider(wxArtProvider *provider) );
static wxDEPRECATED( void InsertProvider(wxArtProvider *provider) );
static wxDEPRECATED( bool PopProvider() );
// use Delete() if this is what you really need, or just delete the
// provider pointer, do not use Remove() as it does not delete the pointer
// unlike RemoveProvider() which does
wxDEPRECATED( static bool RemoveProvider(wxArtProvider *provider) );
static wxDEPRECATED( bool RemoveProvider(wxArtProvider *provider) );
#endif // WXWIN_COMPATIBILITY_2_6
protected:
friend class wxArtProviderModule;
#if wxUSE_ARTPROVIDER_STD
// Initializes default provider
static void InitStdProvider();
#endif // wxUSE_ARTPROVIDER_STD
// Initializes Tango-based icon provider
#if wxUSE_ARTPROVIDER_TANGO
static void InitTangoProvider();
#endif // wxUSE_ARTPROVIDER_TANGO
// Initializes platform's native provider, if available (e.g. GTK2)
static void InitNativeProvider();
// Destroy caches & all providers
@ -181,15 +219,26 @@ protected:
return GetSizeHint(client, true);
}
// Derived classes must override this method to create requested
// art resource. This method is called only once per instance's
// lifetime for each requested wxArtID.
// Derived classes must override CreateBitmap or CreateIconBundle
// (or both) to create requested art resource. This method is called
// only once per instance's lifetime for each requested wxArtID.
virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id),
const wxArtClient& WXUNUSED(client),
const wxSize& WXUNUSED(size)) = 0;
const wxSize& WXUNUSED(size))
{
return wxNullBitmap;
}
virtual wxIconBundle CreateIconBundle(const wxArtID& WXUNUSED(id),
const wxArtClient& WXUNUSED(client))
{
return wxNullIconBundle;
}
private:
static void CommonAddingProvider();
static wxIconBundle DoGetIconBundle(const wxArtID& id,
const wxArtClient& client);
private:
// list of providers:
@ -201,4 +250,12 @@ private:
};
#if !defined(__WXUNIVERSAL__) && \
((defined(__WXGTK__) && defined(__WXGTK20__)) || defined(__WXMSW__) || \
defined(__WXMAC__))
// *some* (partial) native implementation of wxArtProvider exists; this is
// not the same as wxArtProvider::HasNativeProvider()!
#define wxHAS_NATIVE_ART_PROVIDER_IMPL
#endif
#endif // _WX_ARTPROV_H_

View File

@ -0,0 +1,159 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/atomic.h
// Purpose: functions to manipulate atomically integers and pointers
// Author: Armel Asselin
// Created: 12/13/2006
// Copyright: (c) Armel Asselin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ATOMIC_H_
#define _WX_ATOMIC_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// get the value of wxUSE_THREADS configuration flag
#include "wx/defs.h"
// constraints on the various functions:
// - wxAtomicDec must return a zero value if the value is zero once
// decremented else it must return any non-zero value (the true value is OK
// but not necessary).
#if wxUSE_THREADS
#if defined(HAVE_GCC_ATOMIC_BUILTINS)
// NB: we intentionally don't use Linux's asm/atomic.h header, because it's
// an internal kernel header that doesn't always work in userspace:
// http://bugs.mysql.com/bug.php?id=28456
// http://golubenco.org/blog/atomic-operations/
inline void wxAtomicInc (wxUint32 &value)
{
__sync_fetch_and_add(&value, 1);
}
inline wxUint32 wxAtomicDec (wxUint32 &value)
{
return __sync_sub_and_fetch(&value, 1);
}
#elif defined(__WINDOWS__)
// include standard Windows headers
#include "wx/msw/wrapwin.h"
inline void wxAtomicInc (wxUint32 &value)
{
InterlockedIncrement ((LONG*)&value);
}
inline wxUint32 wxAtomicDec (wxUint32 &value)
{
return InterlockedDecrement ((LONG*)&value);
}
#elif defined(__WXMAC__) || defined(__DARWIN__)
#include "libkern/OSAtomic.h"
inline void wxAtomicInc (wxUint32 &value)
{
OSAtomicIncrement32 ((int32_t*)&value);
}
inline wxUint32 wxAtomicDec (wxUint32 &value)
{
return OSAtomicDecrement32 ((int32_t*)&value);
}
#elif defined (__SOLARIS__)
#include <atomic.h>
inline void wxAtomicInc (wxUint32 &value)
{
atomic_add_32 ((uint32_t*)&value, 1);
}
inline wxUint32 wxAtomicDec (wxUint32 &value)
{
return atomic_add_32_nv ((uint32_t*)&value, (uint32_t)-1);
}
#else // unknown platform
// it will result in inclusion if the generic implementation code a bit later in this page
#define wxNEEDS_GENERIC_ATOMIC_OPS
#endif // unknown platform
#else // else of wxUSE_THREADS
// if no threads are used we can safely use simple ++/--
inline void wxAtomicInc (wxUint32 &value) { ++value; }
inline wxUint32 wxAtomicDec (wxUint32 &value) { return --value; }
#endif // !wxUSE_THREADS
// ----------------------------------------------------------------------------
// proxies to actual implementations, but for various other types with same
// behaviour
// ----------------------------------------------------------------------------
#ifdef wxNEEDS_GENERIC_ATOMIC_OPS
#include "wx/thread.h" // for wxCriticalSection
class wxAtomicInt32
{
public:
wxAtomicInt32() { } // non initialized for consistency with basic int type
wxAtomicInt32(wxInt32 v) : m_value(v) { }
wxAtomicInt32(const wxAtomicInt32& a) : m_value(a.m_value) {}
operator wxInt32() const { return m_value; }
operator volatile wxInt32&() { return m_value; }
wxAtomicInt32& operator=(wxInt32 v) { m_value = v; return *this; }
void Inc()
{
wxCriticalSectionLocker lock(m_locker);
++m_value;
}
wxInt32 Dec()
{
wxCriticalSectionLocker lock(m_locker);
return --m_value;
}
private:
volatile wxInt32 m_value;
wxCriticalSection m_locker;
};
inline void wxAtomicInc(wxAtomicInt32 &value) { value.Inc(); }
inline wxInt32 wxAtomicDec(wxAtomicInt32 &value) { return value.Dec(); }
#else // !wxNEEDS_GENERIC_ATOMIC_OPS
#define wxHAS_ATOMIC_OPS
inline void wxAtomicInc(wxInt32 &value) { wxAtomicInc((wxUint32&)value); }
inline wxInt32 wxAtomicDec(wxInt32 &value) { return wxAtomicDec((wxUint32&)value); }
typedef wxInt32 wxAtomicInt32;
#endif // wxNEEDS_GENERIC_ATOMIC_OPS
// all the native implementations use 32 bits currently
// for a 64 bits implementation we could use (a future) wxAtomicInt64 as
// default type
typedef wxAtomicInt32 wxAtomicInt;
#endif // _WX_ATOMIC_H_

View File

@ -0,0 +1,144 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/bannerwindow.h
// Purpose: wxBannerWindow class declaration
// Author: Vadim Zeitlin
// Created: 2011-08-16
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BANNERWINDOW_H_
#define _WX_BANNERWINDOW_H_
#include "wx/defs.h"
#if wxUSE_BANNERWINDOW
#include "wx/bitmap.h"
#include "wx/event.h"
#include "wx/window.h"
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_FWD_CORE wxDC;
extern WXDLLIMPEXP_DATA_ADV(const char) wxBannerWindowNameStr[];
// ----------------------------------------------------------------------------
// A simple banner window showing either a bitmap or text.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxBannerWindow : public wxWindow
{
public:
// Default constructor, use Create() later.
wxBannerWindow() { Init(); }
// Convenient constructor that should be used in the majority of cases.
//
// The banner orientation changes how the text in it is displayed and also
// defines where is the bitmap truncated if it's too big to fit but doesn't
// do anything for the banner position, this is supposed to be taken care
// of in the usual way, e.g. using sizers.
wxBannerWindow(wxWindow* parent, wxDirection dir = wxLEFT)
{
Init();
Create(parent, wxID_ANY, dir);
}
// Full constructor provided for consistency with the other classes only.
wxBannerWindow(wxWindow* parent,
wxWindowID winid,
wxDirection dir = wxLEFT,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxBannerWindowNameStr)
{
Init();
Create(parent, winid, dir, pos, size, style, name);
}
// Can be only called on objects created with the default constructor.
bool Create(wxWindow* parent,
wxWindowID winid,
wxDirection dir = wxLEFT,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxBannerWindowNameStr);
// Provide an existing bitmap to show. For wxLEFT orientation the bitmap is
// truncated from the top, for wxTOP and wxBOTTOM -- from the right and for
// wxRIGHT -- from the bottom, so put the most important part of the bitmap
// information in the opposite direction.
void SetBitmap(const wxBitmap& bmp);
// Set the text to display. This is mutually exclusive with SetBitmap().
// Title is rendered in bold and should be single line, message can have
// multiple lines but is not wrapped automatically.
void SetText(const wxString& title, const wxString& message);
// Set the colours between which the gradient runs. This can be combined
// with SetText() but not SetBitmap().
void SetGradient(const wxColour& start, const wxColour& end);
protected:
virtual wxSize DoGetBestClientSize() const;
private:
// Common part of all constructors.
void Init();
// Fully invalidates the window.
void OnSize(wxSizeEvent& event);
// Redraws the window using either m_bitmap or m_title/m_message.
void OnPaint(wxPaintEvent& event);
// Helper of OnPaint(): draw the bitmap at the correct position depending
// on our orientation.
void DrawBitmapBackground(wxDC& dc);
// Helper of OnPaint(): draw the text in the appropriate direction.
void DrawBannerTextLine(wxDC& dc, const wxString& str, const wxPoint& pos);
// Return the font to use for the title. Currently this is hardcoded as a
// larger bold version of the standard window font but could be made
// configurable in the future.
wxFont GetTitleFont() const;
// Return the colour to use for extending the bitmap. Non-const as it
// updates m_colBitmapBg if needed.
wxColour GetBitmapBg();
// The window side along which the banner is laid out.
wxDirection m_direction;
// If valid, this bitmap is drawn as is.
wxBitmap m_bitmap;
// If bitmap is valid, this is the colour we use to extend it if the bitmap
// is smaller than this window. It is computed on demand by GetBitmapBg().
wxColour m_colBitmapBg;
// The title and main message to draw, used if m_bitmap is invalid.
wxString m_title,
m_message;
// Start and stop gradient colours, only used when drawing text.
wxColour m_colStart,
m_colEnd;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxBannerWindow);
};
#endif // wxUSE_BANNERWINDOW
#endif // _WX_BANNERWINDOW_H_

View File

@ -0,0 +1,121 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/base64.h
// Purpose: declaration of BASE64 encoding/decoding functionality
// Author: Charles Reimers, Vadim Zeitlin
// Created: 2007-06-18
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BASE64_H_
#define _WX_BASE64_H_
#if wxUSE_BASE64
#include "wx/string.h"
#include "wx/buffer.h"
// ----------------------------------------------------------------------------
// encoding functions
// ----------------------------------------------------------------------------
// return the size needed for the buffer containing the encoded representation
// of a buffer of given length
inline size_t wxBase64EncodedSize(size_t len) { return 4*((len+2)/3); }
// raw base64 encoding function which encodes the contents of a buffer of the
// specified length into the buffer of the specified size
//
// returns the length of the encoded data or wxCONV_FAILED if the buffer is not
// large enough; to determine the needed size you can either allocate a buffer
// of wxBase64EncodedSize(srcLen) size or call the function with NULL buffer in
// which case the required size will be returned
WXDLLIMPEXP_BASE size_t
wxBase64Encode(char *dst, size_t dstLen, const void *src, size_t srcLen);
// encode the contents of the given buffer using base64 and return as string
// (there is no error return)
inline wxString wxBase64Encode(const void *src, size_t srcLen)
{
const size_t dstLen = wxBase64EncodedSize(srcLen);
wxCharBuffer dst(dstLen);
wxBase64Encode(dst.data(), dstLen, src, srcLen);
return dst;
}
inline wxString wxBase64Encode(const wxMemoryBuffer& buf)
{
return wxBase64Encode(buf.GetData(), buf.GetDataLen());
}
// ----------------------------------------------------------------------------
// decoding functions
// ----------------------------------------------------------------------------
// elements of this enum specify the possible behaviours of wxBase64Decode()
// when an invalid character is encountered
enum wxBase64DecodeMode
{
// normal behaviour: stop at any invalid characters
wxBase64DecodeMode_Strict,
// skip whitespace characters
wxBase64DecodeMode_SkipWS,
// the most lenient behaviour: simply ignore all invalid characters
wxBase64DecodeMode_Relaxed
};
// return the buffer size necessary for decoding a base64 string of the given
// length
inline size_t wxBase64DecodedSize(size_t srcLen) { return 3*srcLen/4; }
// raw decoding function which decodes the contents of the string of specified
// length (or NUL-terminated by default) into the provided buffer of the given
// size
//
// the function normally stops at any character invalid inside a base64-encoded
// string (i.e. not alphanumeric nor '+' nor '/') but can be made to skip the
// whitespace or all invalid characters using its mode argument
//
// returns the length of the decoded data or wxCONV_FAILED if an error occurs
// such as the buffer is too small or the encoded string is invalid; in the
// latter case the posErr is filled with the position where the decoding
// stopped if it is not NULL
WXDLLIMPEXP_BASE size_t
wxBase64Decode(void *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t *posErr = NULL);
inline size_t
wxBase64Decode(void *dst, size_t dstLen,
const wxString& src,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t *posErr = NULL)
{
// don't use str.length() here as the ASCII buffer is shorter than it for
// strings with embedded NULs
return wxBase64Decode(dst, dstLen, src.ToAscii(), wxNO_LEN, mode, posErr);
}
// decode the contents of the given string; the returned buffer is empty if an
// error occurs during decoding
WXDLLIMPEXP_BASE wxMemoryBuffer
wxBase64Decode(const char *src, size_t srcLen = wxNO_LEN,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t *posErr = NULL);
inline wxMemoryBuffer
wxBase64Decode(const wxString& src,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t *posErr = NULL)
{
// don't use str.length() here as the ASCII buffer is shorter than it for
// strings with embedded NULs
return wxBase64Decode(src.ToAscii(), wxNO_LEN, mode, posErr);
}
#endif // wxUSE_BASE64
#endif // _WX_BASE64_H_

View File

@ -1,10 +1,9 @@
///////////////////////////////////////////////////////////////////////////////
// Name: include/wx/beforestd.h
// Name: wx/beforestd.h
// Purpose: #include before STL headers
// Author: Vadim Zeitlin
// Modified by:
// Created: 07/07/03
// RCS-ID: $Id: beforestd.h 61871 2009-09-09 22:29:51Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -23,6 +22,20 @@
// VC 7.x isn't as bad as VC6 and doesn't give these warnings but eVC (which
// defines _MSC_VER as 1201) does need to be included as it's VC6-like
#if defined(__VISUALC__) && __VISUALC__ <= 1201
// these warning have to be disabled and not just temporarily disabled
// because they will be given at the end of the compilation of the
// current source and there is absolutely nothing we can do about them so
// disable them before warning(push) below
// 'foo': unreferenced inline function has been removed
#pragma warning(disable:4514)
// 'function' : function not inlined
#pragma warning(disable:4710)
// 'id': identifier was truncated to 'num' characters in the debug info
#pragma warning(disable:4786)
// MSVC 5 does not have this
#if __VISUALC__ > 1100
// we have to disable (and reenable in afterstd.h) this one because,
@ -48,28 +61,15 @@
// 'identifier' use the following syntax
#pragma warning(disable:4663)
#endif
// these warning have to be disabled and not just temporarily disabled
// because they will be given at the end of the compilation of the
// current source and there is absolutely nothing we can do about them
// 'foo': unreferenced inline function has been removed
#pragma warning(disable:4514)
// 'function' : function not inlined
#pragma warning(disable:4710)
// 'id': identifier was truncated to 'num' characters in the debug info
#pragma warning(disable:4786)
#endif // VC++ < 7
/*
Recent versions of Sun C++ compiler use _T in their standard headers and
our definition of it in wx/wxchar.h conflicts with them and breaks
compilation, so undefine _T before including them and redefine it back in
wx/afterstd.h if needed.
/**
GCC's visibility support is broken for libstdc++ in some older versions
(namely Debian/Ubuntu's GCC 4.1, see
https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/109262). We fix it
here by mimicking newer versions' behaviour of using default visibility
for libstdc++ code.
*/
#if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
#undef _T
#endif /* SUNCC */
#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY)
#pragma GCC visibility push(default)
#endif

View File

@ -4,7 +4,6 @@
// Author: Vaclav Slavik
// Modified by:
// Created: 22.04.01
// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -19,13 +18,14 @@
#include "wx/string.h"
#include "wx/gdicmn.h" // for wxBitmapType
#include "wx/colour.h"
#include "wx/image.h"
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxBitmapHandler;
class WXDLLIMPEXP_FWD_CORE wxIcon;
class WXDLLIMPEXP_FWD_CORE wxImage;
class WXDLLIMPEXP_FWD_CORE wxMask;
class WXDLLIMPEXP_FWD_CORE wxPalette;
class WXDLLIMPEXP_FWD_CORE wxDC;
// ----------------------------------------------------------------------------
// wxVariant support
@ -33,14 +33,16 @@ class WXDLLIMPEXP_FWD_CORE wxPalette;
#if wxUSE_VARIANT
#include "wx/variant.h"
DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT)
DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLIMPEXP_CORE)
#endif
// ----------------------------------------------------------------------------
// wxMask represents the transparent area of the bitmap
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMaskBase : public wxObject
// TODO: all implementation of wxMask, except the generic one,
// do not derive from wxMaskBase,,, they should
class WXDLLIMPEXP_CORE wxMaskBase : public wxObject
{
public:
// create the mask from bitmap pixels of the given colour
@ -66,8 +68,7 @@ protected:
virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0;
};
#if defined(__WXMGL__) || \
defined(__WXDFB__) || \
#if defined(__WXDFB__) || \
defined(__WXMAC__) || \
defined(__WXGTK__) || \
defined(__WXCOCOA__) || \
@ -78,8 +79,30 @@ protected:
#define wxUSE_BITMAP_BASE 0
#endif
// Only used by some ports
// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes
// a more readable way to tell
#define wxBITMAP_SCREEN_DEPTH (-1)
// ----------------------------------------------------------------------------
// wxBitmapHelpers: container for various bitmap methods common to all ports.
// ----------------------------------------------------------------------------
// Unfortunately, currently wxBitmap does not inherit from wxBitmapBase on all
// platforms and this is not easy to fix. So we extract at least some common
// methods into this class from which both wxBitmapBase (and hence wxBitmap on
// all platforms where it does inherit from it) and wxBitmap in wxMSW and other
// exceptional ports (only wxPM and old wxCocoa) inherit.
class WXDLLIMPEXP_CORE wxBitmapHelpers
{
public:
// Create a new wxBitmap from the PNG data in the given buffer.
static wxBitmap NewFromPNGData(const void* data, size_t size);
};
// All ports except wxMSW and wxOS2 use wxBitmapHandler and wxBitmapBase as
// base class for wxBitmapHandler; wxMSW and wxOS2 use wxGDIImageHandler as
// base class since it allows some code reuse there.
#if wxUSE_BITMAP_BASE
// ----------------------------------------------------------------------------
@ -87,18 +110,29 @@ protected:
// different formats
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapHandlerBase : public wxObject
class WXDLLIMPEXP_CORE wxBitmapHandler : public wxObject
{
public:
wxBitmapHandlerBase() { m_type = wxBITMAP_TYPE_INVALID; }
virtual ~wxBitmapHandlerBase() { }
wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; }
virtual ~wxBitmapHandler() { }
virtual bool Create(wxBitmap *bitmap, const void* data, long flags,
int width, int height, int depth = 1);
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL);
// NOTE: the following functions should be pure virtuals, but they aren't
// because otherwise almost all ports would have to implement
// them as "return false"...
virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data),
wxBitmapType WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(depth) = 1)
{ return false; }
virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
wxBitmapType WXUNUSED(type), int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{ return false; }
virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = NULL) const
{ return false; }
void SetName(const wxString& name) { m_name = name; }
void SetExtension(const wxString& ext) { m_extension = ext; }
@ -112,43 +146,65 @@ private:
wxString m_extension;
wxBitmapType m_type;
DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase)
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
class WXDLLEXPORT wxBitmapBase : public wxGDIObject
// ----------------------------------------------------------------------------
// wxBitmap: class which represents platform-dependent bitmap (unlike wxImage)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapBase : public wxGDIObject,
public wxBitmapHelpers
{
public:
/*
Derived class must implement these:
wxBitmap();
wxBitmap(int width, int height, int depth = -1);
wxBitmap(const wxBitmap& bmp);
wxBitmap(const char bits[], int width, int height, int depth = 1);
wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
wxBitmap(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH);
wxBitmap(const char* const* bits);
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
wxBitmap(const wxImage& image, int depth = -1);
bool Create(int width, int height, int depth = -1);
wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH);
static void InitStandardHandlers();
*/
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const = 0;
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool CreateScaled(int w, int h, int d, double logicalScale)
{ return Create(w*logicalScale,h*logicalScale,d); }
virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0;
virtual int GetDepth() const = 0;
wxSize GetSize() const
{ return wxSize(GetWidth(), GetHeight()); }
// support for scaled bitmaps
virtual double GetScaleFactor() const { return 1.0; }
virtual double GetScaledWidth() const { return GetWidth() / GetScaleFactor(); }
virtual double GetScaledHeight() const { return GetHeight() / GetScaleFactor(); }
virtual wxSize GetScaledSize() const
{ return wxSize(GetScaledWidth(), GetScaledHeight()); }
#if wxUSE_IMAGE
virtual wxImage ConvertToImage() const = 0;
// Convert to disabled (dimmed) bitmap.
wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
#endif // wxUSE_IMAGE
virtual wxMask *GetMask() const = 0;
virtual void SetMask(wxMask *mask) = 0;
virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0;
virtual bool SaveFile(const wxString &name, wxBitmapType type,
const wxPalette *palette = (wxPalette *)NULL) const = 0;
const wxPalette *palette = NULL) const = 0;
virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0;
/*
@ -174,8 +230,8 @@ public:
// Format handling
static inline wxList& GetHandlers() { return sm_handlers; }
static void AddHandler(wxBitmapHandlerBase *handler);
static void InsertHandler(wxBitmapHandlerBase *handler);
static void AddHandler(wxBitmapHandler *handler);
static void InsertHandler(wxBitmapHandler *handler);
static bool RemoveHandler(const wxString& name);
static wxBitmapHandler *FindHandler(const wxString& name);
static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType);
@ -203,32 +259,58 @@ protected:
#endif // wxUSE_BITMAP_BASE
#if defined(__WXPALMOS__)
#include "wx/palmos/bitmap.h"
#elif defined(__WXMSW__)
// the wxBITMAP_DEFAULT_TYPE constant defines the default argument value
// for wxBitmap's ctor and wxBitmap::LoadFile() functions.
#if defined(__WXMSW__)
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
#include "wx/msw/bitmap.h"
#elif defined(__WXMOTIF__)
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#include "wx/x11/bitmap.h"
#elif defined(__WXGTK20__)
#ifdef __WINDOWS__
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
#else
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#endif
#include "wx/gtk/bitmap.h"
#elif defined(__WXGTK__)
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#include "wx/gtk1/bitmap.h"
#elif defined(__WXX11__)
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#include "wx/x11/bitmap.h"
#elif defined(__WXMGL__)
#include "wx/mgl/bitmap.h"
#elif defined(__WXDFB__)
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
#include "wx/dfb/bitmap.h"
#elif defined(__WXMAC__)
#include "wx/mac/bitmap.h"
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_PICT_RESOURCE
#include "wx/osx/bitmap.h"
#elif defined(__WXCOCOA__)
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
#include "wx/cocoa/bitmap.h"
#elif defined(__WXPM__)
#define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
#include "wx/os2/bitmap.h"
#endif
#if wxUSE_IMAGE
inline
wxBitmap
#if wxUSE_BITMAP_BASE
wxBitmapBase::
#else
wxBitmap::
#endif
ConvertToDisabled(unsigned char brightness) const
{
return ConvertToImage().ConvertToDisabled(brightness);
}
#endif // wxUSE_IMAGE
// we must include generic mask.h after wxBitmap definition
#if defined(__WXMGL__) || defined(__WXDFB__)
#if defined(__WXDFB__)
#define wxUSE_GENERIC_MASK 1
#else
#define wxUSE_GENERIC_MASK 0

View File

@ -1,10 +1,9 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/bmpbutton.h
// Name: wx/bmpbuttn.h
// Purpose: wxBitmapButton class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 25.08.00
// RCS-ID: $Id: bmpbuttn.h 45498 2007-04-16 13:03:05Z VZ $
// Copyright: (c) 2000 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -16,57 +15,75 @@
#if wxUSE_BMPBUTTON
#include "wx/bitmap.h"
#include "wx/button.h"
extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[];
// FIXME: right now only wxMSW, wxGTK and wxOSX implement bitmap support in wxButton
// itself, this shouldn't be used for the other platforms neither
// when all of them do it
#if (defined(__WXMSW__) || defined(__WXGTK20__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__)
#define wxHAS_BUTTON_BITMAP
#endif
class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
// ----------------------------------------------------------------------------
// wxBitmapButton: a button which shows bitmaps instead of the usual string.
// It has different bitmaps for different states (focused/disabled/pressed)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapButtonBase : public wxButton
class WXDLLIMPEXP_CORE wxBitmapButtonBase : public wxButton
{
public:
wxBitmapButtonBase()
{
#ifndef wxHAS_BUTTON_BITMAP
m_marginX =
m_marginY = 0;
#endif // wxHAS_BUTTON_BITMAP
}
// set the bitmaps
void SetBitmapLabel(const wxBitmap& bitmap)
{ m_bmpNormal = bitmap; OnSetBitmap(); }
void SetBitmapSelected(const wxBitmap& sel)
{ m_bmpSelected = sel; OnSetBitmap(); }
void SetBitmapFocus(const wxBitmap& focus)
{ m_bmpFocus = focus; OnSetBitmap(); }
void SetBitmapDisabled(const wxBitmap& disabled)
{ m_bmpDisabled = disabled; OnSetBitmap(); }
void SetBitmapHover(const wxBitmap& hover)
{ m_bmpHover = hover; OnSetBitmap(); }
bool Create(wxWindow *parent,
wxWindowID winid,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name)
{
// We use wxBU_NOTEXT to let the base class Create() know that we are
// not going to show the label: this is a hack needed for wxGTK where
// we can show both label and bitmap only with GTK 2.6+ but we always
// can show just one of them and this style allows us to choose which
// one we need.
//
// And we also use wxBU_EXACTFIT to avoid being resized up to the
// standard button size as this doesn't make sense for bitmap buttons
// which are not standard anyhow and should fit their bitmap size.
return wxButton::Create(parent, winid, "",
pos, size,
style | wxBU_NOTEXT | wxBU_EXACTFIT,
validator, name);
}
// Special creation function for a standard "Close" bitmap. It allows to
// simply create a close button with the image appropriate for the common
// platform.
static wxBitmapButton* NewCloseButton(wxWindow* parent, wxWindowID winid);
// retrieve the bitmaps
const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; }
const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; }
const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; }
const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
const wxBitmap& GetBitmapHover() const { return m_bmpHover; }
wxBitmap& GetBitmapLabel() { return m_bmpNormal; }
wxBitmap& GetBitmapSelected() { return m_bmpSelected; }
wxBitmap& GetBitmapFocus() { return m_bmpFocus; }
wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; }
wxBitmap& GetBitmapHover() { return m_bmpHover; }
// set/get the margins around the button
virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
int GetMarginX() const { return m_marginX; }
int GetMarginY() const { return m_marginY; }
virtual void SetMargins(int x, int y)
{
DoSetBitmapMargins(x, y);
}
int GetMarginX() const { return DoGetBitmapMargins().x; }
int GetMarginY() const { return DoGetBitmapMargins().y; }
// deprecated synonym for SetBitmapLabel()
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( void SetLabel(const wxBitmap& bitmap) );
wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap),
SetBitmapLabel(bitmap); )
// prevent virtual function hiding
virtual void SetLabel(const wxString& label)
@ -74,31 +91,36 @@ public:
#endif // WXWIN_COMPATIBILITY_2_6
protected:
#ifndef wxHAS_BUTTON_BITMAP
// function called when any of the bitmaps changes
virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
virtual wxBitmap DoGetBitmap(State which) const { return m_bitmaps[which]; }
virtual void DoSetBitmap(const wxBitmap& bitmap, State which)
{ m_bitmaps[which] = bitmap; OnSetBitmap(); }
virtual wxSize DoGetBitmapMargins() const
{
return wxSize(m_marginX, m_marginY);
}
virtual void DoSetBitmapMargins(int x, int y)
{
m_marginX = x;
m_marginY = y;
}
// the bitmaps for various states
wxBitmap m_bmpNormal,
m_bmpSelected,
m_bmpFocus,
m_bmpDisabled,
m_bmpHover;
wxBitmap m_bitmaps[State_Max];
// the margins around the bitmap
int m_marginX,
m_marginY;
#endif // !wxHAS_BUTTON_BITMAP
DECLARE_NO_COPY_CLASS(wxBitmapButtonBase)
wxDECLARE_NO_COPY_CLASS(wxBitmapButtonBase);
};
#if WXWIN_COMPATIBILITY_2_6
inline void wxBitmapButtonBase::SetLabel(const wxBitmap& bitmap)
{
SetBitmapLabel(bitmap);
}
#endif // WXWIN_COMPATIBILITY_2_6
#if defined(__WXUNIVERSAL__)
#include "wx/univ/bmpbuttn.h"
#elif defined(__WXMSW__)
@ -110,7 +132,7 @@ inline void wxBitmapButtonBase::SetLabel(const wxBitmap& bitmap)
#elif defined(__WXGTK__)
#include "wx/gtk1/bmpbuttn.h"
#elif defined(__WXMAC__)
#include "wx/mac/bmpbuttn.h"
#include "wx/osx/bmpbuttn.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/bmpbuttn.h"
#elif defined(__WXPM__)

View File

@ -0,0 +1,125 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/bmpcbox.h
// Purpose: wxBitmapComboBox base header
// Author: Jaakko Salli
// Modified by:
// Created: Aug-31-2006
// Copyright: (c) Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BMPCBOX_H_BASE_
#define _WX_BMPCBOX_H_BASE_
#include "wx/defs.h"
#if wxUSE_BITMAPCOMBOBOX
#include "wx/bitmap.h"
#include "wx/dynarray.h"
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxItemContainer;
// Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which
// wxBitmapComboBox implementation utilizes ownerdrawn combobox
// (either native or generic).
#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__)
#define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
class WXDLLIMPEXP_FWD_CORE wxDC;
#endif
extern WXDLLIMPEXP_DATA_ADV(const char) wxBitmapComboBoxNameStr[];
class WXDLLIMPEXP_ADV wxBitmapComboBoxBase
{
public:
// ctors and such
wxBitmapComboBoxBase() { Init(); }
virtual ~wxBitmapComboBoxBase() { }
// Sets the image for the given item.
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
#if !defined(wxBITMAPCOMBOBOX_OWNERDRAWN_BASED)
// Returns the image of the item with the given index.
virtual wxBitmap GetItemBitmap(unsigned int n) const = 0;
// Returns size of the image used in list
virtual wxSize GetBitmapSize() const = 0;
private:
void Init() {}
#else // wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
// Returns the image of the item with the given index.
virtual wxBitmap GetItemBitmap(unsigned int n) const;
// Returns size of the image used in list
virtual wxSize GetBitmapSize() const
{
return m_usedImgSize;
}
protected:
// Returns pointer to the combobox item container
virtual wxItemContainer* GetItemContainer() = 0;
// Return pointer to the owner-drawn combobox control
virtual wxWindow* GetControl() = 0;
// wxItemContainer functions
void BCBDoClear();
void BCBDoDeleteOneItem(unsigned int n);
void DoSetItemBitmap(unsigned int n, const wxBitmap& bitmap);
void DrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const;
void DrawItem(wxDC& dc, const wxRect& rect, int item, const wxString& text,
int flags) const;
wxCoord MeasureItem(size_t item) const;
// Returns true if image size was affected
virtual bool OnAddBitmap(const wxBitmap& bitmap);
// Recalculates amount of empty space needed in front of text
// in control itself. Returns number that can be passed to
// wxOwnerDrawnComboBox::SetCustomPaintWidth() and similar
// functions.
virtual int DetermineIndent();
void UpdateInternals();
wxArrayPtrVoid m_bitmaps; // Images associated with items
wxSize m_usedImgSize; // Size of bitmaps
int m_imgAreaWidth; // Width and height of area next to text field
int m_fontHeight;
int m_indent;
private:
void Init();
#endif // !wxBITMAPCOMBOBOX_OWNERDRAWN_BASED/wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
};
#if defined(__WXUNIVERSAL__)
#include "wx/generic/bmpcbox.h"
#elif defined(__WXMSW__)
#include "wx/msw/bmpcbox.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/bmpcbox.h"
#else
#include "wx/generic/bmpcbox.h"
#endif
#endif // wxUSE_BITMAPCOMBOBOX
#endif // _WX_BMPCBOX_H_BASE_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 19.08.03
// RCS-ID: $Id: bookctrl.h 49563 2007-10-31 20:46:21Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -22,11 +21,12 @@
#include "wx/control.h"
#include "wx/dynarray.h"
#include "wx/withimages.h"
WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages);
class WXDLLIMPEXP_FWD_CORE wxImageList;
class WXDLLIMPEXP_FWD_CORE wxBookCtrlBaseEvent;
class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent;
// ----------------------------------------------------------------------------
// constants
@ -54,7 +54,8 @@ enum
// wxBookCtrlBase
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBookCtrlBase : public wxControl
class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl,
public wxWithImages
{
public:
// construction
@ -85,9 +86,6 @@ public:
long style = 0,
const wxString& name = wxEmptyString);
// dtor
virtual ~wxBookCtrlBase();
// accessors
// ---------
@ -96,8 +94,7 @@ public:
virtual size_t GetPageCount() const { return m_pages.size(); }
// get the panel which represents the given page
wxWindow *GetPage(size_t n) { return m_pages[n]; }
wxWindow *GetPage(size_t n) const { return m_pages[n]; }
virtual wxWindow *GetPage(size_t n) const { return m_pages[n]; }
// get the current page or NULL if none
wxWindow *GetCurrentPage() const
@ -107,7 +104,7 @@ public:
}
// get the currently selected page or wxNOT_FOUND if none
virtual int GetSelection() const = 0;
virtual int GetSelection() const { return m_selection; }
// set/get the title of a page
virtual bool SetPageText(size_t n, const wxString& strText) = 0;
@ -118,15 +115,6 @@ public:
// images belong to the same image list)
// ---------------------------------------------------------------------
// sets the image list to use, it is *not* deleted by the control
virtual void SetImageList(wxImageList *imageList);
// as SetImageList() but we will delete the image list ourselves
void AssignImageList(wxImageList *imageList);
// get pointer (may be NULL) to the associated image list
wxImageList* GetImageList() const { return m_imageList; }
// sets/returns item's image index in the current image list
virtual int GetPageImage(size_t n) const = 0;
virtual bool SetPageImage(size_t n, int imageId) = 0;
@ -138,8 +126,14 @@ public:
// resize the notebook so that all pages will have the specified size
virtual void SetPageSize(const wxSize& size);
// return the size of the area needed to accommodate the controller
wxSize GetControllerSize() const;
// calculate the size of the control from the size of its page
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0;
//
// by default this simply returns size enough to fit both the page and the
// controller
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
// get/set size of area between book control area and page area
unsigned int GetInternalBorder() const { return m_internalBorder; }
@ -159,6 +153,7 @@ public:
// returns the sizer containing the control, if any
wxSizer* GetControlSizer() const { return m_controlSizer; }
// operations
// ----------
@ -175,6 +170,7 @@ public:
// remove all pages and delete them
virtual bool DeleteAllPages()
{
m_selection = wxNOT_FOUND;
DoInvalidateBestSize();
WX_CLEAR_ARRAY(m_pages);
return true;
@ -184,7 +180,7 @@ public:
virtual bool AddPage(wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = -1)
int imageId = NO_IMAGE)
{
DoInvalidateBestSize();
return InsertPage(GetPageCount(), page, text, bSelect, imageId);
@ -195,10 +191,10 @@ public:
wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = -1) = 0;
int imageId = NO_IMAGE) = 0;
// set the currently selected page, return the index of the previously
// selected one (or -1 on error)
// selected one (or wxNOT_FOUND on error)
//
// NB: this function will generate PAGE_CHANGING/ED events
virtual int SetSelection(size_t n) = 0;
@ -211,13 +207,16 @@ public:
void AdvanceSelection(bool forward = true)
{
int nPage = GetNextPage(forward);
if ( nPage != -1 )
if ( nPage != wxNOT_FOUND )
{
// cast is safe because of the check above
SetSelection((size_t)nPage);
}
}
// return the index of the given page or wxNOT_FOUND
int FindPage(const wxWindow* page) const;
// hit test: returns which page is hit and, optionally, where (icon, label)
virtual int HitTest(const wxPoint& WXUNUSED(pt),
long * WXUNUSED(flags) = NULL) const
@ -229,6 +228,11 @@ public:
// we do have multiple pages
virtual bool HasMultiplePages() const { return true; }
// we don't want focus for ourselves
virtual bool AcceptsFocus() const { return false; }
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const { return false; }
protected:
// flags for DoSetSelection()
@ -237,6 +241,24 @@ protected:
SetSelection_SendEvent = 1
};
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
// After the insertion of the page in the method InsertPage, calling this
// method sets the selection to the given page or the first one if there is
// still no selection. The "selection changed" event is sent only if
// bSelect is true, so when it is false, no event is sent even if the
// selection changed from wxNOT_FOUND to 0 when inserting the first page.
//
// Returns true if the selection was set to the specified page (explicitly
// because of bSelect == true or implicitly because it's the first page) or
// false otherwise.
bool DoSetSelectionAfterInsertion(size_t n, bool bSelect);
// Update the selection after removing the page at the given index,
// typically called from the derived class overridden DoRemovePage().
void DoSetSelectionAfterRemoval(size_t n);
// set the selection to the given page, sending the events (which can
// possibly prevent the page change from taking place) if SendEvent flag is
// included
@ -252,15 +274,20 @@ protected:
{ wxFAIL_MSG(wxT("Override this function!")); }
// create a new "page changing" event
virtual wxBookCtrlBaseEvent* CreatePageChangingEvent() const
virtual wxBookCtrlEvent* CreatePageChangingEvent() const
{ wxFAIL_MSG(wxT("Override this function!")); return NULL; }
// modify the event created by CreatePageChangingEvent() to "page changed"
// event, usually by just calling SetEventType() on it
virtual void MakeChangedEvent(wxBookCtrlBaseEvent& WXUNUSED(event))
virtual void MakeChangedEvent(wxBookCtrlEvent& WXUNUSED(event))
{ wxFAIL_MSG(wxT("Override this function!")); }
// The derived class also may override the following method, also called
// from DoSetSelection(), to show/hide pages differently.
virtual void DoShowPage(wxWindow* page, bool show) { page->Show(show); }
// Should we accept NULL page pointers in Add/InsertPage()?
//
// Default is no but derived classes may override it if they can treat NULL
@ -268,7 +295,11 @@ protected:
// having nodes without any associated page)
virtual bool AllowNullPage() const { return false; }
// remove the page and return a pointer to it
// Remove the page and return a pointer to it.
//
// It also needs to update the current selection if necessary, i.e. if the
// page being removed comes before the selected one and the helper method
// DoSetSelectionAfterRemoval() can be used for this.
virtual wxWindow *DoRemovePage(size_t page) = 0;
// our best size is the size which fits all our pages
@ -278,7 +309,7 @@ protected:
int GetNextPage(bool forward) const;
// Lay out controls
void DoSize();
virtual void DoSize();
// This method also invalidates the size of the controller and should be
// called instead of just InvalidateBestSize() whenever pages are added or
@ -294,17 +325,10 @@ protected:
// the array of all pages of this control
wxArrayPages m_pages;
// the associated image list or NULL
wxImageList *m_imageList;
// true if we must delete m_imageList
bool m_ownsImageList;
// get the page area
wxRect GetPageRect() const;
virtual wxRect GetPageRect() const;
// event handlers
virtual wxSize GetControllerSize() const;
void OnSize(wxSizeEvent& event);
// controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook)
@ -319,6 +343,11 @@ protected:
// the margin around the choice control
int m_controlMargin;
// The currently selected page (in range 0..m_pages.size()-1 inclusive) or
// wxNOT_FOUND if none (this can normally only be the case for an empty
// control without any pages).
int m_selection;
private:
// common part of all ctors
@ -328,68 +357,81 @@ private:
unsigned int m_internalBorder;
DECLARE_ABSTRACT_CLASS(wxBookCtrlBase)
DECLARE_NO_COPY_CLASS(wxBookCtrlBase)
wxDECLARE_NO_COPY_CLASS(wxBookCtrlBase);
DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
// wxBookCtrlBaseEvent: page changing events generated by derived classes
// wxBookCtrlEvent: page changing events generated by book classes
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBookCtrlBaseEvent : public wxNotifyEvent
class WXDLLIMPEXP_CORE wxBookCtrlEvent : public wxNotifyEvent
{
public:
wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
int nSel = -1, int nOldSel = -1)
wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
: wxNotifyEvent(commandType, winid)
{
m_nSel = nSel;
m_nOldSel = nOldSel;
}
wxBookCtrlBaseEvent(const wxBookCtrlBaseEvent& event)
wxBookCtrlEvent(const wxBookCtrlEvent& event)
: wxNotifyEvent(event)
{
m_nSel = event.m_nSel;
m_nOldSel = event.m_nOldSel;
}
virtual wxEvent *Clone() const { return new wxBookCtrlEvent(*this); }
// accessors
// the currently selected page (-1 if none)
// the currently selected page (wxNOT_FOUND if none)
int GetSelection() const { return m_nSel; }
void SetSelection(int nSel) { m_nSel = nSel; }
// the page that was selected before the change (-1 if none)
// the page that was selected before the change (wxNOT_FOUND if none)
int GetOldSelection() const { return m_nOldSel; }
void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
private:
int m_nSel, // currently selected page
m_nOldSel; // previously selected page
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxBookCtrlEvent)
};
typedef void (wxEvtHandler::*wxBookCtrlEventFunction)(wxBookCtrlEvent&);
#define wxBookCtrlEventHandler(func) \
wxEVENT_HANDLER_CAST(wxBookCtrlEventFunction, func)
// obsolete name, defined for compatibility only
#define wxBookCtrlBaseEvent wxBookCtrlEvent
// make a default book control for given platform
#if wxUSE_NOTEBOOK
// dedicated to majority of desktops
#include "wx/notebook.h"
#define wxBookCtrl wxNotebook
#define wxBookCtrlEvent wxNotebookEvent
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
#define wxEVT_BOOKCTRL_PAGE_CHANGED wxEVT_NOTEBOOK_PAGE_CHANGED
#define wxEVT_BOOKCTRL_PAGE_CHANGING wxEVT_NOTEBOOK_PAGE_CHANGING
#define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn)
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn)
#define wxBookctrlEventHandler(func) wxNotebookEventHandler(func)
#else
// dedicated to Smartphones
#include "wx/choicebk.h"
#define wxBookCtrl wxChoicebook
#define wxBookCtrlEvent wxChoicebookEvent
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
#define wxEVT_BOOKCTRL_PAGE_CHANGED wxEVT_CHOICEBOOK_PAGE_CHANGED
#define wxEVT_BOOKCTRL_PAGE_CHANGING wxEVT_CHOICEBOOK_PAGE_CHANGING
#define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn)
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
#define wxBookctrlEventHandler(func) wxChoicebookEventHandler(func)
#endif
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_BOOKCTRL_PAGE_CHANGED
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_BOOKCTRL_PAGE_CHANGING
#if WXWIN_COMPATIBILITY_2_6
#define wxBC_TOP wxBK_TOP
#define wxBC_BOTTOM wxBK_BOTTOM

View File

@ -4,7 +4,6 @@
// Author: Julian Smart
// Modified by:
// Created:
// RCS-ID: $Id: brush.h 40865 2006-08-27 09:42:42Z VS $
// Copyright: Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -15,22 +14,62 @@
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/gdiobj.h"
#include "wx/gdicmn.h" // for wxGDIObjListBase
// NOTE: these values cannot be combined together!
enum wxBrushStyle
{
wxBRUSHSTYLE_INVALID = -1,
wxBRUSHSTYLE_SOLID = wxSOLID,
wxBRUSHSTYLE_TRANSPARENT = wxTRANSPARENT,
wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
wxBRUSHSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
wxBRUSHSTYLE_STIPPLE = wxSTIPPLE,
wxBRUSHSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
wxBRUSHSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
wxBRUSHSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
wxBRUSHSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS,
wxBRUSHSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
wxBRUSHSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
wxBRUSHSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST,
wxBRUSHSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST
};
// wxBrushBase
class WXDLLEXPORT wxBrushBase: public wxGDIObject
class WXDLLIMPEXP_CORE wxBrushBase: public wxGDIObject
{
public:
virtual ~wxBrushBase() { }
virtual int GetStyle() const = 0;
virtual void SetColour(const wxColour& col) = 0;
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
virtual void SetStyle(wxBrushStyle style) = 0;
virtual void SetStipple(const wxBitmap& stipple) = 0;
virtual wxColour GetColour() const = 0;
virtual wxBrushStyle GetStyle() const = 0;
virtual wxBitmap *GetStipple() const = 0;
virtual bool IsHatch() const
{ return (GetStyle()>=wxFIRST_HATCH) && (GetStyle()<=wxLAST_HATCH); }
{ return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH); }
// Convenient helpers for testing whether the brush is a transparent one:
// unlike GetStyle() == wxBRUSHSTYLE_TRANSPARENT, they work correctly even
// if the brush is invalid (they both return false in this case).
bool IsTransparent() const
{
return IsOk() && GetStyle() == wxBRUSHSTYLE_TRANSPARENT;
}
bool IsNonTransparent() const
{
return IsOk() && GetStyle() != wxBRUSHSTYLE_TRANSPARENT;
}
};
#if defined(__WXPALMOS__)
#include "wx/palmos/brush.h"
#elif defined(__WXMSW__)
#if defined(__WXMSW__)
#include "wx/msw/brush.h"
#elif defined(__WXMOTIF__) || defined(__WXX11__)
#include "wx/x11/brush.h"
@ -38,17 +77,60 @@ public:
#include "wx/gtk/brush.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/brush.h"
#elif defined(__WXMGL__)
#include "wx/mgl/brush.h"
#elif defined(__WXDFB__)
#include "wx/dfb/brush.h"
#elif defined(__WXMAC__)
#include "wx/mac/brush.h"
#include "wx/osx/brush.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/brush.h"
#elif defined(__WXPM__)
#include "wx/os2/brush.h"
#endif
class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase
{
public:
wxBrush *FindOrCreateBrush(const wxColour& colour,
wxBrushStyle style = wxBRUSHSTYLE_SOLID);
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxBrush *FindOrCreateBrush(const wxColour& colour, int style)
{ return FindOrCreateBrush(colour, (wxBrushStyle)style); }
#endif
// _WX_BRUSH_H_BASE_
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( void AddBrush(wxBrush*) );
wxDEPRECATED( void RemoveBrush(wxBrush*) );
#endif
};
extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList;
// provide comparison operators to allow code such as
//
// if ( brush.GetStyle() == wxTRANSPARENT )
//
// to compile without warnings which it would otherwise provoke from some
// compilers as it compares elements of different enums
#if FUTURE_WXWIN_COMPATIBILITY_3_0
// Unfortunately some compilers have ambiguity issues when enum comparisons are
// overloaded so we have to disable the overloads in this case, see
// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t)
{
return static_cast<int>(s) == static_cast<int>(t);
}
inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t)
{
return !(s == t);
}
#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM
#endif // FUTURE_WXWIN_COMPATIBILITY_3_0
#endif // _WX_BRUSH_H_BASE_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 12.04.99
// RCS-ID: $Id: buffer.h 61872 2009-09-09 22:37:05Z VZ $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -12,144 +11,426 @@
#ifndef _WX_BUFFER_H
#define _WX_BUFFER_H
#include "wx/wxchar.h"
#include "wx/chartype.h"
#include "wx/wxcrtbase.h"
#include <stdlib.h> // malloc() and free()
class WXDLLIMPEXP_FWD_BASE wxCStrData;
// ----------------------------------------------------------------------------
// Special classes for (wide) character strings: they use malloc/free instead
// of new/delete
// ----------------------------------------------------------------------------
#define DEFINE_BUFFER(classname, chartype, strdupfunc) \
class WXDLLIMPEXP_BASE classname \
{ \
public: \
classname(const chartype *str = NULL) \
: m_str(str ? strdupfunc(str) : NULL) \
{ \
} \
\
classname(size_t len) \
: m_str((chartype *)malloc((len + 1)*sizeof(chartype))) \
{ \
m_str[len] = (chartype)0; \
} \
\
/* no need to check for NULL, free() does it */ \
~classname() { free(m_str); } \
\
/* \
WARNING: \
\
the copy ctor and assignment operators change the passed in object \
even although it is declared as "const", so: \
\
a) it shouldn't be really const \
b) you shouldn't use it afterwards (or know that it was reset) \
\
This is very ugly but is unfortunately needed to make the normal use\
of classname buffer objects possible and is very similar to what \
std::auto_ptr<> does (as if it were an excuse...) \
*/ \
\
/* \
because of the remark above, release() is declared const even if it \
isn't really const \
*/ \
chartype *release() const \
{ \
chartype *p = m_str; \
((classname *)this)->m_str = NULL; \
return p; \
} \
\
void reset() \
{ \
free(m_str); \
m_str = NULL; \
} \
\
classname(const classname& src) \
: m_str(src.release()) \
{ \
} \
\
classname& operator=(const chartype *str) \
{ \
free(m_str); \
m_str = str ? strdupfunc(str) : NULL; \
return *this; \
} \
\
classname& operator=(const classname& src) \
{ \
free(m_str); \
m_str = src.release(); \
\
return *this; \
} \
\
bool extend(size_t len) \
{ \
chartype * \
str = (chartype *)realloc(m_str, (len + 1)*sizeof(chartype)); \
if ( !str ) \
return false; \
\
m_str = str; \
\
return true; \
} \
\
chartype *data() { return m_str; } \
const chartype *data() const { return m_str; } \
operator const chartype *() const { return m_str; } \
chartype operator[](size_t n) const { return m_str[n]; } \
\
private: \
chartype *m_str; \
}
// helpers used by wxCharTypeBuffer
namespace wxPrivate
{
#if wxABI_VERSION >= 20804
// needed for wxString::char_str() and wchar_str()
#define DEFINE_WRITABLE_BUFFER(classname, baseclass, chartype) \
class WXDLLIMPEXP_BASE classname : public baseclass \
{ \
public: \
classname(const baseclass& src) : baseclass(src) {} \
classname(const chartype *str = NULL) : baseclass(str) {} \
\
operator chartype*() { return this->data(); } \
}
#endif // wxABI_VERSION >= 20804
struct UntypedBufferData
{
enum Kind
{
Owned,
NonOwned
};
DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA);
#if wxABI_VERSION >= 20804
DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char);
#endif
UntypedBufferData(void *str, size_t len, Kind kind = Owned)
: m_str(str), m_length(len), m_ref(1), m_owned(kind == Owned) {}
#if wxUSE_WCHAR_T
~UntypedBufferData()
{
if ( m_owned )
free(m_str);
}
DEFINE_BUFFER(wxWCharBuffer, wchar_t, wxStrdupW);
#if wxABI_VERSION >= 20804
DEFINE_WRITABLE_BUFFER(wxWritableWCharBuffer, wxWCharBuffer, wchar_t);
#endif
void *m_str;
size_t m_length;
#endif // wxUSE_WCHAR_T
// "short" to have sizeof(Data)=12 on 32bit archs
unsigned short m_ref;
bool m_owned;
};
// NB: this is defined in string.cpp and not the (non-existent) buffer.cpp
WXDLLIMPEXP_BASE UntypedBufferData * GetUntypedNullData();
} // namespace wxPrivate
// Reference-counted character buffer for storing string data. The buffer
// is only valid for as long as the "parent" object that provided the data
// is valid; see wxCharTypeBuffer<T> for persistent variant.
template <typename T>
class wxScopedCharTypeBuffer
{
public:
typedef T CharType;
wxScopedCharTypeBuffer()
{
m_data = GetNullData();
}
// Creates "non-owned" buffer, i.e. 'str' is not owned by the buffer
// and doesn't get freed by dtor. Used e.g. to point to wxString's internal
// storage.
static
const wxScopedCharTypeBuffer CreateNonOwned(const CharType *str,
size_t len = wxNO_LEN)
{
if ( len == wxNO_LEN )
len = wxStrlen(str);
wxScopedCharTypeBuffer buf;
if ( str )
buf.m_data = new Data(const_cast<CharType*>(str), len, Data::NonOwned);
return buf;
}
// Creates "owned" buffer, i.e. takes over ownership of 'str' and frees it
// in dtor (if ref.count reaches 0).
static
const wxScopedCharTypeBuffer CreateOwned(CharType *str,
size_t len = wxNO_LEN )
{
if ( len == wxNO_LEN )
len = wxStrlen(str);
wxScopedCharTypeBuffer buf;
if ( str )
buf.m_data = new Data(str, len);
return buf;
}
wxScopedCharTypeBuffer(const wxScopedCharTypeBuffer& src)
{
m_data = src.m_data;
IncRef();
}
wxScopedCharTypeBuffer& operator=(const wxScopedCharTypeBuffer& src)
{
if ( &src == this )
return *this;
DecRef();
m_data = src.m_data;
IncRef();
return *this;
}
~wxScopedCharTypeBuffer()
{
DecRef();
}
// NB: this method is only const for backward compatibility. It used to
// be needed for auto_ptr-like semantics of the copy ctor, but now
// that ref-counting is used, it's not really needed.
CharType *release() const
{
if ( m_data == GetNullData() )
return NULL;
wxASSERT_MSG( m_data->m_owned, wxT("can't release non-owned buffer") );
wxASSERT_MSG( m_data->m_ref == 1, wxT("can't release shared buffer") );
CharType * const p = m_data->Get();
wxScopedCharTypeBuffer *self = const_cast<wxScopedCharTypeBuffer*>(this);
self->m_data->Set(NULL, 0);
self->DecRef();
return p;
}
void reset()
{
DecRef();
}
CharType *data() { return m_data->Get(); }
const CharType *data() const { return m_data->Get(); }
operator const CharType *() const { return data(); }
CharType operator[](size_t n) const { return data()[n]; }
size_t length() const { return m_data->m_length; }
protected:
// reference-counted data
struct Data : public wxPrivate::UntypedBufferData
{
Data(CharType *str, size_t len, Kind kind = Owned)
: wxPrivate::UntypedBufferData(str, len, kind)
{
}
CharType *Get() const { return static_cast<CharType *>(m_str); }
void Set(CharType *str, size_t len)
{
m_str = str;
m_length = len;
}
};
// placeholder for NULL string, to simplify this code
static Data *GetNullData()
{
return static_cast<Data *>(wxPrivate::GetUntypedNullData());
}
void IncRef()
{
if ( m_data == GetNullData() ) // exception, not ref-counted
return;
m_data->m_ref++;
}
void DecRef()
{
if ( m_data == GetNullData() ) // exception, not ref-counted
return;
if ( --m_data->m_ref == 0 )
delete m_data;
m_data = GetNullData();
}
// sets this object to a be copy of 'other'; if 'src' is non-owned,
// a deep copy is made and 'this' will contain new instance of the data
void MakeOwnedCopyOf(const wxScopedCharTypeBuffer& src)
{
this->DecRef();
if ( src.m_data == this->GetNullData() )
{
this->m_data = this->GetNullData();
}
else if ( src.m_data->m_owned )
{
this->m_data = src.m_data;
this->IncRef();
}
else
{
// if the scoped buffer had non-owned data, we have to make
// a copy here, because src.m_data->m_str is valid only for as long
// as 'src' exists
this->m_data = new Data
(
StrCopy(src.data(), src.length()),
src.length()
);
}
}
static CharType *StrCopy(const CharType *src, size_t len)
{
CharType *dst = (CharType*)malloc(sizeof(CharType) * (len + 1));
if ( dst )
memcpy(dst, src, sizeof(CharType) * (len + 1));
return dst;
}
protected:
Data *m_data;
};
typedef wxScopedCharTypeBuffer<char> wxScopedCharBuffer;
typedef wxScopedCharTypeBuffer<wchar_t> wxScopedWCharBuffer;
// this buffer class always stores data in "owned" (persistent) manner
template <typename T>
class wxCharTypeBuffer : public wxScopedCharTypeBuffer<T>
{
protected:
typedef typename wxScopedCharTypeBuffer<T>::Data Data;
public:
typedef T CharType;
wxCharTypeBuffer(const CharType *str = NULL, size_t len = wxNO_LEN)
{
if ( str )
{
if ( len == wxNO_LEN )
len = wxStrlen(str);
this->m_data = new Data(this->StrCopy(str, len), len);
}
else
{
this->m_data = this->GetNullData();
}
}
wxCharTypeBuffer(size_t len)
{
CharType* const str = (CharType *)malloc((len + 1)*sizeof(CharType));
if ( str )
{
str[len] = (CharType)0;
// There is a potential memory leak here if new throws because it
// fails to allocate Data, we ought to use new(nothrow) here, but
// this might fail to compile under some platforms so until this
// can be fully tested, just live with this (rather unlikely, as
// Data is a small object) potential leak.
this->m_data = new Data(str, len);
}
else
{
this->m_data = this->GetNullData();
}
}
wxCharTypeBuffer(const wxCharTypeBuffer& src)
: wxScopedCharTypeBuffer<T>(src) {}
wxCharTypeBuffer& operator=(const CharType *str)
{
this->DecRef();
if ( str )
this->m_data = new Data(wxStrdup(str), wxStrlen(str));
return *this;
}
wxCharTypeBuffer& operator=(const wxCharTypeBuffer& src)
{
wxScopedCharTypeBuffer<T>::operator=(src);
return *this;
}
wxCharTypeBuffer(const wxScopedCharTypeBuffer<T>& src)
{
this->MakeOwnedCopyOf(src);
}
wxCharTypeBuffer& operator=(const wxScopedCharTypeBuffer<T>& src)
{
MakeOwnedCopyOf(src);
return *this;
}
bool extend(size_t len)
{
wxASSERT_MSG( this->m_data->m_owned, "cannot extend non-owned buffer" );
wxASSERT_MSG( this->m_data->m_ref == 1, "can't extend shared buffer" );
CharType *str =
(CharType *)realloc(this->data(), (len + 1) * sizeof(CharType));
if ( !str )
return false;
// For consistency with the ctor taking just the length, NUL-terminate
// the buffer.
str[len] = (CharType)0;
if ( this->m_data == this->GetNullData() )
{
this->m_data = new Data(str, len);
}
else
{
this->m_data->Set(str, len);
this->m_data->m_owned = true;
}
return true;
}
void shrink(size_t len)
{
wxASSERT_MSG( this->m_data->m_owned, "cannot shrink non-owned buffer" );
wxASSERT_MSG( this->m_data->m_ref == 1, "can't shrink shared buffer" );
wxASSERT( len <= this->length() );
this->m_data->m_length = len;
this->data()[len] = 0;
}
};
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer<char> )
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<char> )
class wxCharBuffer : public wxCharTypeBuffer<char>
{
public:
typedef wxCharTypeBuffer<char> wxCharTypeBufferBase;
typedef wxScopedCharTypeBuffer<char> wxScopedCharTypeBufferBase;
wxCharBuffer(const wxCharTypeBufferBase& buf)
: wxCharTypeBufferBase(buf) {}
wxCharBuffer(const wxScopedCharTypeBufferBase& buf)
: wxCharTypeBufferBase(buf) {}
wxCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {}
wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
wxCharBuffer(const wxCStrData& cstr);
};
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer<wchar_t> )
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<wchar_t> )
class wxWCharBuffer : public wxCharTypeBuffer<wchar_t>
{
public:
typedef wxCharTypeBuffer<wchar_t> wxCharTypeBufferBase;
typedef wxScopedCharTypeBuffer<wchar_t> wxScopedCharTypeBufferBase;
wxWCharBuffer(const wxCharTypeBufferBase& buf)
: wxCharTypeBufferBase(buf) {}
wxWCharBuffer(const wxScopedCharTypeBufferBase& buf)
: wxCharTypeBufferBase(buf) {}
wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {}
wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
wxWCharBuffer(const wxCStrData& cstr);
};
// wxCharTypeBuffer<T> implicitly convertible to T*
template <typename T>
class wxWritableCharTypeBuffer : public wxCharTypeBuffer<T>
{
public:
typedef typename wxScopedCharTypeBuffer<T>::CharType CharType;
wxWritableCharTypeBuffer(const wxScopedCharTypeBuffer<T>& src)
: wxCharTypeBuffer<T>(src) {}
// FIXME-UTF8: this won't be needed after converting mb_str()/wc_str() to
// always return a buffer
// + we should derive this class from wxScopedCharTypeBuffer
// then
wxWritableCharTypeBuffer(const CharType *str = NULL)
: wxCharTypeBuffer<T>(str) {}
operator CharType*() { return this->data(); }
};
typedef wxWritableCharTypeBuffer<char> wxWritableCharBuffer;
typedef wxWritableCharTypeBuffer<wchar_t> wxWritableWCharBuffer;
#undef DEFINE_BUFFER
#undef DEFINE_WRITABLE_BUFFER
#if wxUSE_UNICODE
typedef wxWCharBuffer wxWxCharBuffer;
#define wxWxCharBuffer wxWCharBuffer
#define wxMB2WXbuf wxWCharBuffer
#define wxWX2MBbuf wxCharBuffer
#define wxWC2WXbuf wxChar*
#define wxWX2WCbuf wxChar*
#if wxUSE_UNICODE_WCHAR
#define wxWC2WXbuf wxChar*
#define wxWX2WCbuf wxChar*
#elif wxUSE_UNICODE_UTF8
#define wxWC2WXbuf wxWCharBuffer
#define wxWX2WCbuf wxWCharBuffer
#endif
#else // ANSI
typedef wxCharBuffer wxWxCharBuffer;
#define wxWxCharBuffer wxCharBuffer
#define wxMB2WXbuf wxChar*
#define wxWX2MBbuf wxChar*
@ -170,7 +451,7 @@ public:
friend class wxMemoryBuffer;
// everyting is private as it can only be used by wxMemoryBuffer
// everything is private as it can only be used by wxMemoryBuffer
private:
wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize)
: m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0)
@ -202,6 +483,21 @@ private:
delete this;
}
void *release()
{
if ( m_data == NULL )
return NULL;
wxASSERT_MSG( m_ref == 1, "can't release shared buffer" );
void *p = m_data;
m_data = NULL;
m_len =
m_size = 0;
return p;
}
// the buffer containing the data
void *m_data;
@ -215,7 +511,7 @@ private:
// the reference count
size_t m_ref;
DECLARE_NO_COPY_CLASS(wxMemoryBufferData)
wxDECLARE_NO_COPY_CLASS(wxMemoryBufferData);
};
@ -241,9 +537,12 @@ public:
wxMemoryBuffer& operator=(const wxMemoryBuffer& src)
{
m_bufdata->DecRef();
m_bufdata = src.m_bufdata;
m_bufdata->IncRef();
if (&src != this)
{
m_bufdata->DecRef();
m_bufdata = src.m_bufdata;
m_bufdata->IncRef();
}
return *this;
}
@ -253,6 +552,8 @@ public:
size_t GetBufSize() const { return m_bufdata->m_size; }
size_t GetDataLen() const { return m_bufdata->m_len; }
bool IsEmpty() const { return GetDataLen() == 0; }
void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); }
void SetDataLen(size_t len)
{
@ -260,6 +561,8 @@ public:
m_bufdata->m_len = len;
}
void Clear() { SetDataLen(0); }
// Ensure the buffer is big enough and return a pointer to it
void *GetWriteBuf(size_t sizeNeeded)
{
@ -301,6 +604,13 @@ public:
operator const char *() const { return (const char*)GetData(); }
// gives up ownership of data, returns the pointer; after this call,
// data isn't freed by the buffer and its content is resent to empty
void *release()
{
return m_bufdata->release();
}
private:
wxMemoryBufferData* m_bufdata;
};

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin, Vaclav Slavik
// Modified by:
// Created: 07.05.02
// RCS-ID: $Id: build.h 35858 2005-10-09 15:48:42Z MBN $
// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -15,7 +14,7 @@
#include "wx/version.h"
// NB: This file contains macros for checking binary compatibility of libraries
// in multilib buildm, plugins and user components.
// in multilib builds, plugins and user components.
// The WX_BUILD_OPTIONS_SIGNATURE macro expands into string that should
// uniquely identify binary compatible builds: i.e. if two builds of the
// library are binary compatible, their signature string should be the
@ -42,14 +41,10 @@
__WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z)
#endif
#ifdef __WXDEBUG__
#define __WX_BO_DEBUG "debug"
#else
#define __WX_BO_DEBUG "no debug"
#endif
#if wxUSE_UNICODE
#define __WX_BO_UNICODE "Unicode"
#if wxUSE_UNICODE_UTF8
#define __WX_BO_UNICODE "UTF-8"
#elif wxUSE_UNICODE_WCHAR
#define __WX_BO_UNICODE "wchar_t"
#else
#define __WX_BO_UNICODE "ANSI"
#endif
@ -59,13 +54,16 @@
#if defined(__GXX_ABI_VERSION)
#define __WX_BO_COMPILER \
",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION)
#elif defined(__INTEL_COMPILER)
#define __WX_BO_COMPILER ",Intel C++"
#elif defined(__GNUG__)
#define __WX_BO_COMPILER ",GCC " \
__WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__)
#elif defined(__VISUALC__)
#define __WX_BO_COMPILER ",Visual C++"
#define __WX_BO_COMPILER ",Visual C++ " __WX_BO_STRINGIZE(_MSC_VER)
#elif defined(__INTEL_COMPILER)
// Notice that this must come after MSVC check as ICC under Windows is
// ABI-compatible with the corresponding version of the MSVC and we want to
// allow using it compile the application code using MSVC-built DLLs.
#define __WX_BO_COMPILER ",Intel C++"
#elif defined(__BORLANDC__)
#define __WX_BO_COMPILER ",Borland C++"
#elif defined(__DIGITALMARS__)
@ -77,19 +75,19 @@
#endif
// WXWIN_COMPATIBILITY macros affect presence of virtual functions
#if WXWIN_COMPATIBILITY_2_4
#define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4"
#else
#define __WX_BO_WXWIN_COMPAT_2_4
#endif
#if WXWIN_COMPATIBILITY_2_6
#define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6"
#else
#define __WX_BO_WXWIN_COMPAT_2_6
#endif
#if WXWIN_COMPATIBILITY_2_8
#define __WX_BO_WXWIN_COMPAT_2_8 ",compatible with 2.8"
#else
#define __WX_BO_WXWIN_COMPAT_2_8
#endif
// deriving wxWin containers from STL ones changes them completely:
#if wxUSE_STL
#if wxUSE_STD_CONTAINERS
#define __WX_BO_STL ",STL containers"
#else
#define __WX_BO_STL ",wx containers"
@ -98,10 +96,10 @@
// This macro is passed as argument to wxConsoleApp::CheckBuildOptions()
#define WX_BUILD_OPTIONS_SIGNATURE \
__WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \
" (" __WX_BO_DEBUG "," __WX_BO_UNICODE \
" (" __WX_BO_UNICODE \
__WX_BO_COMPILER \
__WX_BO_STL \
__WX_BO_WXWIN_COMPAT_2_4 __WX_BO_WXWIN_COMPAT_2_6 \
__WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 \
")"
@ -110,7 +108,7 @@
// ----------------------------------------------------------------------------
// Use this macro to check build options. Adding it to a file in DLL will
// ensure that the DLL checks build options in same way IMPLEMENT_APP() does.
// ensure that the DLL checks build options in same way wxIMPLEMENT_APP() does.
#define WX_CHECK_BUILD_OPTIONS(libName) \
static struct wxBuildOptionsChecker \
{ \
@ -122,28 +120,4 @@
} gs_buildOptionsCheck;
#if WXWIN_COMPATIBILITY_2_4
// ----------------------------------------------------------------------------
// wxBuildOptions
// ----------------------------------------------------------------------------
// NB: Don't use this class in new code, it relies on the ctor being always
// inlined. WX_BUILD_OPTIONS_SIGNATURE always works.
class wxBuildOptions
{
public:
// the ctor must be inline to get the compilation settings of the code
// which included this header
wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE) {}
private:
const char *m_signature;
// actually only CheckBuildOptions() should be our friend but well...
friend class wxAppConsole;
};
#endif // WXWIN_COMPATIBILITY_2_4
#endif // _WX_BUILD_H_

View File

@ -3,7 +3,6 @@
// Purpose: Information window (when app is busy)
// Author: Vaclav Slavik
// Copyright: (c) 1999 Vaclav Slavik
// RCS-ID: $Id: busyinfo.h 37158 2006-01-26 15:40:46Z ABX $
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
// Author: Vadim Zetlin
// Modified by:
// Created: 15.08.00
// RCS-ID: $Id: button.h 49563 2007-10-31 20:46:21Z VZ $
// Copyright: (c) Vadim Zetlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -14,70 +13,37 @@
#include "wx/defs.h"
// ----------------------------------------------------------------------------
// wxButton flags shared with other classes
// ----------------------------------------------------------------------------
#if wxUSE_TOGGLEBTN || wxUSE_BUTTON
// These flags affect label alignment
#define wxBU_LEFT 0x0040
#define wxBU_TOP 0x0080
#define wxBU_RIGHT 0x0100
#define wxBU_BOTTOM 0x0200
#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM )
#endif
#if wxUSE_BUTTON
// ----------------------------------------------------------------------------
// wxButton specific flags
// ----------------------------------------------------------------------------
#include "wx/anybutton.h"
// These two flags are obsolete
#define wxBU_NOAUTODRAW 0x0000
#define wxBU_AUTODRAW 0x0004
// by default, the buttons will be created with some (system dependent)
// minimal size to make them look nicer, giving this style will make them as
// small as possible
#define wxBU_EXACTFIT 0x0001
#include "wx/control.h"
class WXDLLIMPEXP_FWD_CORE wxBitmap;
extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[];
// ----------------------------------------------------------------------------
// wxButton: a push button
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxButtonBase : public wxControl
class WXDLLIMPEXP_CORE wxButtonBase : public wxAnyButton
{
public:
wxButtonBase() { }
// show the image in the button in addition to the label
virtual void SetImageLabel(const wxBitmap& WXUNUSED(bitmap)) { }
// show the authentication needed symbol on the button: this is currently
// only implemented on Windows Vista and newer (on which it shows the UAC
// shield symbol)
void SetAuthNeeded(bool show = true) { DoSetAuthNeeded(show); }
bool GetAuthNeeded() const { return DoGetAuthNeeded(); }
// set the margins around the image
virtual void SetImageMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { }
// this wxButton method is called when the button becomes the default one
// on its panel
virtual void SetDefault() { }
// Buttons on MSW can look bad if they are not native colours, because
// then they become owner-drawn and not theme-drawn. Disable it here
// in wxButtonBase to make it consistent.
virtual bool ShouldInheritColours() const { return false; }
// make this button the default button in its top level window
//
// returns the old default item (possibly NULL)
virtual wxWindow *SetDefault();
// returns the default button size for this platform
static wxSize GetDefaultSize();
protected:
DECLARE_NO_COPY_CLASS(wxButtonBase)
wxDECLARE_NO_COPY_CLASS(wxButtonBase);
};
#if defined(__WXUNIVERSAL__)
@ -91,16 +57,13 @@ protected:
#elif defined(__WXGTK__)
#include "wx/gtk1/button.h"
#elif defined(__WXMAC__)
#include "wx/mac/button.h"
#include "wx/osx/button.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/button.h"
#elif defined(__WXPM__)
#include "wx/os2/button.h"
#elif defined(__WXPALMOS__)
#include "wx/palmos/button.h"
#endif
#endif // wxUSE_BUTTON
#endif
// _WX_BUTTON_H_BASE_
#endif // _WX_BUTTON_H_BASE_

View File

@ -0,0 +1,396 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/calctrl.h
// Purpose: date-picker control
// Author: Vadim Zeitlin
// Modified by:
// Created: 29.12.99
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CALCTRL_H_
#define _WX_CALCTRL_H_
#include "wx/defs.h"
#if wxUSE_CALENDARCTRL
#include "wx/dateevt.h"
#include "wx/colour.h"
#include "wx/font.h"
#include "wx/control.h"
// ----------------------------------------------------------------------------
// wxCalendarCtrl flags
// ----------------------------------------------------------------------------
enum
{
// show Sunday as the first day of the week (default)
wxCAL_SUNDAY_FIRST = 0x0000,
// show Monday as the first day of the week
wxCAL_MONDAY_FIRST = 0x0001,
// highlight holidays
wxCAL_SHOW_HOLIDAYS = 0x0002,
// disable the year change control, show only the month change one
// deprecated
wxCAL_NO_YEAR_CHANGE = 0x0004,
// don't allow changing neither month nor year (implies
// wxCAL_NO_YEAR_CHANGE)
wxCAL_NO_MONTH_CHANGE = 0x000c,
// use MS-style month-selection instead of combo-spin combination
wxCAL_SEQUENTIAL_MONTH_SELECTION = 0x0010,
// show the neighbouring weeks in the previous and next month
wxCAL_SHOW_SURROUNDING_WEEKS = 0x0020,
// show week numbers on the left side of the calendar.
wxCAL_SHOW_WEEK_NUMBERS = 0x0040
};
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// return values for the HitTest() method
enum wxCalendarHitTestResult
{
wxCAL_HITTEST_NOWHERE, // outside of anything
wxCAL_HITTEST_HEADER, // on the header (weekdays)
wxCAL_HITTEST_DAY, // on a day in the calendar
wxCAL_HITTEST_INCMONTH,
wxCAL_HITTEST_DECMONTH,
wxCAL_HITTEST_SURROUNDING_WEEK,
wxCAL_HITTEST_WEEK
};
// border types for a date
enum wxCalendarDateBorder
{
wxCAL_BORDER_NONE, // no border (default)
wxCAL_BORDER_SQUARE, // a rectangular border
wxCAL_BORDER_ROUND // a round border
};
// ----------------------------------------------------------------------------
// wxCalendarDateAttr: custom attributes for a calendar date
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxCalendarDateAttr
{
public:
// ctors
wxCalendarDateAttr(const wxColour& colText = wxNullColour,
const wxColour& colBack = wxNullColour,
const wxColour& colBorder = wxNullColour,
const wxFont& font = wxNullFont,
wxCalendarDateBorder border = wxCAL_BORDER_NONE)
: m_colText(colText), m_colBack(colBack),
m_colBorder(colBorder), m_font(font)
{
Init(border);
}
wxCalendarDateAttr(wxCalendarDateBorder border,
const wxColour& colBorder = wxNullColour)
: m_colBorder(colBorder)
{
Init(border);
}
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
void SetBorderColour(const wxColour& col) { m_colBorder = col; }
void SetFont(const wxFont& font) { m_font = font; }
void SetBorder(wxCalendarDateBorder border) { m_border = border; }
void SetHoliday(bool holiday) { m_holiday = holiday; }
// accessors
bool HasTextColour() const { return m_colText.IsOk(); }
bool HasBackgroundColour() const { return m_colBack.IsOk(); }
bool HasBorderColour() const { return m_colBorder.IsOk(); }
bool HasFont() const { return m_font.IsOk(); }
bool HasBorder() const { return m_border != wxCAL_BORDER_NONE; }
bool IsHoliday() const { return m_holiday; }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
const wxColour& GetBorderColour() const { return m_colBorder; }
const wxFont& GetFont() const { return m_font; }
wxCalendarDateBorder GetBorder() const { return m_border; }
// get or change the "mark" attribute, i.e. the one used for the items
// marked with wxCalendarCtrl::Mark()
static const wxCalendarDateAttr& GetMark() { return m_mark; }
static void SetMark(wxCalendarDateAttr const& m) { m_mark = m; }
protected:
void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE)
{
m_border = border;
m_holiday = false;
}
private:
static wxCalendarDateAttr m_mark;
wxColour m_colText,
m_colBack,
m_colBorder;
wxFont m_font;
wxCalendarDateBorder m_border;
bool m_holiday;
};
// ----------------------------------------------------------------------------
// wxCalendarCtrl events
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl;
class WXDLLIMPEXP_ADV wxCalendarEvent : public wxDateEvent
{
public:
wxCalendarEvent() : m_wday(wxDateTime::Inv_WeekDay) { }
wxCalendarEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
: wxDateEvent(win, dt, type),
m_wday(wxDateTime::Inv_WeekDay) { }
wxCalendarEvent(const wxCalendarEvent& event)
: wxDateEvent(event), m_wday(event.m_wday) { }
void SetWeekDay(const wxDateTime::WeekDay wd) { m_wday = wd; }
wxDateTime::WeekDay GetWeekDay() const { return m_wday; }
virtual wxEvent *Clone() const { return new wxCalendarEvent(*this); }
private:
wxDateTime::WeekDay m_wday;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalendarEvent)
};
// ----------------------------------------------------------------------------
// wxCalendarCtrlBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxCalendarCtrlBase : public wxControl
{
public:
// do we allow changing the month/year?
bool AllowMonthChange() const { return !HasFlag(wxCAL_NO_MONTH_CHANGE); }
// get/set the current date
virtual wxDateTime GetDate() const = 0;
virtual bool SetDate(const wxDateTime& date) = 0;
// restricting the dates shown by the control to the specified range: only
// implemented in the generic and MSW versions for now
// if either date is set, the corresponding limit will be enforced and true
// returned; if none are set, the existing restrictions are removed and
// false is returned
virtual bool
SetDateRange(const wxDateTime& WXUNUSED(lowerdate) = wxDefaultDateTime,
const wxDateTime& WXUNUSED(upperdate) = wxDefaultDateTime)
{
return false;
}
// retrieves the limits currently in use (wxDefaultDateTime if none) in the
// provided pointers (which may be NULL) and returns true if there are any
// limits or false if none
virtual bool
GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const
{
if ( lowerdate )
*lowerdate = wxDefaultDateTime;
if ( upperdate )
*upperdate = wxDefaultDateTime;
return false;
}
// returns one of wxCAL_HITTEST_XXX constants and fills either date or wd
// with the corresponding value (none for NOWHERE, the date for DAY and wd
// for HEADER)
//
// notice that this is not implemented in all versions
virtual wxCalendarHitTestResult
HitTest(const wxPoint& WXUNUSED(pos),
wxDateTime* WXUNUSED(date) = NULL,
wxDateTime::WeekDay* WXUNUSED(wd) = NULL)
{
return wxCAL_HITTEST_NOWHERE;
}
// allow or disable changing the current month (and year), return true if
// the value of this option really changed or false if it was already set
// to the required value
//
// NB: we provide implementation for this pure virtual function, derived
// classes should call it
virtual bool EnableMonthChange(bool enable = true) = 0;
// an item without custom attributes is drawn with the default colours and
// font and without border, setting custom attributes allows to modify this
//
// the day parameter should be in 1..31 range, for days 29, 30, 31 the
// corresponding attribute is just unused if there is no such day in the
// current month
//
// notice that currently arbitrary attributes are supported only in the
// generic version, the native controls only support Mark() which assigns
// some special appearance (which can be customized using SetMark() for the
// generic version) to the given day
virtual void Mark(size_t day, bool mark) = 0;
virtual wxCalendarDateAttr *GetAttr(size_t WXUNUSED(day)) const
{ return NULL; }
virtual void SetAttr(size_t WXUNUSED(day), wxCalendarDateAttr *attr)
{ delete attr; }
virtual void ResetAttr(size_t WXUNUSED(day)) { }
// holidays support
//
// currently only the generic version implements all functions in this
// section; wxMSW implements simple support for holidays (they can be
// just enabled or disabled) and wxGTK doesn't support them at all
// equivalent to changing wxCAL_SHOW_HOLIDAYS flag but should be called
// instead of just changing it
virtual void EnableHolidayDisplay(bool display = true);
// set/get the colours to use for holidays (if they're enabled)
virtual void SetHolidayColours(const wxColour& WXUNUSED(colFg),
const wxColour& WXUNUSED(colBg)) { }
virtual const wxColour& GetHolidayColourFg() const { return wxNullColour; }
virtual const wxColour& GetHolidayColourBg() const { return wxNullColour; }
// mark the given day of the current month as being a holiday
virtual void SetHoliday(size_t WXUNUSED(day)) { }
// customizing the colours of the controls
//
// most of the methods in this section are only implemented by the native
// version of the control and do nothing in the native ones
// set/get the colours to use for the display of the week day names at the
// top of the controls
virtual void SetHeaderColours(const wxColour& WXUNUSED(colFg),
const wxColour& WXUNUSED(colBg)) { }
virtual const wxColour& GetHeaderColourFg() const { return wxNullColour; }
virtual const wxColour& GetHeaderColourBg() const { return wxNullColour; }
// set/get the colours used for the currently selected date
virtual void SetHighlightColours(const wxColour& WXUNUSED(colFg),
const wxColour& WXUNUSED(colBg)) { }
virtual const wxColour& GetHighlightColourFg() const { return wxNullColour; }
virtual const wxColour& GetHighlightColourBg() const { return wxNullColour; }
// implementation only from now on
// generate the given calendar event, return true if it was processed
//
// NB: this is public because it's used from GTK+ callbacks
bool GenerateEvent(wxEventType type)
{
wxCalendarEvent event(this, GetDate(), type);
return HandleWindowEvent(event);
}
protected:
// generate all the events for the selection change from dateOld to current
// date: SEL_CHANGED, PAGE_CHANGED if necessary and also one of (deprecated)
// YEAR/MONTH/DAY_CHANGED ones
//
// returns true if page changed event was generated, false if the new date
// is still in the same month as before
bool GenerateAllChangeEvents(const wxDateTime& dateOld);
// call SetHoliday() for all holidays in the current month
//
// should be called on month change, does nothing if wxCAL_SHOW_HOLIDAYS is
// not set and returns false in this case, true if we do show them
bool SetHolidayAttrs();
// called by SetHolidayAttrs() to forget the previously set holidays
virtual void ResetHolidayAttrs() { }
// called by EnableHolidayDisplay()
virtual void RefreshHolidays() { }
};
// ----------------------------------------------------------------------------
// wxCalendarCtrl
// ----------------------------------------------------------------------------
#define wxCalendarNameStr "CalendarCtrl"
#ifndef __WXUNIVERSAL__
#if defined(__WXGTK20__)
#define wxHAS_NATIVE_CALENDARCTRL
#include "wx/gtk/calctrl.h"
#define wxCalendarCtrl wxGtkCalendarCtrl
#elif defined(__WXMSW__)
#define wxHAS_NATIVE_CALENDARCTRL
#include "wx/msw/calctrl.h"
#endif
#endif // !__WXUNIVERSAL__
#ifndef wxHAS_NATIVE_CALENDARCTRL
#include "wx/generic/calctrlg.h"
#define wxCalendarCtrl wxGenericCalendarCtrl
#endif
// ----------------------------------------------------------------------------
// calendar event types and macros for handling them
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_PAGE_CHANGED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_DOUBLECLICKED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_WEEKDAY_CLICKED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_WEEK_CLICKED, wxCalendarEvent );
// deprecated events
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_DAY_CHANGED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_MONTH_CHANGED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_YEAR_CHANGED, wxCalendarEvent );
typedef void (wxEvtHandler::*wxCalendarEventFunction)(wxCalendarEvent&);
#define wxCalendarEventHandler(func) \
wxEVENT_HANDLER_CAST(wxCalendarEventFunction, func)
#define wx__DECLARE_CALEVT(evt, id, fn) \
wx__DECLARE_EVT1(wxEVT_CALENDAR_ ## evt, id, wxCalendarEventHandler(fn))
#define EVT_CALENDAR(id, fn) wx__DECLARE_CALEVT(DOUBLECLICKED, id, fn)
#define EVT_CALENDAR_SEL_CHANGED(id, fn) wx__DECLARE_CALEVT(SEL_CHANGED, id, fn)
#define EVT_CALENDAR_PAGE_CHANGED(id, fn) wx__DECLARE_CALEVT(PAGE_CHANGED, id, fn)
#define EVT_CALENDAR_WEEKDAY_CLICKED(id, fn) wx__DECLARE_CALEVT(WEEKDAY_CLICKED, id, fn)
#define EVT_CALENDAR_WEEK_CLICKED(id, fn) wx__DECLARE_CALEVT(WEEK_CLICKED, id, fn)
// deprecated events
#define EVT_CALENDAR_DAY(id, fn) wx__DECLARE_CALEVT(DAY_CHANGED, id, fn)
#define EVT_CALENDAR_MONTH(id, fn) wx__DECLARE_CALEVT(MONTH_CHANGED, id, fn)
#define EVT_CALENDAR_YEAR(id, fn) wx__DECLARE_CALEVT(YEAR_CHANGED, id, fn)
#endif // wxUSE_CALENDARCTRL
#endif // _WX_CALCTRL_H_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 23.05.99
// RCS-ID: $Id: caret.h 49804 2007-11-10 01:09:42Z VZ $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -34,7 +33,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowBase;
// appear. It can be either a solid block or a custom bitmap (TODO)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxCaretBase
class WXDLLIMPEXP_CORE wxCaretBase
{
public:
// ctors
@ -147,7 +146,7 @@ public:
virtual void OnKillFocus() { }
protected:
// these functions may be overriden in the derived classes, but they
// these functions may be overridden in the derived classes, but they
// should call the base class version first
virtual bool DoCreate(wxWindowBase *window, int width, int height)
{
@ -167,7 +166,7 @@ protected:
// the common initialization
void Init()
{
m_window = (wxWindowBase *)NULL;
m_window = NULL;
m_x = m_y = 0;
m_width = m_height = 0;
m_countVisible = 0;
@ -186,7 +185,7 @@ protected:
int m_countVisible;
private:
DECLARE_NO_COPY_CLASS(wxCaretBase)
wxDECLARE_NO_COPY_CLASS(wxCaretBase);
};
// ---------------------------------------------------------------------------
@ -208,17 +207,17 @@ private:
#ifdef wxHAS_CARET_USING_OVERLAYS
// we don't need to hide the caret if it's rendered using overlays
class WXDLLEXPORT wxCaretSuspend
class WXDLLIMPEXP_CORE wxCaretSuspend
{
public:
wxCaretSuspend(wxWindow *WXUNUSED(win)) {}
DECLARE_NO_COPY_CLASS(wxCaretSuspend)
wxDECLARE_NO_COPY_CLASS(wxCaretSuspend);
};
#else // !wxHAS_CARET_USING_OVERLAYS
class WXDLLEXPORT wxCaretSuspend
class WXDLLIMPEXP_CORE wxCaretSuspend
{
public:
wxCaretSuspend(wxWindow *win)
@ -242,7 +241,7 @@ private:
wxCaret *m_caret;
bool m_show;
DECLARE_NO_COPY_CLASS(wxCaretSuspend)
wxDECLARE_NO_COPY_CLASS(wxCaretSuspend);
};
#endif // wxHAS_CARET_USING_OVERLAYS/!wxHAS_CARET_USING_OVERLAYS

View File

@ -0,0 +1,304 @@
/*
* Name: wx/chartype.h
* Purpose: Declarations of wxChar and related types
* Author: Joel Farley, Ove Kåven
* Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
* Created: 1998/06/12
* Copyright: (c) 1998-2006 wxWidgets dev team
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_WXCHARTYPE_H_
#define _WX_WXCHARTYPE_H_
/* defs.h indirectly includes this file, so don't include it here */
#include "wx/platform.h"
/* check whether we have wchar_t and which size it is if we do */
#if !defined(wxUSE_WCHAR_T)
#if defined(__UNIX__)
#if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__)
#define wxUSE_WCHAR_T 1
#else
#define wxUSE_WCHAR_T 0
#endif
#elif defined(__GNUWIN32__) && !defined(__MINGW32__)
#define wxUSE_WCHAR_T 0
#elif defined(__WATCOMC__)
#define wxUSE_WCHAR_T 0
#elif defined(__VISAGECPP__) && (__IBMCPP__ < 400)
#define wxUSE_WCHAR_T 0
#else
/* add additional compiler checks if this fails */
#define wxUSE_WCHAR_T 1
#endif
#endif /* !defined(wxUSE_WCHAR_T) */
/* Unicode support requires wchar_t */
#if !wxUSE_WCHAR_T
#error "wchar_t must be available"
#endif /* Unicode */
/*
non Unix compilers which do have wchar.h (but not tchar.h which is included
below and which includes wchar.h anyhow).
Actually MinGW has tchar.h, but it does not include wchar.h
*/
#if defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__)
#ifndef HAVE_WCHAR_H
#define HAVE_WCHAR_H
#endif
#endif
#ifdef HAVE_WCHAR_H
/* the current (as of Nov 2002) version of cygwin has a bug in its */
/* wchar.h -- there is no extern "C" around the declarations in it */
/* and this results in linking errors later; also, at least on some */
/* Cygwin versions, wchar.h requires sys/types.h */
#ifdef __CYGWIN__
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* Cygwin */
#include <wchar.h>
#if defined(__CYGWIN__) && defined(__cplusplus)
}
#endif /* Cygwin and C++ */
#elif defined(HAVE_WCSTR_H)
/* old compilers have relevant declarations here */
#include <wcstr.h>
#elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
/* include stdlib.h for wchar_t */
#include <stdlib.h>
#endif /* HAVE_WCHAR_H */
#ifdef HAVE_WIDEC_H
#include <widec.h>
#endif
/* -------------------------------------------------------------------------- */
/* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */
/* mapped to either char or wchar_t depending on the ASCII/Unicode mode and */
/* have the function mapping _tfoo() -> foo() or wfoo() */
/* -------------------------------------------------------------------------- */
/* VC++ and BC++ starting with 5.2 have TCHAR support */
#ifdef __VISUALC__
#define wxHAVE_TCHAR_SUPPORT
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)
#define wxHAVE_TCHAR_SUPPORT
#include <ctype.h>
#elif defined(__WATCOMC__)
#define wxHAVE_TCHAR_SUPPORT
#elif defined(__DMC__)
#define wxHAVE_TCHAR_SUPPORT
#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 )
#define wxHAVE_TCHAR_SUPPORT
#include <stddef.h>
#include <string.h>
#include <ctype.h>
#elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
/* VZ: the old VisualAge definitions were completely wrong and had no */
/* chance at all to work in Unicode build anyhow so let's pretend */
/* that VisualAge does _not_ support TCHAR for the moment (as */
/* indicated by "0 &&" above) until someone really has time to delve */
/* into Unicode issues under OS/2 */
/* VisualAge 4.0+ supports TCHAR */
#define wxHAVE_TCHAR_SUPPORT
#endif /* compilers with (good) TCHAR support */
#ifdef wxHAVE_TCHAR_SUPPORT
/* get TCHAR definition if we've got it */
#include <tchar.h>
/* we surely do have wchar_t if we have TCHAR */
#ifndef wxUSE_WCHAR_T
#define wxUSE_WCHAR_T 1
#endif /* !defined(wxUSE_WCHAR_T) */
#endif /* wxHAVE_TCHAR_SUPPORT */
/* ------------------------------------------------------------------------- */
/* define wxChar type */
/* ------------------------------------------------------------------------- */
/* TODO: define wxCharInt to be equal to either int or wint_t? */
#if !wxUSE_UNICODE
typedef char wxChar;
typedef signed char wxSChar;
typedef unsigned char wxUChar;
#else
/* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */
/* signed/unsigned version of it which (a) makes sense to me (unlike */
/* char wchar_t is always unsigned) and (b) was how the previous */
/* definitions worked so keep it like this */
/* Sun's SunPro compiler supports the wchar_t type and wide character */
/* functions, but does not define __WCHAR_TYPE__. Define it here to */
/* allow unicode enabled builds. */
#if (defined(__SUNPRO_CC) || defined(__SUNPRO_C)) && !defined(__WCHAR_TYPE__)
#define __WCHAR_TYPE__ wxchar_t
#endif
/* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */
/* comment below */
#if !defined(__WCHAR_TYPE__) || \
(!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96))
/* standard case */
typedef wchar_t wxChar;
typedef wchar_t wxSChar;
typedef wchar_t wxUChar;
#else /* __WCHAR_TYPE__ and gcc < 2.96 */
/* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. */
/* However, this doesn't work with new GCC 3.x compilers because */
/* wchar_t is C++'s builtin type in the new standard. OTOH, old */
/* compilers (GCC 2.x) won't accept new definition of */
/* wx{S,U}CharType, so we have to define wxChar */
/* conditionally depending on detected compiler & compiler */
/* version. */
/* with old definition of wxChar. */
#define wchar_t __WCHAR_TYPE__
typedef __WCHAR_TYPE__ wxChar;
typedef __WCHAR_TYPE__ wxSChar;
typedef __WCHAR_TYPE__ wxUChar;
#endif /* __WCHAR_TYPE__ */
#endif /* ASCII/Unicode */
/* ------------------------------------------------------------------------- */
/* define wxStringCharType */
/* ------------------------------------------------------------------------- */
/* depending on the platform, Unicode build can either store wxStrings as
wchar_t* or UTF-8 encoded char*: */
#if wxUSE_UNICODE
/* FIXME-UTF8: what would be better place for this? */
#if defined(wxUSE_UTF8_LOCALE_ONLY) && !defined(wxUSE_UNICODE_UTF8)
#error "wxUSE_UTF8_LOCALE_ONLY only makes sense with wxUSE_UNICODE_UTF8"
#endif
#ifndef wxUSE_UTF8_LOCALE_ONLY
#define wxUSE_UTF8_LOCALE_ONLY 0
#endif
#ifndef wxUSE_UNICODE_UTF8
#define wxUSE_UNICODE_UTF8 0
#endif
#if wxUSE_UNICODE_UTF8
#define wxUSE_UNICODE_WCHAR 0
#else
#define wxUSE_UNICODE_WCHAR 1
#endif
#else
#define wxUSE_UNICODE_WCHAR 0
#define wxUSE_UNICODE_UTF8 0
#define wxUSE_UTF8_LOCALE_ONLY 0
#endif
/* define char type used by wxString internal representation: */
#if wxUSE_UNICODE_WCHAR
typedef wchar_t wxStringCharType;
#else /* wxUSE_UNICODE_UTF8 || ANSI */
typedef char wxStringCharType;
#endif
/* ------------------------------------------------------------------------- */
/* define wxT() and related macros */
/* ------------------------------------------------------------------------- */
/* BSD systems define _T() to be something different in ctype.h, override it */
#if defined(__FreeBSD__) || defined(__DARWIN__)
#include <ctype.h>
#undef _T
#endif
/*
wxT ("wx text") macro turns a literal string constant into a wide char
constant. It is mostly unnecessary with wx 2.9 but defined for
compatibility.
*/
#ifndef wxT
#if !wxUSE_UNICODE
#define wxT(x) x
#else /* Unicode */
/*
Notice that we use an intermediate macro to allow x to be expanded
if it's a macro itself.
*/
#ifndef wxCOMPILER_BROKEN_CONCAT_OPER
#define wxT(x) wxCONCAT_HELPER(L, x)
#else
#define wxT(x) wxPREPEND_L(x)
#endif
#endif /* ASCII/Unicode */
#endif /* !defined(wxT) */
/*
wxT_2 exists only for compatibility with wx 2.x and is the same as wxT() in
that version but nothing in the newer ones.
*/
#define wxT_2(x) x
/*
wxS ("wx string") macro can be used to create literals using the same
representation as wxString does internally, i.e. wchar_t in Unicode build
under Windows or char in UTF-8-based Unicode builds and (deprecated) ANSI
builds everywhere (see wxStringCharType definition above).
*/
#if wxUSE_UNICODE_WCHAR
/*
As above with wxT(), wxS() argument is expanded if it's a macro.
*/
#ifndef wxCOMPILER_BROKEN_CONCAT_OPER
#define wxS(x) wxCONCAT_HELPER(L, x)
#else
#define wxS(x) wxPREPEND_L(x)
#endif
#else /* wxUSE_UNICODE_UTF8 || ANSI */
#define wxS(x) x
#endif
/*
_T() is a synonym for wxT() familiar to Windows programmers. As this macro
has even higher risk of conflicting with system headers, its use is
discouraged and you may predefine wxNO__T to disable it. Additionally, we
do it ourselves for Sun CC which is known to use it in its standard headers
(see #10660).
*/
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#ifndef wxNO__T
#define wxNO__T
#endif
#endif
#if !defined(_T) && !defined(wxNO__T)
#define _T(x) wxT(x)
#endif
/* a helper macro allowing to make another macro Unicode-friendly, see below */
#define wxAPPLY_T(x) wxT(x)
/* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */
#ifndef __TFILE__
#define __TFILE__ wxAPPLY_T(__FILE__)
#endif
#ifndef __TDATE__
#define __TDATE__ wxAPPLY_T(__DATE__)
#endif
#ifndef __TTIME__
#define __TTIME__ wxAPPLY_T(__TIME__)
#endif
#endif /* _WX_WXCHARTYPE_H_ */

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 07.09.00
// RCS-ID: $Id: checkbox.h 39901 2006-06-30 10:51:44Z VS $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -25,8 +24,12 @@
* Determine whether to use a 3-state or 2-state
* checkbox. 3-state enables to differentiate
* between 'unchecked', 'checked' and 'undetermined'.
*
* In addition to the styles here it is also possible to specify just 0 which
* is treated the same as wxCHK_2STATE for compatibility (but using explicit
* flag is preferred).
*/
#define wxCHK_2STATE 0x0000
#define wxCHK_2STATE 0x4000
#define wxCHK_3STATE 0x1000
/*
@ -37,25 +40,13 @@
*/
#define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000
/*
* The possible states of a 3-state checkbox (Compatible
* with the 2-state checkbox).
*/
enum wxCheckBoxState
{
wxCHK_UNCHECKED,
wxCHK_CHECKED,
wxCHK_UNDETERMINED /* 3-state checkbox only */
};
extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
// ----------------------------------------------------------------------------
// wxCheckBox: a control which shows a label and a box which may be checked
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxCheckBoxBase : public wxControl
class WXDLLIMPEXP_CORE wxCheckBoxBase : public wxControl
{
public:
wxCheckBoxBase() { }
@ -118,6 +109,9 @@ public:
}
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; }
virtual wxCheckBoxState DoGet3StateValue() const
@ -126,10 +120,51 @@ protected:
return wxCHK_UNCHECKED;
}
// Helper function to be called from derived classes Create()
// implementations: it checks that the style doesn't contain any
// incompatible bits and modifies it to be sane if it does.
static void WXValidateStyle(long *stylePtr)
{
long& style = *stylePtr;
if ( !(style & (wxCHK_2STATE | wxCHK_3STATE)) )
{
// For compatibility we use absence of style flags as wxCHK_2STATE
// because wxCHK_2STATE used to have the value of 0 and some
// existing code uses 0 instead of it. Moreover, some code even
// uses some non-0 style, e.g. wxBORDER_XXX, but doesn't specify
// neither wxCHK_2STATE nor wxCHK_3STATE -- to avoid breaking it,
// assume (much more common) 2 state checkbox by default.
style |= wxCHK_2STATE;
}
if ( style & wxCHK_3STATE )
{
if ( style & wxCHK_2STATE )
{
wxFAIL_MSG( "wxCHK_2STATE and wxCHK_3STATE can't be used "
"together" );
style &= ~wxCHK_3STATE;
}
}
else // No wxCHK_3STATE
{
if ( style & wxCHK_ALLOW_3RD_STATE_FOR_USER )
{
wxFAIL_MSG( "wxCHK_ALLOW_3RD_STATE_FOR_USER doesn't make sense "
"without wxCHK_3STATE" );
style &= ~wxCHK_ALLOW_3RD_STATE_FOR_USER;
}
}
}
private:
DECLARE_NO_COPY_CLASS(wxCheckBoxBase)
wxDECLARE_NO_COPY_CLASS(wxCheckBoxBase);
};
// Most ports support 3 state checkboxes so define this by default.
#define wxHAS_3STATE_CHECKBOX
#if defined(__WXUNIVERSAL__)
#include "wx/univ/checkbox.h"
#elif defined(__WXMSW__)
@ -139,18 +174,17 @@ private:
#elif defined(__WXGTK20__)
#include "wx/gtk/checkbox.h"
#elif defined(__WXGTK__)
#undef wxHAS_3STATE_CHECKBOX
#include "wx/gtk1/checkbox.h"
#elif defined(__WXMAC__)
#include "wx/mac/checkbox.h"
#include "wx/osx/checkbox.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/checkbox.h"
#elif defined(__WXPM__)
#undef wxHAS_3STATE_CHECKBOX
#include "wx/os2/checkbox.h"
#elif defined(__WXPALMOS__)
#include "wx/palmos/checkbox.h"
#endif
#endif // wxUSE_CHECKBOX
#endif
// _WX_CHECKBOX_H_BASE_
#endif // _WX_CHECKBOX_H_BASE_

View File

@ -0,0 +1,44 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/checkeddelete.h
// Purpose: wxCHECKED_DELETE() macro
// Author: Vadim Zeitlin
// Created: 2009-02-03
// Copyright: (c) 2002-2009 wxWidgets dev team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHECKEDDELETE_H_
#define _WX_CHECKEDDELETE_H_
#include "wx/cpp.h"
// TODO: provide wxCheckedDelete[Array]() template functions too
// ----------------------------------------------------------------------------
// wxCHECKED_DELETE and wxCHECKED_DELETE_ARRAY macros
// ----------------------------------------------------------------------------
/*
checked deleters are used to make sure that the type being deleted is really
a complete type.: otherwise sizeof() would result in a compile-time error
do { ... } while ( 0 ) construct is used to have an anonymous scope
(otherwise we could have name clashes between different "complete"s) but
still force a semicolon after the macro
*/
#define wxCHECKED_DELETE(ptr) \
wxSTATEMENT_MACRO_BEGIN \
typedef char complete[sizeof(*ptr)] WX_ATTRIBUTE_UNUSED; \
delete ptr; \
wxSTATEMENT_MACRO_END
#define wxCHECKED_DELETE_ARRAY(ptr) \
wxSTATEMENT_MACRO_BEGIN \
typedef char complete[sizeof(*ptr)] WX_ATTRIBUTE_UNUSED; \
delete [] ptr; \
wxSTATEMENT_MACRO_END
#endif // _WX_CHECKEDDELETE_H_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 12.09.00
// RCS-ID: $Id: checklst.h 38319 2006-03-23 22:05:23Z VZ $
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -12,6 +11,8 @@
#ifndef _WX_CHECKLST_H_BASE_
#define _WX_CHECKLST_H_BASE_
#include "wx/defs.h"
#if wxUSE_CHECKLISTBOX
#include "wx/listbox.h"
@ -20,7 +21,7 @@
// wxCheckListBox: a listbox whose items may be checked
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxCheckListBoxBase : public
class WXDLLIMPEXP_CORE wxCheckListBoxBase : public
#ifdef __WXWINCE__
// keep virtuals synchronised
wxListBoxBase
@ -35,7 +36,9 @@ public:
virtual bool IsChecked(unsigned int item) const = 0;
virtual void Check(unsigned int item, bool check = true) = 0;
DECLARE_NO_COPY_CLASS(wxCheckListBoxBase)
virtual unsigned int GetCheckedItems(wxArrayInt& checkedItems) const;
wxDECLARE_NO_COPY_CLASS(wxCheckListBoxBase);
};
#if defined(__WXUNIVERSAL__)
@ -51,7 +54,7 @@ public:
#elif defined(__WXGTK__)
#include "wx/gtk1/checklst.h"
#elif defined(__WXMAC__)
#include "wx/mac/checklst.h"
#include "wx/osx/checklst.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/checklst.h"
#elif defined(__WXPM__)

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,9 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/choicdgg.h
// Name: wx/choicdlg.h
// Purpose: Includes generic choice dialog file
// Author: Julian Smart
// Modified by:
// Created:
// RCS-ID: $Id: choicdlg.h 33948 2005-05-04 18:57:50Z JS $
// Copyright: Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -12,11 +11,12 @@
#ifndef _WX_CHOICDLG_H_BASE_
#define _WX_CHOICDLG_H_BASE_
#include "wx/defs.h"
#if wxUSE_CHOICEDLG
#include "wx/generic/choicdgg.h"
#endif
#endif
// _WX_CHOICDLG_H_BASE_
#endif // _WX_CHOICDLG_H_BASE_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 26.07.99
// RCS-ID: $Id: choice.h 42727 2006-10-30 16:04:27Z VZ $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -26,13 +25,13 @@
// global data
// ----------------------------------------------------------------------------
extern WXDLLEXPORT_DATA(const wxChar) wxChoiceNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr[];
// ----------------------------------------------------------------------------
// wxChoice allows to select one of a non-modifiable list of strings
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxChoiceBase : public wxControlWithItems
class WXDLLIMPEXP_CORE wxChoiceBase : public wxControlWithItems
{
public:
wxChoiceBase() { }
@ -55,8 +54,18 @@ public:
// emulate selecting the item event.GetInt()
void Command(wxCommandEvent& event);
// override wxItemContainer::IsSorted
virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
protected:
// The generic implementation doesn't determine the height correctly and
// doesn't account for the width of the arrow but does take into account
// the string widths, so the derived classes should override it and set the
// height and add the arrow width to the size returned by this version.
virtual wxSize DoGetBestSize() const;
private:
DECLARE_NO_COPY_CLASS(wxChoiceBase)
wxDECLARE_NO_COPY_CLASS(wxChoiceBase);
};
// ----------------------------------------------------------------------------
@ -76,7 +85,7 @@ private:
#elif defined(__WXGTK__)
#include "wx/gtk1/choice.h"
#elif defined(__WXMAC__)
#include "wx/mac/choice.h"
#include "wx/osx/choice.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/choice.h"
#elif defined(__WXPM__)

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h
// Created: 15.09.04
// RCS-ID: $Id: choicebk.h 59616 2009-03-18 21:58:15Z VZ $
// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -18,11 +17,12 @@
#include "wx/bookctrl.h"
#include "wx/choice.h"
#include "wx/containr.h"
class WXDLLIMPEXP_FWD_CORE wxChoice;
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED;
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING;
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CHOICEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CHOICEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
// wxChoicebook flags
#define wxCHB_DEFAULT wxBK_DEFAULT
@ -36,13 +36,10 @@ extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
// wxChoicebook
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase
class WXDLLIMPEXP_CORE wxChoicebook : public wxNavigationEnabled<wxBookCtrlBase>
{
public:
wxChoicebook()
{
Init();
}
wxChoicebook() { }
wxChoicebook(wxWindow *parent,
wxWindowID id,
@ -51,8 +48,6 @@ public:
long style = 0,
const wxString& name = wxEmptyString)
{
Init();
(void)Create(parent, id, pos, size, style, name);
}
@ -65,18 +60,17 @@ public:
const wxString& name = wxEmptyString);
virtual int GetSelection() const;
virtual bool SetPageText(size_t n, const wxString& strText);
virtual wxString GetPageText(size_t n) const;
virtual int GetPageImage(size_t n) const;
virtual bool SetPageImage(size_t n, int imageId);
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
virtual bool InsertPage(size_t n,
wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = -1);
virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); }
int imageId = NO_IMAGE);
virtual int SetSelection(size_t n)
{ return DoSetSelection(n, SetSelection_SendEvent); }
virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
virtual void SetImageList(wxImageList *imageList);
@ -85,31 +79,29 @@ public:
// returns the choice control
wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; }
protected:
virtual wxWindow *DoRemovePage(size_t page);
// Override this to return true because the part of parent window
// background between our controlling wxChoice and the page area should
// show through.
virtual bool HasTransparentBackground() { return true; }
// get the size which the choice control should have
virtual wxSize GetControllerSize() const;
protected:
virtual void DoSetWindowVariant(wxWindowVariant variant);
virtual wxWindow *DoRemovePage(size_t page);
void UpdateSelectedPage(size_t newsel)
{
m_selection = wx_static_cast(int, newsel);
m_selection = static_cast<int>(newsel);
GetChoiceCtrl()->Select(m_selection);
}
wxBookCtrlBaseEvent* CreatePageChangingEvent() const;
void MakeChangedEvent(wxBookCtrlBaseEvent &event);
wxBookCtrlEvent* CreatePageChangingEvent() const;
void MakeChangedEvent(wxBookCtrlEvent &event);
// event handlers
void OnChoiceSelected(wxCommandEvent& event);
// the currently selected page or wxNOT_FOUND if none
int m_selection;
private:
// common part of all constructors
void Init();
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook)
};
@ -118,36 +110,20 @@ private:
// choicebook event class and related stuff
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent
{
public:
wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1)
: wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
{
}
wxChoicebookEvent(const wxChoicebookEvent& event)
: wxBookCtrlBaseEvent(event)
{
}
virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent)
};
typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&);
#define wxChoicebookEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func)
// wxChoicebookEvent is obsolete and defined for compatibility only
#define wxChoicebookEvent wxBookCtrlEvent
typedef wxBookCtrlEventFunction wxChoicebookEventFunction;
#define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func)
#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn))
wx__DECLARE_EVT1(wxEVT_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn))
wx__DECLARE_EVT1(wxEVT_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED wxEVT_CHOICEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING wxEVT_CHOICEBOOK_PAGE_CHANGING
#endif // wxUSE_CHOICEBOOK

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 19.10.99
// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $
// Copyright: (c) wxWidgets Team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -17,11 +16,11 @@
#if wxUSE_CLIPBOARD
#include "wx/object.h"
#include "wx/wxchar.h"
#include "wx/event.h"
#include "wx/chartype.h"
#include "wx/dataobj.h" // for wxDataFormat
#include "wx/vector.h"
class WXDLLIMPEXP_FWD_CORE wxDataFormat;
class WXDLLIMPEXP_FWD_CORE wxDataObject;
class WXDLLIMPEXP_FWD_CORE wxClipboard;
// ----------------------------------------------------------------------------
@ -32,10 +31,10 @@ class WXDLLIMPEXP_FWD_CORE wxClipboard;
// with wxDataObject.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxClipboardBase : public wxObject
class WXDLLIMPEXP_CORE wxClipboardBase : public wxObject
{
public:
wxClipboardBase() {}
wxClipboardBase() { m_usePrimary = false; }
// open the clipboard before Add/SetData() and GetData()
virtual bool Open() = 0;
@ -59,6 +58,9 @@ public:
// ask if data in correct format is available
virtual bool IsSupported( const wxDataFormat& format ) = 0;
// ask if data in correct format is available
virtual bool IsSupportedAsync( wxEvtHandler *sink );
// fill data with data on the clipboard (if available)
virtual bool GetData( wxDataObject& data ) = 0;
@ -70,13 +72,72 @@ public:
// eating memory), otherwise the clipboard will be emptied on exit
virtual bool Flush() { return false; }
// X11 has two clipboards which get selected by this call. Empty on MSW.
virtual void UsePrimarySelection( bool WXUNUSED(primary) = false ) { }
// this allows to choose whether we work with CLIPBOARD (default) or
// PRIMARY selection on X11-based systems
//
// on the other ones, working with primary selection does nothing: this
// allows to write code which sets the primary selection when something is
// selected without any ill effects (i.e. without overwriting the
// clipboard which would be wrong on the platforms without X11 PRIMARY)
virtual void UsePrimarySelection(bool usePrimary = false)
{
m_usePrimary = usePrimary;
}
// return true if we're using primary selection
bool IsUsingPrimarySelection() const { return m_usePrimary; }
// Returns global instance (wxTheClipboard) of the object:
static wxClipboard *Get();
// don't use this directly, it is public for compatibility with some ports
// (wxX11, wxMotif, ...) only
bool m_usePrimary;
};
// ----------------------------------------------------------------------------
// asynchronous clipboard event
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClipboardEvent : public wxEvent
{
public:
wxClipboardEvent(wxEventType evtType = wxEVT_NULL)
: wxEvent(0, evtType)
{
}
wxClipboardEvent(const wxClipboardEvent& event)
: wxEvent(event),
m_formats(event.m_formats)
{
}
bool SupportsFormat(const wxDataFormat& format) const;
void AddFormat(const wxDataFormat& format);
virtual wxEvent *Clone() const
{
return new wxClipboardEvent(*this);
}
protected:
wxVector<wxDataFormat> m_formats;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardEvent)
};
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CLIPBOARD_CHANGED, wxClipboardEvent );
typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&);
#define wxClipboardEventHandler(func) \
wxEVENT_HANDLER_CAST(wxClipboardEventFunction, func)
#define EVT_CLIPBOARD_CHANGED(func) wx__DECLARE_EVT0(wxEVT_CLIPBOARD_CHANGED, wxClipboardEventHandler(func))
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------
@ -98,10 +159,8 @@ public:
#include "wx/gtk1/clipbrd.h"
#elif defined(__WXX11__)
#include "wx/x11/clipbrd.h"
#elif defined(__WXMGL__)
#include "wx/mgl/clipbrd.h"
#elif defined(__WXMAC__)
#include "wx/mac/clipbrd.h"
#include "wx/osx/clipbrd.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/clipbrd.h"
#elif defined(__WXPM__)
@ -112,10 +171,10 @@ public:
// helpful class for opening the clipboard and automatically closing it
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxClipboardLocker
class WXDLLIMPEXP_CORE wxClipboardLocker
{
public:
wxClipboardLocker(wxClipboard *clipboard = (wxClipboard *)NULL)
wxClipboardLocker(wxClipboard *clipboard = NULL)
{
m_clipboard = clipboard ? clipboard : wxTheClipboard;
if ( m_clipboard )
@ -137,7 +196,7 @@ public:
private:
wxClipboard *m_clipboard;
DECLARE_NO_COPY_CLASS(wxClipboardLocker)
wxDECLARE_NO_COPY_CLASS(wxClipboardLocker);
};
#endif // wxUSE_CLIPBOARD

View File

@ -4,7 +4,6 @@
// Author: Robin Dunn
// Modified by:
// Created: 9-Oct-2001
// RCS-ID: $Id: clntdata.h 36973 2006-01-18 16:45:41Z JS $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -159,115 +158,5 @@ protected:
};
#include "wx/vector.h"
struct WXDLLIMPEXP_BASE wxClientDataDictionaryPair
{
wxClientDataDictionaryPair( size_t idx ) : index( idx ), data( 0 ) { }
size_t index;
wxClientData* data;
};
_WX_DECLARE_VECTOR(
wxClientDataDictionaryPair,
wxClientDataDictionaryPairVector,
WXDLLIMPEXP_BASE
);
// this class is used internally to maintain the association between items
// of (some subclasses of) wxControlWithItems and their client data
// NOTE: this class does not keep track of whether it contains
// wxClientData or void*. The client must ensure that
// it does not contain a mix of the two, and that
// DestroyData is called if it contains wxClientData
class WXDLLIMPEXP_BASE wxClientDataDictionary
{
public:
wxClientDataDictionary() {}
// deletes all the data
void DestroyData()
{
for( size_t i = 0, end = m_vec.size(); i != end; ++i )
delete m_vec[i].data;
m_vec.clear();
}
// if data for the given index is not present, add it,
// if it is present, delete the old data and replace it with
// the new one
void Set( size_t index, wxClientData* data, bool doDelete )
{
size_t ptr = Find( index );
if( !data )
{
if( ptr == m_vec.size() ) return;
if( doDelete )
delete m_vec[ptr].data;
m_vec.erase( ptr );
}
else
{
if( ptr == m_vec.size() )
{
m_vec.push_back( wxClientDataDictionaryPair( index ) );
ptr = m_vec.size() - 1;
}
if( doDelete )
delete m_vec[ptr].data;
m_vec[ptr].data = data;
}
}
// get the data associated with the given index,
// return 0 if not found
wxClientData* Get( size_t index ) const
{
size_t it = Find( index );
if( it == m_vec.size() ) return 0;
return (wxClientData*)m_vec[it].data; // const cast
}
// delete the data associated with the given index
// it also decreases by one the indices of all the elements
// with an index greater than the given index
void Delete( size_t index, bool doDelete )
{
size_t todel = m_vec.size();
for( size_t i = 0, end = m_vec.size(); i != end; ++i )
{
if( m_vec[i].index == index )
todel = i;
else if( m_vec[i].index > index )
--(m_vec[i].index);
}
if( todel != m_vec.size() )
{
if( doDelete )
delete m_vec[todel].data;
m_vec.erase( todel );
}
}
private:
// returns MyVec.size() if not found
size_t Find( size_t index ) const
{
for( size_t i = 0, end = m_vec.size(); i != end; ++i )
{
if( m_vec[i].index == index )
return i;
}
return m_vec.size();
}
wxClientDataDictionaryPairVector m_vec;
};
#endif // _WX_CLNTDATAH__

View File

@ -5,7 +5,6 @@
// Modified by:
// Created: 14/4/2006
// Copyright: (c) Vadim Zeitlin, Francesco Montorsi
// RCS-ID: $Id: clrpicker.h 53135 2008-04-12 02:31:04Z VZ $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -22,8 +21,15 @@
class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent;
extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[];
extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerCtrlNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerWidgetNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerCtrlNameStr[];
// show the colour in HTML form (#AABBCC) as colour button label
#define wxCLRBTN_SHOW_LABEL 100
// the default style
#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
// ----------------------------------------------------------------------------
@ -70,7 +76,7 @@ protected:
// same prototype for their contructor (and also explains why we use
// define instead of a typedef)
// since GTK > 2.4, there is GtkColorButton
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/clrpicker.h"
#define wxColourPickerWidget wxColourButton
#else
@ -91,7 +97,7 @@ protected:
class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase
{
public:
wxColourPickerCtrl() : m_bIgnoreNextTextCtrlUpdate(false) {}
wxColourPickerCtrl() {}
virtual ~wxColourPickerCtrl() {}
@ -100,7 +106,6 @@ public:
const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerCtrlNameStr)
: m_bIgnoreNextTextCtrlUpdate(false)
{ Create(parent, id, col, pos, size, style, validator, name); }
bool Create(wxWindow *parent, wxWindowID id,
@ -141,9 +146,6 @@ protected:
virtual long GetPickerStyle(long style) const
{ return (style & wxCLRP_SHOW_LABEL); }
// true if the next UpdateTextCtrl() call is to ignore
bool m_bIgnoreNextTextCtrlUpdate;
private:
DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl)
};
@ -153,16 +155,14 @@ private:
// wxColourPickerEvent: used by wxColourPickerCtrl only
// ----------------------------------------------------------------------------
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLOURPICKER_CHANGED, 1102)
END_DECLARE_EVENT_TYPES()
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLOURPICKER_CHANGED, wxColourPickerEvent );
class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent
{
public:
wxColourPickerEvent() {}
wxColourPickerEvent(wxObject *generator, int id, const wxColour &col)
: wxCommandEvent(wxEVT_COMMAND_COLOURPICKER_CHANGED, id),
: wxCommandEvent(wxEVT_COLOURPICKER_CHANGED, id),
m_colour(col)
{
SetEventObject(generator);
@ -188,12 +188,15 @@ private:
typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&);
#define wxColourPickerEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxColourPickerEventFunction, &func)
wxEVENT_HANDLER_CAST(wxColourPickerEventFunction, func)
#define EVT_COLOURPICKER_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn))
wx__DECLARE_EVT1(wxEVT_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn))
// old wxEVT_COMMAND_* constant
#define wxEVT_COMMAND_COLOURPICKER_CHANGED wxEVT_COLOURPICKER_CHANGED
#endif // wxUSE_COLOURPICKERCTRL
#endif // _WX_CLRPICKER_H_BASE_

View File

@ -0,0 +1,151 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/cmdargs.h
// Purpose: declaration of wxCmdLineArgsArray helper class
// Author: Vadim Zeitlin
// Created: 2007-11-12
// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CMDARGS_H_
#define _WX_CMDARGS_H_
#include "wx/arrstr.h"
// ----------------------------------------------------------------------------
// wxCmdLineArgsArray: helper class used by wxApp::argv
// ----------------------------------------------------------------------------
#if wxUSE_UNICODE
// this class is used instead of either "char **" or "wchar_t **" (neither of
// which would be backwards compatible with all the existing code) for argv
// field of wxApp
//
// as it's used for compatibility, it tries to look as much as traditional
// (char **) argv as possible, in particular it provides implicit conversions
// to "char **" and also array-like operator[]
class WXDLLIMPEXP_BASE wxCmdLineArgsArray
{
public:
wxCmdLineArgsArray() { m_argsA = NULL; m_argsW = NULL; }
template <typename T>
wxCmdLineArgsArray& operator=(T **argv)
{
FreeArgs();
m_args.clear();
if ( argv )
{
while ( *argv )
m_args.push_back(*argv++);
}
return *this;
}
operator char**() const
{
if ( !m_argsA )
{
const size_t count = m_args.size();
m_argsA = new char *[count];
for ( size_t n = 0; n < count; n++ )
m_argsA[n] = wxStrdup(m_args[n].ToAscii());
}
return m_argsA;
}
operator wchar_t**() const
{
if ( !m_argsW )
{
const size_t count = m_args.size();
m_argsW = new wchar_t *[count];
for ( size_t n = 0; n < count; n++ )
m_argsW[n] = wxStrdup(m_args[n].wc_str());
}
return m_argsW;
}
// existing code does checks like "if ( argv )" and we want it to continue
// to compile, so provide this conversion even if it is pretty dangerous
operator bool() const
{
return !m_args.empty();
}
// and the same for "if ( !argv )" checks
bool operator!() const
{
return m_args.empty();
}
wxString operator[](size_t n) const
{
return m_args[n];
}
// we must provide this overload for g++ 3.4 which can't choose between
// our operator[](size_t) and ::operator[](char**, int) otherwise
wxString operator[](int n) const
{
return m_args[n];
}
// convenience methods, i.e. not existing only for backwards compatibility
// do we have any arguments at all?
bool IsEmpty() const { return m_args.empty(); }
// access the arguments as a convenient array of wxStrings
const wxArrayString& GetArguments() const { return m_args; }
~wxCmdLineArgsArray()
{
FreeArgs();
}
private:
template <typename T>
void Free(T **args)
{
if ( !args )
return;
const size_t count = m_args.size();
for ( size_t n = 0; n < count; n++ )
free(args[n]);
delete [] args;
}
void FreeArgs()
{
Free(m_argsA);
Free(m_argsW);
}
wxArrayString m_args;
mutable char **m_argsA;
mutable wchar_t **m_argsW;
wxDECLARE_NO_COPY_CLASS(wxCmdLineArgsArray);
};
// provide global operator overload for compatibility with the existing code
// doing things like "if ( condition && argv )"
inline bool operator&&(bool cond, const wxCmdLineArgsArray& array)
{
return cond && !array.IsEmpty();
}
#endif // wxUSE_UNICODE
#endif // _WX_CMDARGS_H_

View File

@ -5,7 +5,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 04.01.00
// RCS-ID: $Id: cmdline.h 49563 2007-10-31 20:46:21Z VZ $
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -17,6 +16,14 @@
#include "wx/string.h"
#include "wx/arrstr.h"
#include "wx/cmdargs.h"
// determines ConvertStringToArgs() behaviour
enum wxCmdLineSplitType
{
wxCMD_LINE_SPLIT_DOS,
wxCMD_LINE_SPLIT_UNIX
};
#if wxUSE_CMDLINE_PARSER
@ -28,13 +35,14 @@ class WXDLLIMPEXP_FWD_BASE wxDateTime;
// by default, options are optional (sic) and each call to AddParam() allows
// one more parameter - this may be changed by giving non-default flags to it
enum
enum wxCmdLineEntryFlags
{
wxCMD_LINE_OPTION_MANDATORY = 0x01, // this option must be given
wxCMD_LINE_PARAM_OPTIONAL = 0x02, // the parameter may be omitted
wxCMD_LINE_PARAM_MULTIPLE = 0x04, // the parameter may be repeated
wxCMD_LINE_OPTION_HELP = 0x08, // this option is a help request
wxCMD_LINE_NEEDS_SEPARATOR = 0x10 // must have sep before the value
wxCMD_LINE_NEEDS_SEPARATOR = 0x10, // must have sep before the value
wxCMD_LINE_SWITCH_NEGATABLE = 0x20 // this switch can be negated (e.g. /S-)
};
// an option value or parameter may be a string (the most common case), a
@ -44,6 +52,7 @@ enum wxCmdLineParamType
wxCMD_LINE_VAL_STRING, // should be 0 (default)
wxCMD_LINE_VAL_NUMBER,
wxCMD_LINE_VAL_DATE,
wxCMD_LINE_VAL_DOUBLE,
wxCMD_LINE_VAL_NONE
};
@ -53,9 +62,18 @@ enum wxCmdLineEntryType
wxCMD_LINE_SWITCH,
wxCMD_LINE_OPTION,
wxCMD_LINE_PARAM,
wxCMD_LINE_USAGE_TEXT,
wxCMD_LINE_NONE // to terminate the list
};
// Possible return values of wxCmdLineParser::FoundSwitch()
enum wxCmdLineSwitchState
{
wxCMD_SWITCH_OFF = -1, // Found but turned off/negated.
wxCMD_SWITCH_NOT_FOUND, // Not found at all.
wxCMD_SWITCH_ON // Found in normal state.
};
// ----------------------------------------------------------------------------
// wxCmdLineEntryDesc is a description of one command line
// switch/option/parameter
@ -64,13 +82,17 @@ enum wxCmdLineEntryType
struct wxCmdLineEntryDesc
{
wxCmdLineEntryType kind;
const wxChar *shortName;
const wxChar *longName;
const wxChar *description;
const char *shortName;
const char *longName;
const char *description;
wxCmdLineParamType type;
int flags;
};
// the list of wxCmdLineEntryDesc objects should be terminated with this one
#define wxCMD_LINE_DESC_END \
{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0x0 }
// ----------------------------------------------------------------------------
// wxCmdLineParser is a class for parsing command line.
//
@ -100,6 +122,8 @@ public:
wxCmdLineParser(int argc, char **argv) { Init(); SetCmdLine(argc, argv); }
#if wxUSE_UNICODE
wxCmdLineParser(int argc, wxChar **argv) { Init(); SetCmdLine(argc, argv); }
wxCmdLineParser(int argc, const wxCmdLineArgsArray& argv)
{ Init(); SetCmdLine(argc, argv); }
#endif // wxUSE_UNICODE
wxCmdLineParser(const wxString& cmdline) { Init(); SetCmdLine(cmdline); }
@ -112,6 +136,10 @@ public:
#if wxUSE_UNICODE
wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, wxChar **argv)
{ Init(); SetCmdLine(argc, argv); SetDesc(desc); }
wxCmdLineParser(const wxCmdLineEntryDesc *desc,
int argc,
const wxCmdLineArgsArray& argv)
{ Init(); SetCmdLine(argc, argv); SetDesc(desc); }
#endif // wxUSE_UNICODE
wxCmdLineParser(const wxCmdLineEntryDesc *desc, const wxString& cmdline)
{ Init(); SetCmdLine(cmdline); SetDesc(desc); }
@ -120,6 +148,7 @@ public:
void SetCmdLine(int argc, char **argv);
#if wxUSE_UNICODE
void SetCmdLine(int argc, wxChar **argv);
void SetCmdLine(int argc, const wxCmdLineArgsArray& argv);
#endif // wxUSE_UNICODE
void SetCmdLine(const wxString& cmdline);
@ -138,7 +167,7 @@ public:
void EnableLongOptions(bool enable = true);
void DisableLongOptions() { EnableLongOptions(false); }
bool AreLongOptionsEnabled();
bool AreLongOptionsEnabled() const;
// extra text may be shown by Usage() method if set by this function
void SetLogo(const wxString& logo);
@ -153,18 +182,34 @@ public:
void AddSwitch(const wxString& name, const wxString& lng = wxEmptyString,
const wxString& desc = wxEmptyString,
int flags = 0);
void AddLongSwitch(const wxString& lng,
const wxString& desc = wxEmptyString,
int flags = 0)
{
AddSwitch(wxString(), lng, desc, flags);
}
// an option taking a value of the given type
void AddOption(const wxString& name, const wxString& lng = wxEmptyString,
const wxString& desc = wxEmptyString,
wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
int flags = 0);
void AddLongOption(const wxString& lng,
const wxString& desc = wxEmptyString,
wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
int flags = 0)
{
AddOption(wxString(), lng, desc, type, flags);
}
// a parameter
void AddParam(const wxString& desc = wxEmptyString,
wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
int flags = 0);
// add an explanatory text to be shown to the user in help
void AddUsageText(const wxString& text);
// actions
// -------
@ -177,7 +222,10 @@ public:
int Parse(bool showUsage = true);
// give the usage message describing all program options
void Usage();
void Usage() const;
// return the usage string, call Usage() to directly show it to the user
wxString GetUsageString() const;
// get the command line arguments
// ------------------------------
@ -185,6 +233,12 @@ public:
// returns true if the given switch was found
bool Found(const wxString& name) const;
// Returns wxCMD_SWITCH_NOT_FOUND if the switch was not found at all,
// wxCMD_SWITCH_ON if it was found in normal state and wxCMD_SWITCH_OFF if
// it was found but negated (i.e. followed by "-", this can only happen for
// the switches with wxCMD_LINE_SWITCH_NEGATABLE flag).
wxCmdLineSwitchState FoundSwitch(const wxString& name) const;
// returns true if an option taking a string value was found and stores the
// value in the provided pointer
bool Found(const wxString& name, wxString *value) const;
@ -193,6 +247,10 @@ public:
// the value in the provided pointer
bool Found(const wxString& name, long *value) const;
// returns true if an option taking a double value was found and stores
// the value in the provided pointer
bool Found(const wxString& name, double *value) const;
#if wxUSE_DATETIME
// returns true if an option taking a date value was found and stores the
// value in the provided pointer
@ -209,18 +267,17 @@ public:
void Reset();
// break down the command line in arguments
static wxArrayString ConvertStringToArgs(const wxChar *cmdline);
static wxArrayString
ConvertStringToArgs(const wxString& cmdline,
wxCmdLineSplitType type = wxCMD_LINE_SPLIT_DOS);
private:
// get usage string
wxString GetUsageString();
// common part of all ctors
void Init();
struct wxCmdLineParserData *m_data;
DECLARE_NO_COPY_CLASS(wxCmdLineParser)
wxDECLARE_NO_COPY_CLASS(wxCmdLineParser);
};
#else // !wxUSE_CMDLINE_PARSER
@ -230,10 +287,11 @@ private:
class WXDLLIMPEXP_BASE wxCmdLineParser
{
public:
static wxArrayString ConvertStringToArgs(const wxChar *cmdline);
static wxArrayString
ConvertStringToArgs(const wxString& cmdline,
wxCmdLineSplitType type = wxCMD_LINE_SPLIT_DOS);
};
#endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER
#endif // _WX_CMDLINE_H_

View File

@ -4,7 +4,6 @@
// Author: Julian Smart (extracted from docview.h by VZ)
// Modified by:
// Created: 05.11.00
// RCS-ID: $Id: cmdproc.h 49804 2007-11-10 01:09:42Z VZ $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -22,7 +21,7 @@ class WXDLLIMPEXP_FWD_CORE wxMenu;
// wxCommand: a single command capable of performing itself
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxCommand : public wxObject
class WXDLLIMPEXP_CORE wxCommand : public wxObject
{
public:
wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString);
@ -49,7 +48,7 @@ private:
// wxCommandProcessor: wxCommand manager
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxCommandProcessor : public wxObject
class WXDLLIMPEXP_CORE wxCommandProcessor : public wxObject
{
public:
// if max number of commands is -1, it is unlimited
@ -97,10 +96,7 @@ public:
virtual void ClearCommands();
// Has the current project been changed?
virtual bool IsDirty() const
{
return m_currentCommand && (m_lastSavedCommand != m_currentCommand);
}
virtual bool IsDirty() const;
// Mark the current command as the one where the last save took place
void MarkAsSaved()
@ -137,7 +133,7 @@ protected:
private:
DECLARE_DYNAMIC_CLASS(wxCommandProcessor)
DECLARE_NO_COPY_CLASS(wxCommandProcessor)
wxDECLARE_NO_COPY_CLASS(wxCommandProcessor);
};
#endif // _WX_CMDPROC_H_

View File

@ -4,7 +4,6 @@
// Author: Julian Smart and others
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: cmndata.h 53135 2008-04-12 02:31:04Z VZ $
// Copyright: (c)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -12,134 +11,18 @@
#ifndef _WX_CMNDATA_H_BASE_
#define _WX_CMNDATA_H_BASE_
#include "wx/window.h"
#include "wx/font.h"
#include "wx/encinfo.h"
#include "wx/colour.h"
#include "wx/defs.h"
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/gdicmn.h"
#if wxUSE_STREAMS
#include "wx/stream.h"
#endif
class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase;
class WXDLLEXPORT wxColourData: public wxObject
{
public:
wxColourData();
wxColourData(const wxColourData& data);
virtual ~wxColourData();
void SetChooseFull(bool flag) { m_chooseFull = flag; }
bool GetChooseFull() const { return m_chooseFull; }
void SetColour(const wxColour& colour) { m_dataColour = colour; }
const wxColour& GetColour() const { return m_dataColour; }
wxColour& GetColour() { return m_dataColour; }
// Array of 16 custom colours
void SetCustomColour(int i, const wxColour& colour);
wxColour GetCustomColour(int i);
void operator=(const wxColourData& data);
public:
wxColour m_dataColour;
wxColour m_custColours[16];
bool m_chooseFull;
private:
DECLARE_DYNAMIC_CLASS(wxColourData)
};
class WXDLLEXPORT wxFontData : public wxObject
{
public:
wxFontData();
virtual ~wxFontData();
wxFontData(const wxFontData& data)
: wxObject(),
m_fontColour(data.m_fontColour),
m_showHelp(data.m_showHelp),
m_allowSymbols(data.m_allowSymbols),
m_enableEffects(data.m_enableEffects),
m_initialFont(data.m_initialFont),
m_chosenFont(data.m_chosenFont),
m_minSize(data.m_minSize),
m_maxSize(data.m_maxSize),
m_encoding(data.m_encoding),
m_encodingInfo(data.m_encodingInfo)
{
}
wxFontData& operator=(const wxFontData& data)
{
wxObject::operator=(data);
m_fontColour = data.m_fontColour;
m_showHelp = data.m_showHelp;
m_allowSymbols = data.m_allowSymbols;
m_enableEffects = data.m_enableEffects;
m_initialFont = data.m_initialFont;
m_chosenFont = data.m_chosenFont;
m_minSize = data.m_minSize;
m_maxSize = data.m_maxSize;
m_encoding = data.m_encoding;
m_encodingInfo = data.m_encodingInfo;
return *this;
}
void SetAllowSymbols(bool flag) { m_allowSymbols = flag; }
bool GetAllowSymbols() const { return m_allowSymbols; }
void SetColour(const wxColour& colour) { m_fontColour = colour; }
const wxColour& GetColour() const { return m_fontColour; }
void SetShowHelp(bool flag) { m_showHelp = flag; }
bool GetShowHelp() const { return m_showHelp; }
void EnableEffects(bool flag) { m_enableEffects = flag; }
bool GetEnableEffects() const { return m_enableEffects; }
void SetInitialFont(const wxFont& font) { m_initialFont = font; }
wxFont GetInitialFont() const { return m_initialFont; }
void SetChosenFont(const wxFont& font) { m_chosenFont = font; }
wxFont GetChosenFont() const { return m_chosenFont; }
void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; }
// encoding info is split into 2 parts: the logical wxWin encoding
// (wxFontEncoding) and a structure containing the native parameters for
// it (wxNativeEncodingInfo)
wxFontEncoding GetEncoding() const { return m_encoding; }
void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; }
wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; }
// public for backwards compatibility only: don't use directly
public:
wxColour m_fontColour;
bool m_showHelp;
bool m_allowSymbols;
bool m_enableEffects;
wxFont m_initialFont;
wxFont m_chosenFont;
int m_minSize;
int m_maxSize;
private:
wxFontEncoding m_encoding;
wxNativeEncodingInfo m_encodingInfo;
private:
DECLARE_DYNAMIC_CLASS(wxFontData)
};
#if wxUSE_PRINTING_ARCHITECTURE
/*
* wxPrintData
* Encapsulates printer information (not printer dialog information)
@ -168,7 +51,7 @@ enum wxPrintBin
const int wxPRINTMEDIA_DEFAULT = 0;
class WXDLLEXPORT wxPrintData: public wxObject
class WXDLLIMPEXP_CORE wxPrintData: public wxObject
{
public:
wxPrintData();
@ -177,7 +60,7 @@ public:
int GetNoCopies() const { return m_printNoCopies; }
bool GetCollate() const { return m_printCollate; }
int GetOrientation() const { return m_printOrientation; }
wxPrintOrientation GetOrientation() const { return m_printOrientation; }
bool IsOrientationReversed() const { return m_printOrientationReversed; }
// Is this data OK for showing the print dialog?
@ -197,7 +80,11 @@ public:
void SetNoCopies(int v) { m_printNoCopies = v; }
void SetCollate(bool flag) { m_printCollate = flag; }
void SetOrientation(int orient) { m_printOrientation = orient; }
// Please use the overloaded method below
wxDEPRECATED_INLINE(void SetOrientation(int orient),
m_printOrientation = (wxPrintOrientation)orient; )
void SetOrientation(wxPrintOrientation orient) { m_printOrientation = orient; }
void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; }
void SetPrinterName(const wxString& name) { m_printerName = name; }
@ -213,36 +100,13 @@ public:
wxString GetFilename() const { return m_filename; }
void SetFilename( const wxString &filename ) { m_filename = filename; }
void operator=(const wxPrintData& data);
wxPrintData& operator=(const wxPrintData& data);
char* GetPrivData() const { return m_privData; }
int GetPrivDataLen() const { return m_privDataLen; }
void SetPrivData( char *privData, int len );
#if WXWIN_COMPATIBILITY_2_4
// PostScript-specific data
wxString GetPrinterCommand() const;
wxString GetPrinterOptions() const;
wxString GetPreviewCommand() const;
wxString GetFontMetricPath() const;
double GetPrinterScaleX() const;
double GetPrinterScaleY() const;
long GetPrinterTranslateX() const;
long GetPrinterTranslateY() const;
void SetPrinterCommand(const wxString& command);
void SetPrinterOptions(const wxString& options);
void SetPreviewCommand(const wxString& command);
void SetFontMetricPath(const wxString& path);
void SetPrinterScaleX(double x);
void SetPrinterScaleY(double y);
void SetPrinterScaling(double x, double y);
void SetPrinterTranslateX(long x);
void SetPrinterTranslateY(long y);
void SetPrinterTranslation(long x, long y);
#endif
// Convert between wxPrintData and native data
void ConvertToNative();
void ConvertFromNative();
@ -255,7 +119,7 @@ private:
wxPrintMode m_printMode;
int m_printNoCopies;
int m_printOrientation;
wxPrintOrientation m_printOrientation;
bool m_printOrientationReversed;
bool m_printCollate;
@ -284,7 +148,7 @@ private:
* from the dialog.
*/
class WXDLLEXPORT wxPrintDialogData: public wxObject
class WXDLLIMPEXP_CORE wxPrintDialogData: public wxObject
{
public:
wxPrintDialogData();
@ -301,9 +165,7 @@ public:
bool GetSelection() const { return m_printSelection; }
bool GetCollate() const { return m_printCollate; }
bool GetPrintToFile() const { return m_printToFile; }
#if WXWIN_COMPATIBILITY_2_4
bool GetSetupDialog() const { return m_printSetupDialog; }
#endif
void SetFromPage(int v) { m_printFromPage = v; }
void SetToPage(int v) { m_printToPage = v; }
void SetMinPage(int v) { m_printMinPage = v; }
@ -313,9 +175,7 @@ public:
void SetSelection(bool flag) { m_printSelection = flag; }
void SetCollate(bool flag) { m_printCollate = flag; }
void SetPrintToFile(bool flag) { m_printToFile = flag; }
#if WXWIN_COMPATIBILITY_2_4
void SetSetupDialog(bool flag) { m_printSetupDialog = flag; }
#endif
void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; }
void EnableSelection(bool flag) { m_printEnableSelection = flag; }
void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; }
@ -328,7 +188,7 @@ public:
// Is this data OK for showing the print dialog?
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_printData.Ok() ; }
bool IsOk() const { return m_printData.IsOk() ; }
wxPrintData& GetPrintData() { return m_printData; }
void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
@ -350,9 +210,6 @@ private:
bool m_printEnablePageNumbers;
bool m_printEnableHelp;
bool m_printEnablePrintToFile;
#if WXWIN_COMPATIBILITY_2_4
bool m_printSetupDialog;
#endif
wxPrintData m_printData;
private:
@ -366,7 +223,7 @@ private:
// Compatibility with old name
#define wxPageSetupData wxPageSetupDialogData
class WXDLLEXPORT wxPageSetupDialogData: public wxObject
class WXDLLIMPEXP_CORE wxPageSetupDialogData: public wxObject
{
public:
wxPageSetupDialogData();
@ -391,7 +248,7 @@ public:
// Is this data OK for showing the page setup dialog?
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_printData.Ok() ; }
bool IsOk() const { return m_printData.IsOk() ; }
// If a corresponding paper type is found in the paper database, will set the m_printData
// paper size id member as well.
@ -422,7 +279,7 @@ public:
// Use paper id in wxPrintData to set this object's paper size
void CalculatePaperSizeFromId();
wxPageSetupDialogData& operator=(const wxPageSetupData& data);
wxPageSetupDialogData& operator=(const wxPageSetupDialogData& data);
wxPageSetupDialogData& operator=(const wxPrintData& data);
wxPrintData& GetPrintData() { return m_printData; }

View File

@ -4,7 +4,6 @@
// Author: Francesco Montorsi
// Modified by:
// Created: 8/10/2006
// RCS-ID: $Id: collpane.h 43300 2006-11-11 07:32:08Z RD $
// Copyright: (c) Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -19,6 +18,8 @@
#include "wx/control.h"
// class name
extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsiblePaneNameStr[];
// ----------------------------------------------------------------------------
// wxCollapsiblePaneBase: interface for wxCollapsiblePane
@ -49,16 +50,16 @@ public:
// event types and macros
// ----------------------------------------------------------------------------
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLLPANE_CHANGED, 1102)
END_DECLARE_EVENT_TYPES()
class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent;
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEvent );
class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent
{
public:
wxCollapsiblePaneEvent() {}
wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed)
: wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED, id),
: wxCommandEvent(wxEVT_COLLAPSIBLEPANE_CHANGED, id),
m_bCollapsed(collapsed)
{
SetEventObject(generator);
@ -84,13 +85,13 @@ private:
typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&);
#define wxCollapsiblePaneEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func)
wxEVENT_HANDLER_CAST(wxCollapsiblePaneEventFunction, func)
#define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/collpane.h"
#else
#include "wx/generic/collpaneg.h"
@ -99,6 +100,9 @@ typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEv
#define wxCollapsiblePane wxGenericCollapsiblePane
#endif
// old wxEVT_COMMAND_* constant
#define wxEVT_COMMAND_COLLPANE_CHANGED wxEVT_COLLAPSIBLEPANE_CHANGED
#endif // wxUSE_COLLPANE
#endif // _WX_COLLAPSABLE_PANE_H_BASE_

View File

@ -1,10 +1,9 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/colrdlgg.h
// Name: wx/colordlg.h
// Purpose: wxColourDialog
// Author: Vadim Zeitiln
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: colordlg.h 36623 2006-01-02 14:26:36Z JS $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -16,14 +15,14 @@
#if wxUSE_COLOURDLG
#include "wx/colourdata.h"
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/colordlg.h"
#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__)
#include "wx/mac/colordlg.h"
#include "wx/osx/colordlg.h"
#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/colordlg.h"
#elif defined(__WXPALMOS__)
#include "wx/palmos/colordlg.h"
#else
#include "wx/generic/colrdlgg.h"
@ -31,9 +30,10 @@
#endif
// get the colour from user and return it
wxColour WXDLLEXPORT
wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL,
const wxColour& colInit = wxNullColour, const wxString& caption = wxEmptyString);
WXDLLIMPEXP_CORE wxColour wxGetColourFromUser(wxWindow *parent = NULL,
const wxColour& colInit = wxNullColour,
const wxString& caption = wxEmptyString,
wxColourData *data = NULL);
#endif // wxUSE_COLOURDLG

View File

@ -4,7 +4,6 @@
// Author: Julian Smart
// Modified by: Francesco Montorsi
// Created:
// RCS-ID: $Id: colour.h 53135 2008-04-12 02:31:04Z VZ $
// Copyright: Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -15,38 +14,46 @@
#include "wx/defs.h"
#include "wx/gdiobj.h"
class WXDLLIMPEXP_FWD_CORE wxColour;
// the standard wxColour constructors;
// this macro avoids to repeat these lines across all colour.h files, since
// Set() is a virtual function and thus cannot be called by wxColourBase
// constructors
// A macro to define the standard wxColour constructors:
//
// It avoids the need to repeat these lines across all colour.h files, since
// Set() is a virtual function and thus cannot be called by wxColourBase ctors
#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \
wxColour( ChannelType red, ChannelType green, ChannelType blue, \
ChannelType alpha = wxALPHA_OPAQUE ) \
{ Set(red, green, blue, alpha); } \
wxColour( unsigned long colRGB ) { Set(colRGB); } \
wxColour(const wxString &colourName) { Set(colourName); } \
wxColour(const wxChar *colourName) { Set(colourName); }
wxColour() { Init(); } \
wxColour(ChannelType red, \
ChannelType green, \
ChannelType blue, \
ChannelType alpha = wxALPHA_OPAQUE) \
{ Init(); Set(red, green, blue, alpha); } \
wxColour(unsigned long colRGB) { Init(); Set(colRGB ); } \
wxColour(const wxString& colourName) { Init(); Set(colourName); } \
wxColour(const char *colourName) { Init(); Set(colourName); } \
wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
// flags for wxColour -> wxString conversion (see wxColour::GetAsString)
#define wxC2S_NAME 1 // return colour name, when possible
#define wxC2S_CSS_SYNTAX 2 // return colour in rgb(r,g,b) syntax
#define wxC2S_HTML_SYNTAX 4 // return colour in #rrggbb syntax
enum {
wxC2S_NAME = 1, // return colour name, when possible
wxC2S_CSS_SYNTAX = 2, // return colour in rgb(r,g,b) syntax
wxC2S_HTML_SYNTAX = 4 // return colour in #rrggbb syntax
};
const unsigned char wxALPHA_TRANSPARENT = 0;
const unsigned char wxALPHA_OPAQUE = 0xff;
// a valid but fully transparent colour
#define wxTransparentColour wxColour(0, 0, 0, wxALPHA_TRANSPARENT)
#define wxTransparentColor wxTransparentColour
// ----------------------------------------------------------------------------
// wxVariant support
// ----------------------------------------------------------------------------
#if wxUSE_VARIANT
#include "wx/variant.h"
DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT)
DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLIMPEXP_CORE)
#endif
//-----------------------------------------------------------------------------
@ -54,7 +61,22 @@ DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT)
// code redundancy in all native wxColour implementations
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxColourBase : public wxGDIObject
/* Transition from wxGDIObject to wxObject is incomplete. If your port does
not need the wxGDIObject machinery to handle colors, please add it to the
list of ports which do not need it.
*/
#if defined( __WXMAC__ ) || defined( __WXMSW__ ) || defined( __WXPM__ ) || defined( __WXCOCOA__ )
#define wxCOLOUR_IS_GDIOBJECT 0
#else
#define wxCOLOUR_IS_GDIOBJECT 1
#endif
class WXDLLIMPEXP_CORE wxColourBase : public
#if wxCOLOUR_IS_GDIOBJECT
wxGDIObject
#else
wxObject
#endif
{
public:
// type of a single colour component
@ -71,12 +93,9 @@ public:
ChannelType green,
ChannelType blue,
ChannelType alpha = wxALPHA_OPAQUE)
{ InitRGBA(red,green,blue, alpha); }
{ InitRGBA(red, green, blue, alpha); }
// implemented in colourcmn.cpp
bool Set(const wxChar *str)
{ return FromString(str); }
bool Set(const wxString &str)
{ return FromString(str); }
@ -94,9 +113,6 @@ public:
// accessors
// ---------
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const = 0;
virtual ChannelType Red() const = 0;
virtual ChannelType Green() const = 0;
virtual ChannelType Blue() const = 0;
@ -106,28 +122,98 @@ public:
// implemented in colourcmn.cpp
virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const;
void SetRGB(wxUint32 colRGB)
{
Set((ChannelType)(0xFF & colRGB),
(ChannelType)(0xFF & (colRGB >> 8)),
(ChannelType)(0xFF & (colRGB >> 16)));
}
void SetRGBA(wxUint32 colRGBA)
{
Set((ChannelType)(0xFF & colRGBA),
(ChannelType)(0xFF & (colRGBA >> 8)),
(ChannelType)(0xFF & (colRGBA >> 16)),
(ChannelType)(0xFF & (colRGBA >> 24)));
}
wxUint32 GetRGB() const
{ return Red() | (Green() << 8) | (Blue() << 16); }
wxUint32 GetRGBA() const
{ return Red() | (Green() << 8) | (Blue() << 16) | (Alpha() << 24); }
#if !wxCOLOUR_IS_GDIOBJECT
virtual bool IsOk() const= 0;
// older version, for backwards compatibility only (but not deprecated
// because it's still widely used)
bool Ok() const { return IsOk(); }
#endif
// manipulation
// ------------
// These methods are static because they are mostly used
// within tight loops (where we don't want to instantiate wxColour's)
static void MakeMono (unsigned char* r, unsigned char* g, unsigned char* b, bool on);
static void MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char brightness = 255);
static void MakeGrey (unsigned char* r, unsigned char* g, unsigned char* b); // integer version
static void MakeGrey (unsigned char* r, unsigned char* g, unsigned char* b,
double weight_r, double weight_g, double weight_b); // floating point version
static unsigned char AlphaBlend (unsigned char fg, unsigned char bg, double alpha);
static void ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b, int ialpha);
wxColour ChangeLightness(int ialpha) const;
wxColour& MakeDisabled(unsigned char brightness = 255);
// old, deprecated
// ---------------
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( static wxColour CreateByName(const wxString& name) );
static wxDEPRECATED( wxColour CreateByName(const wxString& name) );
wxDEPRECATED( void InitFromName(const wxString& col) );
#endif
protected:
// Some ports need Init() and while we don't, provide a stub so that the
// ports which don't need it are not forced to define it
void Init() { }
virtual void
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0;
virtual bool FromString(const wxChar *s);
virtual bool FromString(const wxString& s);
#if wxCOLOUR_IS_GDIOBJECT
// wxColour doesn't use reference counted data (at least not in all ports)
// so provide stubs for the functions which need to be defined if we do use
// them
virtual wxGDIRefData *CreateGDIRefData() const
{
wxFAIL_MSG( "must be overridden if used" );
return NULL;
}
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const
{
wxFAIL_MSG( "must be overridden if used" );
return NULL;
}
#endif
};
// wxColour <-> wxString utilities, used by wxConfig, defined in colourcmn.cpp
WXDLLIMPEXP_CORE wxString wxToString(const wxColourBase& col);
WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col);
#if defined(__WXPALMOS__)
#include "wx/generic/colour.h"
#elif defined(__WXMSW__)
#if defined(__WXMSW__)
#include "wx/msw/colour.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/colour.h"
@ -135,14 +221,12 @@ protected:
#include "wx/gtk/colour.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/colour.h"
#elif defined(__WXMGL__)
#include "wx/generic/colour.h"
#elif defined(__WXDFB__)
#include "wx/generic/colour.h"
#elif defined(__WXX11__)
#include "wx/x11/colour.h"
#elif defined(__WXMAC__)
#include "wx/mac/colour.h"
#include "wx/osx/colour.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/colour.h"
#elif defined(__WXPM__)

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/colourdata.h
// Author: Julian Smart
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLOURDATA_H_
#define _WX_COLOURDATA_H_
#include "wx/colour.h"
class WXDLLIMPEXP_CORE wxColourData : public wxObject
{
public:
// number of custom colours we store
enum
{
NUM_CUSTOM = 16
};
wxColourData();
wxColourData(const wxColourData& data);
wxColourData& operator=(const wxColourData& data);
virtual ~wxColourData();
void SetChooseFull(bool flag) { m_chooseFull = flag; }
bool GetChooseFull() const { return m_chooseFull; }
void SetColour(const wxColour& colour) { m_dataColour = colour; }
const wxColour& GetColour() const { return m_dataColour; }
wxColour& GetColour() { return m_dataColour; }
// SetCustomColour() modifies colours in an internal array of NUM_CUSTOM
// custom colours;
void SetCustomColour(int i, const wxColour& colour);
wxColour GetCustomColour(int i) const;
// Serialize the object to a string and restore it from it
wxString ToString() const;
bool FromString(const wxString& str);
// public for backwards compatibility only: don't use directly
wxColour m_dataColour;
wxColour m_custColours[NUM_CUSTOM];
bool m_chooseFull;
DECLARE_DYNAMIC_CLASS(wxColourData)
};
#endif // _WX_COLOURDATA_H_

View File

@ -4,7 +4,6 @@
// Author: Jaakko Salli
// Modified by:
// Created: Apr-30-2006
// RCS-ID: $Id: combo.h 64412 2010-05-27 15:11:58Z JMS $
// Copyright: (c) Jaakko Salli
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -45,6 +44,7 @@
#include "wx/control.h"
#include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags
#include "wx/bitmap.h" // wxBitmap used by-value
#include "wx/textentry.h"
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
class WXDLLIMPEXP_FWD_CORE wxComboPopup;
@ -86,8 +86,8 @@ enum
wxCC_IFLAG_CREATED = 0x0100,
// Internal use: really put button outside
wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200,
// Internal use: SetTextIndent has been called
wxCC_IFLAG_INDENT_SET = 0x0400,
// Internal use: SetMargins has been successfully called
wxCC_IFLAG_LEFT_MARGIN_SET = 0x0400,
// Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed
wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800,
// Internal use: Secondary popup window type should be used (if available).
@ -119,7 +119,8 @@ struct wxComboCtrlFeatures
BitmapButton = 0x0002, // Button may be replaced with bitmap
ButtonSpacing = 0x0004, // Button can have spacing from the edge
// of the control
TextIndent = 0x0008, // SetTextIndent can be used
TextIndent = 0x0008, // SetMargins can be used to control
// left margin.
PaintControl = 0x0010, // Combo control itself can be custom painted
PaintWritable = 0x0020, // A variable-width area in front of writable
// combo control's textctrl can be custom
@ -138,12 +139,14 @@ struct wxComboCtrlFeatures
};
class WXDLLEXPORT wxComboCtrlBase : public wxControl
class WXDLLIMPEXP_CORE wxComboCtrlBase : public wxControl,
public wxTextEntry
{
friend class wxComboPopup;
friend class wxComboPopupEvtHandler;
public:
// ctors and such
wxComboCtrlBase() : wxControl() { Init(); }
wxComboCtrlBase() : wxControl(), wxTextEntry() { Init(); }
bool Create(wxWindow *parent,
wxWindowID id,
@ -156,9 +159,19 @@ public:
virtual ~wxComboCtrlBase();
// show/hide popup window
// Show/hide popup window (wxComboBox-compatible methods)
virtual void Popup();
virtual void Dismiss()
{
HidePopup(true);
}
// Show/hide popup window.
// TODO: Maybe deprecate in favor of Popup()/Dismiss().
// However, these functions are still called internally
// so it is not straightforward.
virtual void ShowPopup();
virtual void HidePopup();
virtual void HidePopup(bool generateEvent=false);
// Override for totally custom combo action
virtual void OnButtonClick();
@ -194,26 +207,56 @@ public:
virtual bool Enable(bool enable = true);
virtual bool Show(bool show = true);
virtual bool SetFont(const wxFont& font);
#if wxUSE_VALIDATORS
virtual void SetValidator(const wxValidator &validator);
virtual wxValidator *GetValidator();
#endif // wxUSE_VALIDATORS
// wxTextCtrl methods - for readonly combo they should return
// without errors.
virtual wxString GetValue() const;
virtual void SetValue(const wxString& value);
//
// wxTextEntry methods
//
// NB: We basically need to override all of them because there is
// no guarantee how platform-specific wxTextEntry is implemented.
//
virtual void SetValue(const wxString& value)
{ wxTextEntryBase::SetValue(value); }
virtual void ChangeValue(const wxString& value)
{ wxTextEntryBase::ChangeValue(value); }
virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text)
{ wxTextEntryBase::AppendText(text); }
virtual wxString GetValue() const
{ return wxTextEntryBase::GetValue(); }
virtual wxString GetRange(long from, long to) const
{ return wxTextEntryBase::GetRange(from, to); }
// Replace() and DoSetValue() need to be fully re-implemented since
// EventSuppressor utility class does not work with the way
// wxComboCtrl is implemented.
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual void Undo();
virtual void Redo();
virtual bool CanUndo() const;
virtual bool CanRedo() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void Undo();
virtual void GetSelection(long *from, long *to) const;
virtual bool IsEditable() const;
virtual void SetEditable(bool editable);
virtual bool SetHint(const wxString& hint);
virtual wxString GetHint() const;
// This method sets the text without affecting list selection
// (ie. wxComboPopup::SetStringValue doesn't get called).
@ -221,7 +264,13 @@ public:
// This method sets value and also optionally sends EVT_TEXT
// (needed by combo popups)
void SetValueWithEvent(const wxString& value, bool withEvent = true);
wxDEPRECATED( void SetValueWithEvent(const wxString& value,
bool withEvent = true) );
// Changes value of the control as if user had done it by selecting an
// item from a combo box drop-down list. Needs to be public so that
// derived popup classes can call it.
void SetValueByUser(const wxString& value);
//
// Popup customization methods
@ -303,19 +352,18 @@ public:
const wxBitmap& bmpHover = wxNullBitmap,
const wxBitmap& bmpDisabled = wxNullBitmap );
#if WXWIN_COMPATIBILITY_2_8
//
// This will set the space in pixels between left edge of the control and the
// text, regardless whether control is read-only (ie. no wxTextCtrl) or not.
// Platform-specific default can be set with value-1.
// Remarks
// * This method may do nothing on some native implementations.
void SetTextIndent( int indent );
wxDEPRECATED( void SetTextIndent( int indent ) );
// Returns actual indentation in pixels.
wxCoord GetTextIndent() const
{
return m_absIndent;
}
wxDEPRECATED( wxCoord GetTextIndent() const );
#endif
// Returns area covered by the text field.
const wxRect& GetTextRect() const
@ -386,14 +434,21 @@ public:
const wxBitmap& GetBitmapHover() const { return m_bmpHover; }
const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
// Set custom style flags for embedded wxTextCtrl. Usually must be used
// with two-step creation, before Create() call.
void SetTextCtrlStyle( int style );
// Return internal flags
wxUint32 GetInternalFlags() const { return m_iFlags; }
// Return true if Create has finished
bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; }
// Need to override to return text area background colour
wxColour GetBackgroundColour() const;
// common code to be called on popup hide/dismiss
void OnPopupDismiss();
void OnPopupDismiss(bool generateEvent);
// PopupShown states
enum
@ -411,8 +466,26 @@ public:
// Set value returned by GetMainWindowOfCompositeControl
void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; }
// This is public so we can access it from wxComboCtrlTextCtrl
virtual wxWindow *GetMainWindowOfCompositeControl()
{ return m_mainCtrlWnd; }
// also set the embedded wxTextCtrl colours
virtual bool SetForegroundColour(const wxColour& colour);
virtual bool SetBackgroundColour(const wxColour& colour);
protected:
// Returns true if hint text should be drawn in the control
bool ShouldUseHintText(int flags = 0) const
{
return ( !m_text &&
!(flags & wxCONTROL_ISSUBMENU) &&
!m_valueString.length() &&
m_hintText.length() &&
!ShouldDrawFocus() );
}
//
// Override these for customization purposes
//
@ -420,7 +493,8 @@ protected:
// called from wxSizeEvent handler
virtual void OnResize() = 0;
// Return native text identation (for pure text, not textctrl)
// Return native text identation
// (i.e. text margin, for pure text, not textctrl)
virtual wxCoord GetNativeTextIndent() const;
// Called in syscolourchanged handler and base create
@ -428,20 +502,25 @@ protected:
// Creates wxTextCtrl.
// extraStyle: Extra style parameters
void CreateTextCtrl( int extraStyle, const wxValidator& validator );
void CreateTextCtrl( int extraStyle );
// Called when text was changed programmatically
// (e.g. from WriteText())
void OnSetValue(const wxString& value);
// Installs standard input handler to combo (and optionally to the textctrl)
void InstallInputHandlers();
// flags for DrawButton()
// Flags for DrawButton
enum
{
Draw_PaintBg = 1,
Draw_BitmapOnly = 2
Button_PaintBackground = 0x0001, // Paints control background below the button
Button_BitmapOnly = 0x0002 // Only paints the bitmap
};
// Draws dropbutton. Using wxRenderer or bitmaps, as appropriate.
void DrawButton( wxDC& dc, const wxRect& rect, int flags = Draw_PaintBg );
// Flags are defined above.
virtual void DrawButton( wxDC& dc, const wxRect& rect, int flags = Button_PaintBackground );
// Call if cursor is on button area or mouse is captured for the button.
//bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside );
@ -465,7 +544,10 @@ protected:
void DestroyPopup();
// override the base class virtuals involved in geometry calculations
// The common version only sets a default width, so the derived classes
// should override it and set the height and change the width as needed.
virtual wxSize DoGetBestSize() const;
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
// NULL popup can be used to indicate default in a derived class
virtual void DoSetPopupControl(wxComboPopup* popup);
@ -478,9 +560,10 @@ protected:
// just recalculate.
void CalculateAreas( int btnWidth = 0 );
// Standard textctrl positioning routine. Just give it platform-dependant
// Standard textctrl positioning routine. Just give it platform-dependent
// textctrl coordinate adjustment.
void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust );
virtual void PositionTextCtrl( int textCtrlXAdjust = 0,
int textCtrlYAdjust = 0);
// event handlers
void OnSizeEvent( wxSizeEvent& event );
@ -489,6 +572,7 @@ protected:
void OnTextCtrlEvent(wxCommandEvent& event);
void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnKeyEvent(wxKeyEvent& event);
void OnCharEvent(wxKeyEvent& event);
// Set customization flags (directs how wxComboCtrlBase helpers behave)
void Customize( wxUint32 flags ) { m_iFlags |= flags; }
@ -517,12 +601,21 @@ protected:
virtual void DoSetToolTip( wxToolTip *tip );
#endif
virtual wxWindow *GetMainWindowOfCompositeControl()
{ return m_mainCtrlWnd; }
// protected wxTextEntry methods
virtual void DoSetValue(const wxString& value, int flags);
virtual wxString DoGetValue() const;
virtual wxWindow *GetEditableWindow() { return this; }
// margins functions
virtual bool DoSetMargins(const wxPoint& pt);
virtual wxPoint DoGetMargins() const;
// This is used when m_text is hidden (readonly).
wxString m_valueString;
// This is used when control is unfocused and m_valueString is empty
wxString m_hintText;
// the text control and button we show all the time
wxTextCtrl* m_text;
wxWindow* m_btn;
@ -543,7 +636,7 @@ protected:
wxEvtHandler* m_toplevEvtHandler;
// this is for the control in popup
wxEvtHandler* m_popupExtraHandler;
wxEvtHandler* m_popupEvtHandler;
// this is for the popup window
wxEvtHandler* m_popupWinEvtHandler;
@ -551,7 +644,7 @@ protected:
// main (ie. topmost) window of a composite control (default = this)
wxWindow* m_mainCtrlWnd;
// used to prevent immediate re-popupping incase closed popup
// used to prevent immediate re-popupping in case closed popup
// by clicking on the combo control (needed because of inconsistent
// transient implementation across platforms).
wxLongLong m_timeCanAcceptClick;
@ -571,8 +664,8 @@ protected:
// selection indicator.
wxCoord m_widthCustomPaint;
// absolute text indentation, in pixels
wxCoord m_absIndent;
// left margin, in pixels
wxCoord m_marginLeft;
// side on which the popup is aligned
int m_anchorSide;
@ -584,6 +677,9 @@ protected:
wxRect m_tcArea;
wxRect m_btnArea;
// Colour of the text area, in case m_text is NULL
wxColour m_tcBgCol;
// current button state (uses renderer flags)
int m_btnState;
@ -605,9 +701,12 @@ protected:
// area used by the button
wxSize m_btnSize;
// platform-dependant customization and other flags
// platform-dependent customization and other flags
wxUint32 m_iFlags;
// custom style for m_text
int m_textCtrlStyle;
// draw blank button background under bitmap?
bool m_blankButtonBg;
@ -616,7 +715,10 @@ protected:
// should the focus be reset to the textctrl in idle time?
bool m_resetFocus;
// is the text-area background colour overridden?
bool m_hasTcBgCol;
private:
void Init();
@ -643,14 +745,16 @@ enum
wxCP_IFLAG_CREATED = 0x0001 // Set by wxComboCtrlBase after Create is called
};
class WXDLLIMPEXP_FWD_CORE wxComboCtrl;
class WXDLLEXPORT wxComboPopup
class WXDLLIMPEXP_CORE wxComboPopup
{
friend class wxComboCtrlBase;
public:
wxComboPopup()
{
m_combo = (wxComboCtrlBase*) NULL;
m_combo = NULL;
m_iFlags = 0;
}
@ -666,6 +770,13 @@ public:
// Return true for success.
virtual bool Create(wxWindow* parent) = 0;
// Calls Destroy() for the popup control (i.e. one returned by
// GetControl()) and makes sure that 'this' is deleted at the end.
// Default implementation works for both cases where popup control
// class is multiple inherited or created on heap as a separate
// object.
virtual void DestroyPopup();
// We must have an associated control which is subclassed by the combobox.
virtual wxWindow *GetControl() = 0;
@ -682,14 +793,25 @@ public:
// Gets displayed string representation of the value.
virtual wxString GetStringValue() const = 0;
// Called to check if the popup - when an item container - actually
// has matching item. Case-sensitivity checking etc. is up to the
// implementation. If the found item matched the string, but is
// different, it should be written back to pItem. Default implementation
// always return true and does not alter trueItem.
virtual bool FindItem(const wxString& item, wxString* trueItem=NULL);
// This is called to custom paint in the combo control itself (ie. not the popup).
// Default implementation draws value as string.
virtual void PaintComboControl( wxDC& dc, const wxRect& rect );
// Receives key events from the parent wxComboCtrl.
// Receives wxEVT_KEY_DOWN key events from the parent wxComboCtrl.
// Events not handled should be skipped, as usual.
virtual void OnComboKeyEvent( wxKeyEvent& event );
// Receives wxEVT_CHAR key events from the parent wxComboCtrl.
// Events not handled should be skipped, as usual.
virtual void OnComboCharEvent( wxKeyEvent& event );
// Implement if you need to support special action when user
// double-clicks on the parent wxComboCtrl.
virtual void OnComboDoubleClick();
@ -720,6 +842,9 @@ public:
return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false;
}
// Returns pointer to the associated parent wxComboCtrl.
wxComboCtrl* GetComboCtrl() const;
// Default PaintComboControl behaviour
static void DefaultPaintComboControl( wxComboCtrlBase* combo,
wxDC& dc,

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 24.12.00
// RCS-ID: $Id: combobox.h 42727 2006-10-30 16:04:27Z VZ $
// Copyright: (c) 1996-2000 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -16,57 +15,54 @@
#if wxUSE_COMBOBOX
extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[];
// For compatibility with 2.8 include this header to allow using wxTE_XXX
// styles with wxComboBox without explicitly including it in the user code.
#include "wx/textctrl.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
// ----------------------------------------------------------------------------
// wxComboBoxBase: this interface defines the methods wxComboBox must implement
// ----------------------------------------------------------------------------
#include "wx/textctrl.h"
#include "wx/ctrlsub.h"
#include "wx/textentry.h"
class WXDLLEXPORT wxComboBoxBase : public wxItemContainer
class WXDLLIMPEXP_CORE wxComboBoxBase : public wxItemContainer,
public wxTextEntry
{
public:
// wxTextCtrl-like methods wxComboBox must implement
virtual wxString GetValue() const = 0;
virtual void SetValue(const wxString& value) = 0;
// override these methods to disambiguate between two base classes versions
virtual void Clear()
{
wxTextEntry::Clear();
wxItemContainer::Clear();
}
virtual void Copy() = 0;
virtual void Cut() = 0;
virtual void Paste() = 0;
virtual void SetInsertionPoint(long pos) = 0;
virtual long GetInsertionPoint() const = 0;
virtual wxTextPos GetLastPosition() const = 0;
virtual void Replace(long from, long to, const wxString& value) = 0;
virtual void SetSelection(long from, long to) = 0;
virtual void SetEditable(bool editable) = 0;
// IsEmpty() is ambiguous because we inherit it from both wxItemContainer
// and wxTextEntry, and even if defined it here to help the compiler with
// choosing one of them, it would still be confusing for the human users of
// this class. So instead define the clearly named methods below and leave
// IsEmpty() ambiguous to trigger a compilation error if it's used.
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
virtual void SetInsertionPointEnd()
{ SetInsertionPoint(GetLastPosition()); }
virtual void Remove(long from, long to)
{ Replace(from, to, wxEmptyString); }
// also bring in GetSelection() versions of both base classes in scope
//
// NB: GetSelection(from, to) could be already implemented in wxTextEntry
// but still make it pure virtual because for some platforms it's not
// implemented there and also because the derived class has to override
// it anyhow to avoid ambiguity with the other GetSelection()
virtual int GetSelection() const = 0;
virtual void GetSelection(long *from, long *to) const = 0;
virtual bool IsEditable() const = 0;
virtual void Undo() = 0;
virtual void Redo() = 0;
virtual void SelectAll() = 0;
virtual bool CanCopy() const = 0;
virtual bool CanCut() const = 0;
virtual bool CanPaste() const = 0;
virtual bool CanUndo() const = 0;
virtual bool CanRedo() const = 0;
virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); }
virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); }
// may return value different from GetSelection() when the combobox
// dropdown is shown and the user selected, but not yet accepted, a value
// different from the old one in it
virtual int GetCurrentSelection() const { return GetSelection(); }
// redeclare inherited SetSelection() overload here as well to avoid
// virtual function hiding
virtual void SetSelection(int n) = 0;
};
// ----------------------------------------------------------------------------
@ -84,7 +80,7 @@ public:
#elif defined(__WXGTK__)
#include "wx/gtk1/combobox.h"
#elif defined(__WXMAC__)
#include "wx/mac/combobox.h"
#include "wx/osx/combobox.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/combobox.h"
#elif defined(__WXPM__)
@ -93,5 +89,4 @@ public:
#endif // wxUSE_COMBOBOX
#endif
// _WX_COMBOBOX_H_BASE_
#endif // _WX_COMBOBOX_H_BASE_

View File

@ -0,0 +1,169 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/commandlinkbutton.h
// Purpose: wxCommandLinkButtonBase and wxGenericCommandLinkButton classes
// Author: Rickard Westerlund
// Created: 2010-06-11
// Copyright: (c) 2010 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COMMANDLINKBUTTON_H_
#define _WX_COMMANDLINKBUTTON_H_
#include "wx/defs.h"
#if wxUSE_COMMANDLINKBUTTON
#include "wx/button.h"
// ----------------------------------------------------------------------------
// Command link button common base class
// ----------------------------------------------------------------------------
// This class has separate "main label" (title-like string) and (possibly
// multiline) "note" which can be set and queried separately but can also be
// set both at once by joining them with a new line and setting them as a
// label and queried by breaking the label into the parts before the first new
// line and after it.
class WXDLLIMPEXP_ADV wxCommandLinkButtonBase : public wxButton
{
public:
wxCommandLinkButtonBase() : wxButton() { }
wxCommandLinkButtonBase(wxWindow *parent,
wxWindowID id,
const wxString& mainLabel = wxEmptyString,
const wxString& note = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator =
wxDefaultValidator,
const wxString& name = wxButtonNameStr)
: wxButton(parent,
id,
mainLabel + '\n' + note,
pos,
size,
style,
validator,
name)
{ }
virtual void SetMainLabelAndNote(const wxString& mainLabel,
const wxString& note) = 0;
virtual void SetMainLabel(const wxString& mainLabel)
{
SetMainLabelAndNote(mainLabel, GetNote());
}
virtual void SetNote(const wxString& note)
{
SetMainLabelAndNote(GetMainLabel(), note);
}
virtual wxString GetMainLabel() const
{
return GetLabel().BeforeFirst('\n');
}
virtual wxString GetNote() const
{
return GetLabel().AfterFirst('\n');
}
protected:
virtual bool HasNativeBitmap() const { return false; }
private:
wxDECLARE_NO_COPY_CLASS(wxCommandLinkButtonBase);
};
// ----------------------------------------------------------------------------
// Generic command link button
// ----------------------------------------------------------------------------
// Trivial generic implementation simply using a multiline label to show both
// the main label and the note.
class WXDLLIMPEXP_ADV wxGenericCommandLinkButton
: public wxCommandLinkButtonBase
{
public:
wxGenericCommandLinkButton() : wxCommandLinkButtonBase() { }
wxGenericCommandLinkButton(wxWindow *parent,
wxWindowID id,
const wxString& mainLabel = wxEmptyString,
const wxString& note = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
: wxCommandLinkButtonBase()
{
Create(parent, id, mainLabel, note, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& mainLabel = wxEmptyString,
const wxString& note = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
virtual void SetMainLabelAndNote(const wxString& mainLabel,
const wxString& note)
{
wxButton::SetLabel(mainLabel + '\n' + note);
}
private:
void SetDefaultBitmap();
wxDECLARE_NO_COPY_CLASS(wxGenericCommandLinkButton);
};
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/commandlinkbutton.h"
#else
class WXDLLIMPEXP_ADV wxCommandLinkButton : public wxGenericCommandLinkButton
{
public:
wxCommandLinkButton() : wxGenericCommandLinkButton() { }
wxCommandLinkButton(wxWindow *parent,
wxWindowID id,
const wxString& mainLabel = wxEmptyString,
const wxString& note = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
: wxGenericCommandLinkButton(parent,
id,
mainLabel,
note,
pos,
size,
style,
validator,
name)
{ }
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCommandLinkButton);
};
#endif // __WXMSW__/!__WXMSW__
#endif // wxUSE_COMMANDLINKBUTTON
#endif // _WX_COMMANDLINKBUTTON_H_

View File

@ -0,0 +1,144 @@
/*
* Name: wx/compiler.h
* Purpose: Compiler-specific macro definitions.
* Author: Vadim Zeitlin
* Created: 2013-07-13 (extracted from wx/platform.h)
* Copyright: (c) 1997-2013 Vadim Zeitlin <vadim@wxwidgets.org>
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_COMPILER_H_
#define _WX_COMPILER_H_
/*
Compiler detection and related helpers.
*/
/*
Notice that Intel compiler can be used as Microsoft Visual C++ add-on and
so we should define both __INTELC__ and __VISUALC__ for it.
*/
#ifdef __INTEL_COMPILER
# define __INTELC__
#endif
#if defined(_MSC_VER)
/*
define another standard symbol for Microsoft Visual C++: the standard
one (_MSC_VER) is also defined by some other compilers.
*/
# define __VISUALC__ _MSC_VER
/*
define special symbols for different VC version instead of writing tests
for magic numbers such as 1200, 1300 &c repeatedly
*/
#if __VISUALC__ < 1100
# error "This Visual C++ version is too old and not supported any longer."
#elif __VISUALC__ < 1200
# define __VISUALC5__
#elif __VISUALC__ < 1300
# define __VISUALC6__
#elif __VISUALC__ < 1400
# define __VISUALC7__
#elif __VISUALC__ < 1500
# define __VISUALC8__
#elif __VISUALC__ < 1600
# define __VISUALC9__
#elif __VISUALC__ < 1700
# define __VISUALC10__
#elif __VISUALC__ < 1800
# define __VISUALC11__
#elif __VISUALC__ < 1900
# define __VISUALC12__
#elif __VISUAL__C < 2000
# define __VISUALC14__
#else
# pragma message("Please update wx/compiler.h to recognize this VC++ version")
#endif
#elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
# define __BORLANDC__
#elif defined(__WATCOMC__)
#elif defined(__SC__)
# define __SYMANTECC__
#elif defined(__SUNPRO_CC)
# ifndef __SUNCC__
# define __SUNCC__ __SUNPRO_CC
# endif /* Sun CC */
#elif defined(__SC__)
# ifdef __DMC__
# define __DIGITALMARS__
# else
# define __SYMANTEC__
# endif
#endif /* compiler */
/*
Macros for checking compiler version.
*/
/*
This macro can be used to test the gcc version and can be used like this:
# if wxCHECK_GCC_VERSION(3, 1)
... we have gcc 3.1 or later ...
# else
... no gcc at all or gcc < 3.1 ...
# endif
*/
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#define wxCHECK_GCC_VERSION( major, minor ) \
( ( __GNUC__ > (major) ) \
|| ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) )
#else
#define wxCHECK_GCC_VERSION( major, minor ) 0
#endif
/*
This macro can be used to test the Visual C++ version.
*/
#ifndef __VISUALC__
# define wxVISUALC_VERSION(major) 0
# define wxCHECK_VISUALC_VERSION(major) 0
#else
# define wxVISUALC_VERSION(major) ( (6 + major) * 100 )
# define wxCHECK_VISUALC_VERSION(major) ( __VISUALC__ >= wxVISUALC_VERSION(major) )
#endif
/**
This is similar to wxCHECK_GCC_VERSION but for Sun CC compiler.
*/
#ifdef __SUNCC__
/*
__SUNCC__ is 0xVRP where V is major version, R release and P patch level
*/
#define wxCHECK_SUNCC_VERSION(maj, min) (__SUNCC__ >= (((maj)<<8) | ((min)<<4)))
#else
#define wxCHECK_SUNCC_VERSION(maj, min) (0)
#endif
#ifndef __WATCOMC__
# define wxWATCOM_VERSION(major,minor) 0
# define wxCHECK_WATCOM_VERSION(major,minor) 0
# define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0
# define WX_WATCOM_ONLY_CODE( x )
#else
# if __WATCOMC__ < 1200
# error "Only Open Watcom is supported in this release"
# endif
# define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 )
# define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) )
# define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) )
# define WX_WATCOM_ONLY_CODE( x ) x
#endif
/*
wxCHECK_MINGW32_VERSION() is defined in wx/msw/gccpriv.h which is included
later, see comments there.
*/
#endif // _WX_COMPILER_H_

View File

@ -0,0 +1,229 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/compositewin.h
// Purpose: wxCompositeWindow<> declaration
// Author: Vadim Zeitlin
// Created: 2011-01-02
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COMPOSITEWIN_H_
#define _WX_COMPOSITEWIN_H_
#include "wx/window.h"
#include "wx/containr.h"
class WXDLLIMPEXP_FWD_CORE wxToolTip;
// NB: This is an experimental and, as for now, undocumented class used only by
// wxWidgets itself internally. Don't use it in your code until its API is
// officially stabilized unless you are ready to change it with the next
// wxWidgets release.
// ----------------------------------------------------------------------------
// wxCompositeWindow is a helper for implementing composite windows: to define
// a class using subwindows, simply inherit from it specialized with the real
// base class name and implement GetCompositeWindowParts() pure virtual method.
// ----------------------------------------------------------------------------
// The template parameter W must be a wxWindow-derived class.
template <class W>
class wxCompositeWindow : public W
{
public:
typedef W BaseWindowClass;
// Default ctor doesn't do anything.
wxCompositeWindow()
{
this->Connect
(
wxEVT_CREATE,
wxWindowCreateEventHandler(wxCompositeWindow::OnWindowCreate)
);
}
#ifndef __VISUALC6__
// FIXME-VC6: This compiler can't compile DoSetForAllParts() template function,
// it can't determine whether the deduced type should be "T" or "const T&". And
// without this function wxCompositeWindow is pretty useless so simply disable
// this code for it, this does mean that setting colours/fonts/... for
// composite controls won't work in the library compiled with it but so far
// this only affects the generic wxDatePickerCtrl which is not used by default
// under MSW anyhow so it doesn't seem to be worth it to spend time and uglify
// the code to fix it.
// Override all wxWindow methods which must be forwarded to the composite
// window parts.
// Attribute setters group.
//
// NB: Unfortunately we can't factor out the call for the setter itself
// into DoSetForAllParts() because we can't call the function passed to
// it non-virtually and we need to do this to avoid infinite recursion,
// so we work around this by calling the method of this object itself
// manually in each function.
virtual bool SetForegroundColour(const wxColour& colour)
{
if ( !BaseWindowClass::SetForegroundColour(colour) )
return false;
SetForAllParts(&wxWindowBase::SetForegroundColour, colour);
return true;
}
virtual bool SetBackgroundColour(const wxColour& colour)
{
if ( !BaseWindowClass::SetBackgroundColour(colour) )
return false;
SetForAllParts(&wxWindowBase::SetBackgroundColour, colour);
return true;
}
virtual bool SetFont(const wxFont& font)
{
if ( !BaseWindowClass::SetFont(font) )
return false;
SetForAllParts(&wxWindowBase::SetFont, font);
return true;
}
virtual bool SetCursor(const wxCursor& cursor)
{
if ( !BaseWindowClass::SetCursor(cursor) )
return false;
SetForAllParts(&wxWindowBase::SetCursor, cursor);
return true;
}
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip(wxToolTip *tip)
{
BaseWindowClass::DoSetToolTip(tip);
SetForAllParts(&wxWindowBase::CopyToolTip, tip);
}
#endif // wxUSE_TOOLTIPS
#endif // !__VISUALC6__
virtual void SetFocus()
{
wxSetFocusToChild(this, NULL);
}
private:
// Must be implemented by the derived class to return all children to which
// the public methods we override should forward to.
virtual wxWindowList GetCompositeWindowParts() const = 0;
void OnWindowCreate(wxWindowCreateEvent& event)
{
event.Skip();
// Attach a few event handlers to all parts of the composite window.
// This makes the composite window behave more like a simple control
// and allows other code (such as wxDataViewCtrl's inline editing
// support) to hook into its event processing.
wxWindow *child = event.GetWindow();
if ( child == this )
return; // not a child, we don't want to Connect() to ourselves
// Always capture wxEVT_KILL_FOCUS:
child->Connect(wxEVT_KILL_FOCUS,
wxFocusEventHandler(wxCompositeWindow::OnKillFocus),
NULL, this);
// Some events should be only handled for non-toplevel children. For
// example, we want to close the control in wxDataViewCtrl when Enter
// is pressed in the inline editor, but not when it's pressed in a
// popup dialog it opens.
wxWindow *win = child;
while ( win && win != this )
{
if ( win->IsTopLevel() )
return;
win = win->GetParent();
}
child->Connect(wxEVT_CHAR,
wxKeyEventHandler(wxCompositeWindow::OnChar),
NULL, this);
}
void OnChar(wxKeyEvent& event)
{
if ( !this->ProcessWindowEvent(event) )
event.Skip();
}
void OnKillFocus(wxFocusEvent& event)
{
// Ignore focus changes within the composite control:
wxWindow *win = event.GetWindow();
while ( win )
{
if ( win == this )
{
event.Skip();
return;
}
// Note that we don't use IsTopLevel() check here, because we do
// want to ignore focus changes going to toplevel window that have
// the composite control as its parent; these would typically be
// some kind of control's popup window.
win = win->GetParent();
}
// The event shouldn't be ignored, forward it to the main control:
if ( !this->ProcessWindowEvent(event) )
event.Skip();
}
#ifndef __VISUALC6__
template <class T>
void SetForAllParts(bool (wxWindowBase::*func)(const T&), const T& arg)
{
DoSetForAllParts<const T&>(func, arg);
}
template <class T>
void SetForAllParts(bool (wxWindowBase::*func)(T*), T* arg)
{
DoSetForAllParts<T*>(func, arg);
}
template <class T>
void DoSetForAllParts(bool (wxWindowBase::*func)(T), T arg)
{
// Simply call the setters for all parts of this composite window.
const wxWindowList parts = GetCompositeWindowParts();
for ( wxWindowList::const_iterator i = parts.begin();
i != parts.end();
++i )
{
wxWindow * const child = *i;
// Allow NULL elements in the list, this makes the code of derived
// composite controls which may have optionally shown children
// simpler and it doesn't cost us much here.
if ( child )
(child->*func)(arg);
}
}
#endif // !__VISUALC6__
wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindow, W);
};
#endif // _WX_COMPOSITEWIN_H_

View File

@ -1,21 +1,22 @@
///////////////////////////////////////////////////////////////////////////////
// Name: confbase.h
// Name: wx/confbase.h
// Purpose: declaration of the base class of all config implementations
// (see also: fileconf.h and msw/regconf.h and iniconf.h)
// Author: Karsten Ballueder & Vadim Zeitlin
// Modified by:
// Created: 07.04.98 (adapted from appconf.h)
// RCS-ID: $Id: confbase.h 61872 2009-09-09 22:37:05Z VZ $
// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net
// Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CONFBASE_H_
#define _WX_CONFBASE_H_
#ifndef _WX_CONFBASE_H_
#define _WX_CONFBASE_H_
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/object.h"
#include "wx/base64.h"
class WXDLLIMPEXP_FWD_BASE wxArrayString;
@ -41,8 +42,6 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString;
#if wxUSE_CONFIG
#include "wx/string.h"
/// should we use registry instead of configuration files under Windows?
// (i.e. whether wxConfigBase::Create() will create a wxFileConfig (if it's
// false) or wxRegConfig (if it's true and we're under Win32))
@ -50,6 +49,15 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString;
#define wxUSE_CONFIG_NATIVE 1
#endif
// not all compilers can deal with template Read/Write() methods, define this
// symbol if the template functions are available
#if (!defined(__VISUALC__) || __VISUALC__ > 1200) && \
!defined( __VMS ) && \
!(defined(__HP_aCC) && defined(__hppa)) && \
!defined (__DMC__)
#define wxHAS_CONFIG_TEMPLATE_RW
#endif
// Style flags for constructor style parameter
enum
{
@ -64,7 +72,7 @@ enum
// abstract base class wxConfigBase which defines the interface for derived
// classes
//
// wxConfig organizes the items in a tree-like structure (modeled after the
// wxConfig organizes the items in a tree-like structure (modelled after the
// Unix/Dos filesystem). There are groups (directories) and keys (files).
// There is always one current group given by the current path.
//
@ -72,7 +80,7 @@ enum
// (long) type (TODO doubles and other types such as wxDate coming soon).
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxConfigBase
class WXDLLIMPEXP_BASE wxConfigBase : public wxObject
{
public:
// constants
@ -164,7 +172,7 @@ public:
bool Read(const wxString& key, long *pl) const;
bool Read(const wxString& key, long *pl, long defVal) const;
// read an int
// read an int (wrapper around `long' version)
bool Read(const wxString& key, int *pi) const;
bool Read(const wxString& key, int *pi, int defVal) const;
@ -172,39 +180,138 @@ public:
bool Read(const wxString& key, double* val) const;
bool Read(const wxString& key, double* val, double defVal) const;
// read a float
bool Read(const wxString& key, float* val) const;
bool Read(const wxString& key, float* val, float defVal) const;
// read a bool
bool Read(const wxString& key, bool* val) const;
bool Read(const wxString& key, bool* val, bool defVal) const;
// convenience functions returning directly the value (we don't have them for
// int/double/bool as there would be ambiguities with the long one then)
#if wxUSE_BASE64
// read a binary data block
bool Read(const wxString& key, wxMemoryBuffer* data) const
{ return DoReadBinary(key, data); }
// no default version since it does not make sense for binary data
#endif // wxUSE_BASE64
#ifdef wxHAS_CONFIG_TEMPLATE_RW
// read other types, for which wxFromString is defined
template <typename T>
bool Read(const wxString& key, T* value) const
{
wxString s;
if ( !Read(key, &s) )
return false;
return wxFromString(s, value);
}
template <typename T>
bool Read(const wxString& key, T* value, const T& defVal) const
{
const bool found = Read(key, value);
if ( !found )
{
if (IsRecordingDefaults())
((wxConfigBase *)this)->Write(key, defVal);
*value = defVal;
}
return found;
}
#endif // wxHAS_CONFIG_TEMPLATE_RW
// convenience functions returning directly the value
wxString Read(const wxString& key,
const wxString& defVal = wxEmptyString) const
{ wxString s; (void)Read(key, &s, defVal); return s; }
long Read(const wxString& key, long defVal) const
// we have to provide a separate version for C strings as otherwise the
// template Read() would be used
wxString Read(const wxString& key, const char* defVal) const
{ return Read(key, wxString(defVal)); }
wxString Read(const wxString& key, const wchar_t* defVal) const
{ return Read(key, wxString(defVal)); }
long ReadLong(const wxString& key, long defVal) const
{ long l; (void)Read(key, &l, defVal); return l; }
// write the value (return true on success)
double ReadDouble(const wxString& key, double defVal) const
{ double d; (void)Read(key, &d, defVal); return d; }
bool ReadBool(const wxString& key, bool defVal) const
{ bool b; (void)Read(key, &b, defVal); return b; }
template <typename T>
T ReadObject(const wxString& key, T const& defVal) const
{ T t; (void)Read(key, &t, defVal); return t; }
// for compatibility with wx 2.8
long Read(const wxString& key, long defVal) const
{ return ReadLong(key, defVal); }
// write the value (return true on success)
bool Write(const wxString& key, const wxString& value)
{ return DoWriteString(key, value); }
bool Write(const wxString& key, long value)
{ return DoWriteLong(key, value); }
bool Write(const wxString& key, int value)
{ return DoWriteInt(key, value); }
bool Write(const wxString& key, double value)
{ return DoWriteDouble(key, value); }
bool Write(const wxString& key, bool value)
{ return DoWriteBool(key, value); }
#if wxUSE_BASE64
bool Write(const wxString& key, const wxMemoryBuffer& buf)
{ return DoWriteBinary(key, buf); }
#endif // wxUSE_BASE64
// we have to provide a separate version for C strings as otherwise they
// would be converted to bool and not to wxString as expected!
bool Write(const wxString& key, const wxChar *value)
bool Write(const wxString& key, const char *value)
{ return Write(key, wxString(value)); }
bool Write(const wxString& key, const unsigned char *value)
{ return Write(key, wxString(value)); }
bool Write(const wxString& key, const wchar_t *value)
{ return Write(key, wxString(value)); }
// we also have to provide specializations for other types which we want to
// handle using the specialized DoWriteXXX() instead of the generic template
// version below
bool Write(const wxString& key, char value)
{ return DoWriteLong(key, value); }
bool Write(const wxString& key, unsigned char value)
{ return DoWriteLong(key, value); }
bool Write(const wxString& key, short value)
{ return DoWriteLong(key, value); }
bool Write(const wxString& key, unsigned short value)
{ return DoWriteLong(key, value); }
bool Write(const wxString& key, unsigned int value)
{ return DoWriteLong(key, value); }
bool Write(const wxString& key, int value)
{ return DoWriteLong(key, value); }
bool Write(const wxString& key, unsigned long value)
{ return DoWriteLong(key, value); }
bool Write(const wxString& key, float value)
{ return DoWriteDouble(key, value); }
// Causes ambiguities in VC++ 6 and OpenVMS (at least)
#if ( (!defined(__VISUALC__) || __VISUALC__ > 1200) && !defined( __VMS ) && !defined (__DMC__))
// for other types, use wxToString()
template <typename T>
bool Write(const wxString& key, T const& value)
{ return Write(key, wxToString(value)); }
#endif
// permanently writes all changes
virtual bool Flush(bool bCurrentOnly = false) = 0;
@ -265,15 +372,19 @@ protected:
// do read/write the values of different types
virtual bool DoReadString(const wxString& key, wxString *pStr) const = 0;
virtual bool DoReadLong(const wxString& key, long *pl) const = 0;
virtual bool DoReadInt(const wxString& key, int *pi) const;
virtual bool DoReadDouble(const wxString& key, double* val) const;
virtual bool DoReadBool(const wxString& key, bool* val) const;
#if wxUSE_BASE64
virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const = 0;
#endif // wxUSE_BASE64
virtual bool DoWriteString(const wxString& key, const wxString& value) = 0;
virtual bool DoWriteLong(const wxString& key, long value) = 0;
virtual bool DoWriteInt(const wxString& key, int value);
virtual bool DoWriteDouble(const wxString& key, double value);
virtual bool DoWriteBool(const wxString& key, bool value);
#if wxUSE_BASE64
virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) = 0;
#endif // wxUSE_BASE64
private:
// are we doing automatic environment variable expansion?
@ -291,6 +402,8 @@ private:
// Style flag
long m_style;
DECLARE_ABSTRACT_CLASS(wxConfigBase)
};
// a handy little class which changes current path to the path of given entry
@ -322,22 +435,10 @@ private:
m_strOldPath; // saved path
bool m_bChanged; // was the path changed?
DECLARE_NO_COPY_CLASS(wxConfigPathChanger)
wxDECLARE_NO_COPY_CLASS(wxConfigPathChanger);
};
// ----------------------------------------------------------------------------
// the native wxConfigBase implementation
// ----------------------------------------------------------------------------
// under Windows we prefer to use the native implementation
// wxIniConfig isn't native anywhere after droping win16 in wxWidgets 2.6
#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE
#define wxConfig wxRegConfig
#else // either we're under Unix or wish to use files even under Windows
#define wxConfig wxFileConfig
#endif
#endif // wxUSE_CONFIG
/*
@ -351,9 +452,7 @@ WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz);
/*
Split path into parts removing '..' in progress
*/
WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxChar *sz);
WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxString& path);
#endif
// _WX_CONFIG_H_
#endif // _WX_CONFBASE_H_

View File

@ -1,11 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: config.h
// Name: wx/config.h
// Purpose: wxConfig base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: config.h 60524 2009-05-05 22:51:44Z PC $
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -16,16 +15,21 @@
#if wxUSE_CONFIG
#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE
# ifdef __WIN32__
# include "wx/msw/regconf.h"
# else
# include "wx/msw/iniconf.h"
# endif
#elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE
# include "wx/palmos/prefconf.h"
#else
# include "wx/fileconf.h"
// ----------------------------------------------------------------------------
// define the native wxConfigBase implementation
// ----------------------------------------------------------------------------
// under Windows we prefer to use the native implementation but can be forced
// to use the file-based one
#if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE
#include "wx/msw/regconf.h"
#define wxConfig wxRegConfig
#elif defined(__WXOS2__) && wxUSE_CONFIG_NATIVE
#include "wx/os2/iniconf.h"
#define wxConfig wxIniConfig
#else // either we're under Unix or wish to always use config files
#include "wx/fileconf.h"
#define wxConfig wxFileConfig
#endif
#endif // wxUSE_CONFIG

View File

@ -1,62 +1,105 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/containr.h
// Purpose: wxControlContainer class declration: a "mix-in" class which
// implements the TAB navigation between the controls
// Purpose: wxControlContainer and wxNavigationEnabled declarations
// Author: Vadim Zeitlin
// Modified by:
// Created: 06.08.01
// RCS-ID: $Id: containr.h 50863 2007-12-20 18:32:55Z VS $
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Copyright: (c) 2001, 2011 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CONTAINR_H_
#define _WX_CONTAINR_H_
class WXDLLIMPEXP_FWD_CORE wxFocusEvent;
class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
#include "wx/defs.h"
#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
// We need wxEVT_XXX declarations in this case.
#include "wx/event.h"
#endif
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxWindowBase;
/*
Implementation note: wxControlContainer is not a real mix-in but rather
a class meant to be agregated with (and not inherited from). Although
logically it should be a mix-in, doing it like this has no advantage from
the point of view of the existing code but does have some problems (we'd
need to play tricks with event handlers which may be difficult to do
safely). The price we pay for this simplicity is the ugly macros below.
This header declares wxControlContainer class however it's not a real
container of controls but rather just a helper used to implement TAB
navigation among the window children. You should rarely need to use it
directly, derive from the documented public wxNavigationEnabled<> class to
implement TAB navigation in a custom composite window.
*/
// ----------------------------------------------------------------------------
// wxControlContainer
// wxControlContainerBase: common part used in both native and generic cases
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxControlContainer
class WXDLLIMPEXP_CORE wxControlContainerBase
{
public:
// ctors and such
wxControlContainer(wxWindow *winParent = NULL);
void SetContainerWindow(wxWindow *winParent) { m_winParent = winParent; }
// default ctor, SetContainerWindow() must be called later
wxControlContainerBase()
{
m_winParent = NULL;
// the methods to be called from the window event handlers
void HandleOnNavigationKey(wxNavigationKeyEvent& event);
void HandleOnFocus(wxFocusEvent& event);
void HandleOnWindowDestroy(wxWindowBase *child);
// By default, we accept focus ourselves.
m_acceptsFocusSelf = true;
// But we don't have any children accepting it yet.
m_acceptsFocusChildren = false;
m_inSetFocus = false;
m_winLastFocused = NULL;
}
virtual ~wxControlContainerBase() {}
void SetContainerWindow(wxWindow *winParent)
{
wxASSERT_MSG( !m_winParent, wxT("shouldn't be called twice") );
m_winParent = winParent;
}
// This can be called by the window to indicate that it never wants to have
// the focus for itself.
void DisableSelfFocus()
{ m_acceptsFocusSelf = false; UpdateParentCanFocus(); }
// This can be called to undo the effect of a previous DisableSelfFocus()
// (otherwise calling it is not necessary as the window does accept focus
// by default).
void EnableSelfFocus()
{ m_acceptsFocusSelf = true; UpdateParentCanFocus(); }
// should be called from SetFocus(), returns false if we did nothing with
// the focus and the default processing should take place
bool DoSetFocus();
// can our child get the focus?
// returns whether we should accept focus ourselves or not
bool AcceptsFocus() const;
// called from OnChildFocus() handler, i.e. when one of our (grand)
// children gets the focus
void SetLastFocus(wxWindow *win);
// Returns whether we or one of our children accepts focus.
bool AcceptsFocusRecursively() const
{ return AcceptsFocus() ||
(m_acceptsFocusChildren && HasAnyChildrenAcceptingFocus()); }
// We accept focus from keyboard if we accept it at all.
bool AcceptsFocusFromKeyboard() const { return AcceptsFocusRecursively(); }
// Call this when the number of children of the window changes.
//
// Returns true if we have any focusable children, false otherwise.
bool UpdateCanFocusChildren();
protected:
// set the focus to the child which had it the last time
bool SetFocusToChild();
virtual bool SetFocusToChild();
// return true if we have any children accepting focus
bool HasAnyFocusableChildren() const;
// return true if we have any children that do accept focus right now
bool HasAnyChildrenAcceptingFocus() const;
// the parent window we manage the children for
wxWindow *m_winParent;
@ -64,33 +107,265 @@ protected:
// the child which had the focus last time this panel was activated
wxWindow *m_winLastFocused;
private:
// Update the window status to reflect whether it is getting focus or not.
void UpdateParentCanFocus();
// Indicates whether the associated window can ever have focus itself.
//
// Usually this is the case, e.g. a wxPanel can be used either as a
// container for its children or just as a normal window which can be
// focused. But sometimes, e.g. for wxStaticBox, we can never have focus
// ourselves and can only get it if we have any focusable children.
bool m_acceptsFocusSelf;
// Cached value remembering whether we have any children accepting focus.
bool m_acceptsFocusChildren;
// a guard against infinite recursion
bool m_inSetFocus;
DECLARE_NO_COPY_CLASS(wxControlContainer)
};
// this function is for wxWidgets internal use only
extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child);
#ifdef wxHAS_NATIVE_TAB_TRAVERSAL
// ----------------------------------------------------------------------------
// macros which may be used by the classes wishing to implement TAB navigation
// among their children
// wxControlContainer for native TAB navigation
// ----------------------------------------------------------------------------
// this must be a real class as we forward-declare it elsewhere
class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase
{
protected:
// set the focus to the child which had it the last time
virtual bool SetFocusToChild();
};
#else // !wxHAS_NATIVE_TAB_TRAVERSAL
// ----------------------------------------------------------------------------
// wxControlContainer for TAB navigation implemented in wx itself
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase
{
public:
// default ctor, SetContainerWindow() must be called later
wxControlContainer();
// the methods to be called from the window event handlers
void HandleOnNavigationKey(wxNavigationKeyEvent& event);
void HandleOnFocus(wxFocusEvent& event);
void HandleOnWindowDestroy(wxWindowBase *child);
// called from OnChildFocus() handler, i.e. when one of our (grand)
// children gets the focus
void SetLastFocus(wxWindow *win);
protected:
wxDECLARE_NO_COPY_CLASS(wxControlContainer);
};
#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
// this function is for wxWidgets internal use only
extern WXDLLIMPEXP_CORE bool wxSetFocusToChild(wxWindow *win, wxWindow **child);
// ----------------------------------------------------------------------------
// wxNavigationEnabled: Derive from this class to support keyboard navigation
// among window children in a wxWindow-derived class. The details of this class
// don't matter, you just need to derive from it to make navigation work.
// ----------------------------------------------------------------------------
// The template parameter W must be a wxWindow-derived class.
template <class W>
class wxNavigationEnabled : public W
{
public:
typedef W BaseWindowClass;
wxNavigationEnabled()
{
m_container.SetContainerWindow(this);
#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
BaseWindowClass::Connect(wxEVT_NAVIGATION_KEY,
wxNavigationKeyEventHandler(wxNavigationEnabled::OnNavigationKey));
BaseWindowClass::Connect(wxEVT_SET_FOCUS,
wxFocusEventHandler(wxNavigationEnabled::OnFocus));
BaseWindowClass::Connect(wxEVT_CHILD_FOCUS,
wxChildFocusEventHandler(wxNavigationEnabled::OnChildFocus));
#endif // !wxHAS_NATIVE_TAB_TRAVERSAL
}
WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocus() const
{
return m_container.AcceptsFocus();
}
WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusRecursively() const
{
return m_container.AcceptsFocusRecursively();
}
WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusFromKeyboard() const
{
return m_container.AcceptsFocusFromKeyboard();
}
WXDLLIMPEXP_INLINE_CORE virtual void AddChild(wxWindowBase *child)
{
BaseWindowClass::AddChild(child);
if ( m_container.UpdateCanFocusChildren() )
{
// Under MSW we must have wxTAB_TRAVERSAL style for TAB navigation
// to work.
if ( !BaseWindowClass::HasFlag(wxTAB_TRAVERSAL) )
BaseWindowClass::ToggleWindowStyle(wxTAB_TRAVERSAL);
}
}
WXDLLIMPEXP_INLINE_CORE virtual void RemoveChild(wxWindowBase *child)
{
#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
m_container.HandleOnWindowDestroy(child);
#endif // !wxHAS_NATIVE_TAB_TRAVERSAL
BaseWindowClass::RemoveChild(child);
// We could reset wxTAB_TRAVERSAL here but it doesn't seem to do any
// harm to keep it.
m_container.UpdateCanFocusChildren();
}
WXDLLIMPEXP_INLINE_CORE virtual void SetFocus()
{
if ( !m_container.DoSetFocus() )
BaseWindowClass::SetFocus();
}
void SetFocusIgnoringChildren()
{
BaseWindowClass::SetFocus();
}
protected:
#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
void OnNavigationKey(wxNavigationKeyEvent& event)
{
m_container.HandleOnNavigationKey(event);
}
void OnFocus(wxFocusEvent& event)
{
m_container.HandleOnFocus(event);
}
void OnChildFocus(wxChildFocusEvent& event)
{
m_container.SetLastFocus(event.GetWindow());
event.Skip();
}
#endif // !wxHAS_NATIVE_TAB_TRAVERSAL
wxControlContainer m_container;
wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxNavigationEnabled, W);
};
// ----------------------------------------------------------------------------
// Compatibility macros from now on, do NOT use them and preferably do not even
// look at them.
// ----------------------------------------------------------------------------
#if WXWIN_COMPATIBILITY_2_8
// common part of WX_DECLARE_CONTROL_CONTAINER in the native and generic cases,
// it should be used in the wxWindow-derived class declaration
#define WX_DECLARE_CONTROL_CONTAINER_BASE() \
public: \
virtual bool AcceptsFocus() const; \
virtual bool AcceptsFocusRecursively() const; \
virtual bool AcceptsFocusFromKeyboard() const; \
virtual void AddChild(wxWindowBase *child); \
virtual void RemoveChild(wxWindowBase *child); \
virtual void SetFocus(); \
void SetFocusIgnoringChildren(); \
\
protected: \
wxControlContainer m_container
// this macro must be used in the derived class ctor
#define WX_INIT_CONTROL_CONTAINER() \
m_container.SetContainerWindow(this)
// common part of WX_DELEGATE_TO_CONTROL_CONTAINER in the native and generic
// cases, must be used in the wxWindow-derived class implementation
#define WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \
void classname::AddChild(wxWindowBase *child) \
{ \
basename::AddChild(child); \
\
m_container.UpdateCanFocusChildren(); \
} \
\
bool classname::AcceptsFocusRecursively() const \
{ \
return m_container.AcceptsFocusRecursively(); \
} \
\
void classname::SetFocus() \
{ \
if ( !m_container.DoSetFocus() ) \
basename::SetFocus(); \
} \
\
bool classname::AcceptsFocus() const \
{ \
return m_container.AcceptsFocus(); \
} \
\
bool classname::AcceptsFocusFromKeyboard() const \
{ \
return m_container.AcceptsFocusFromKeyboard(); \
}
#ifdef wxHAS_NATIVE_TAB_TRAVERSAL
#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname)
#define WX_DECLARE_CONTROL_CONTAINER WX_DECLARE_CONTROL_CONTAINER_BASE
#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \
WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \
\
void classname::RemoveChild(wxWindowBase *child) \
{ \
basename::RemoveChild(child); \
\
m_container.UpdateCanFocusChildren(); \
} \
\
void classname::SetFocusIgnoringChildren() \
{ \
basename::SetFocus(); \
}
#else // !wxHAS_NATIVE_TAB_TRAVERSAL
// declare the methods to be forwarded
#define WX_DECLARE_CONTROL_CONTAINER() \
public: \
void OnNavigationKey(wxNavigationKeyEvent& event); \
void OnFocus(wxFocusEvent& event); \
virtual void OnChildFocus(wxChildFocusEvent& event); \
virtual void SetFocus(); \
virtual void SetFocusIgnoringChildren(); \
virtual void RemoveChild(wxWindowBase *child); \
virtual bool AcceptsFocus() const; \
\
protected: \
wxControlContainer m_container
#define WX_DECLARE_CONTROL_CONTAINER() \
WX_DECLARE_CONTROL_CONTAINER_BASE(); \
\
public: \
void OnNavigationKey(wxNavigationKeyEvent& event); \
void OnFocus(wxFocusEvent& event); \
virtual void OnChildFocus(wxChildFocusEvent& event)
// implement the event table entries for wxControlContainer
#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \
@ -99,44 +374,41 @@ protected: \
EVT_NAVIGATION_KEY(classname::OnNavigationKey)
// implement the methods forwarding to the wxControlContainer
#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \
void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \
{ \
m_container.HandleOnNavigationKey(event); \
} \
\
void classname::RemoveChild(wxWindowBase *child) \
{ \
m_container.HandleOnWindowDestroy(child); \
\
basename::RemoveChild(child); \
} \
\
void classname::SetFocus() \
{ \
if ( !m_container.DoSetFocus() ) \
basename::SetFocus(); \
} \
\
void classname::SetFocusIgnoringChildren() \
{ \
basename::SetFocus(); \
} \
\
void classname::OnChildFocus(wxChildFocusEvent& event) \
{ \
m_container.SetLastFocus(event.GetWindow()); \
event.Skip(); \
} \
\
void classname::OnFocus(wxFocusEvent& event) \
{ \
m_container.HandleOnFocus(event); \
} \
bool classname::AcceptsFocus() const \
{ \
return m_container.AcceptsFocus(); \
}
#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \
WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \
\
void classname::RemoveChild(wxWindowBase *child) \
{ \
m_container.HandleOnWindowDestroy(child); \
\
basename::RemoveChild(child); \
\
m_container.UpdateCanFocusChildren(); \
} \
\
void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \
{ \
m_container.HandleOnNavigationKey(event); \
} \
\
void classname::SetFocusIgnoringChildren() \
{ \
basename::SetFocus(); \
} \
\
void classname::OnChildFocus(wxChildFocusEvent& event) \
{ \
m_container.SetLastFocus(event.GetWindow()); \
event.Skip(); \
} \
\
void classname::OnFocus(wxFocusEvent& event) \
{ \
m_container.HandleOnFocus(event); \
}
#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
#endif // WXWIN_COMPATIBILITY_2_8
#endif // _WX_CONTAINR_H_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 26.07.99
// RCS-ID: $Id: control.h 42816 2006-10-31 08:50:17Z RD $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -22,13 +21,38 @@
#include "wx/window.h" // base class
extern WXDLLEXPORT_DATA(const wxChar) wxControlNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxControlNameStr[];
// ----------------------------------------------------------------------------
// Ellipsize() constants
// ----------------------------------------------------------------------------
enum wxEllipsizeFlags
{
wxELLIPSIZE_FLAGS_NONE = 0,
wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1,
wxELLIPSIZE_FLAGS_EXPAND_TABS = 2,
wxELLIPSIZE_FLAGS_DEFAULT = wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS |
wxELLIPSIZE_FLAGS_EXPAND_TABS
};
// NB: Don't change the order of these values, they're the same as in
// PangoEllipsizeMode enum.
enum wxEllipsizeMode
{
wxELLIPSIZE_NONE,
wxELLIPSIZE_START,
wxELLIPSIZE_MIDDLE,
wxELLIPSIZE_END
};
// ----------------------------------------------------------------------------
// wxControl is the base class for all controls
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxControlBase : public wxWindow
class WXDLLIMPEXP_CORE wxControlBase : public wxWindow
{
public:
wxControlBase() { }
@ -46,11 +70,51 @@ public:
// get the control alignment (left/right/centre, top/bottom/centre)
int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
// get the string without mnemonic characters ('&')
static wxString GetLabelText(const wxString& label);
// set label with mnemonics
virtual void SetLabel(const wxString& label)
{
m_labelOrig = label;
InvalidateBestSize();
wxWindow::SetLabel(label);
}
// return the original string, as it was passed to SetLabel()
// (i.e. with wx-style mnemonics)
virtual wxString GetLabel() const { return m_labelOrig; }
// set label text (mnemonics will be escaped)
virtual void SetLabelText(const wxString& text)
{
SetLabel(EscapeMnemonics(text));
}
// get just the text of the label, without mnemonic characters ('&')
wxString GetLabelText() const { return GetLabelText(GetLabel()); }
virtual wxString GetLabelText() const { return GetLabelText(GetLabel()); }
#if wxUSE_MARKUP
// Set the label with markup (and mnemonics). Markup is a simple subset of
// HTML with tags such as <b>, <i> and <span>. By default it is not
// supported i.e. all the markup is simply stripped and SetLabel() is
// called but some controls in some ports do support this already and in
// the future most of them should.
//
// Notice that, being HTML-like, markup also supports XML entities so '<'
// should be encoded as "&lt;" and so on, a bare '<' in the input will
// likely result in an error. As an exception, a bare '&' is allowed and
// indicates that the next character is a mnemonic. To insert a literal '&'
// in the control you need to use "&amp;" in the input string.
//
// Returns true if the label was set, even if the markup in it was ignored.
// False is only returned if we failed to parse the label.
bool SetLabelMarkup(const wxString& markup)
{
return DoSetLabelMarkup(markup);
}
#endif // wxUSE_MARKUP
// controls by default inherit the colours of their parents, if a
// particular control class doesn't want to do it, it can override
@ -64,13 +128,56 @@ public:
// if the button was clicked)
virtual void Command(wxCommandEvent &event);
virtual void SetLabel( const wxString &label );
virtual bool SetFont(const wxFont& font);
// wxControl-specific processing after processing the update event
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
wxSize GetSizeFromTextSize(int xlen, int ylen = -1) const
{ return DoGetSizeFromTextSize(xlen, ylen); }
wxSize GetSizeFromTextSize(const wxSize& tsize) const
{ return DoGetSizeFromTextSize(tsize.x, tsize.y); }
// static utilities for mnemonics char (&) handling
// ------------------------------------------------
// returns the given string without mnemonic characters ('&')
static wxString GetLabelText(const wxString& label);
// returns the given string without mnemonic characters ('&')
// this function is identic to GetLabelText() and is provided for clarity
// and for symmetry with the wxStaticText::RemoveMarkup() function.
static wxString RemoveMnemonics(const wxString& str);
// escapes (by doubling them) the mnemonics
static wxString EscapeMnemonics(const wxString& str);
// miscellaneous static utilities
// ------------------------------
// replaces parts of the given (multiline) string with an ellipsis if needed
static wxString Ellipsize(const wxString& label, const wxDC& dc,
wxEllipsizeMode mode, int maxWidth,
int flags = wxELLIPSIZE_FLAGS_DEFAULT);
// return the accel index in the string or -1 if none and puts the modified
// string into second parameter if non NULL
static int FindAccelIndex(const wxString& label,
wxString *labelOnly = NULL);
// this is a helper for the derived class GetClassDefaultAttributes()
// implementation: it returns the right colours for the classes which
// contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of
// being simple controls (such as wxButton, wxCheckBox, ...)
static wxVisualAttributes
GetCompositeControlsDefaultAttributes(wxWindowVariant variant);
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const;
// creates the control (calls wxWindowBase::CreateBase inside) and adds it
// to the list of parents children
bool CreateControl(wxWindowBase *parent,
@ -81,10 +188,36 @@ protected:
const wxValidator& validator,
const wxString& name);
#if wxUSE_MARKUP
// This function may be overridden in the derived classes to implement
// support for labels with markup. The base class version simply strips the
// markup and calls SetLabel() with the remaining text.
virtual bool DoSetLabelMarkup(const wxString& markup);
#endif // wxUSE_MARKUP
// override this to return the total control's size from a string size
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
// initialize the common fields of wxCommandEvent
void InitCommandEvent(wxCommandEvent& event) const;
DECLARE_NO_COPY_CLASS(wxControlBase)
// Ellipsize() helper:
static wxString DoEllipsizeSingleLine(const wxString& label, const wxDC& dc,
wxEllipsizeMode mode, int maxWidth,
int replacementWidth);
#if wxUSE_MARKUP
// Remove markup from the given string, returns empty string on error i.e.
// if markup was syntactically invalid.
static wxString RemoveMarkup(const wxString& markup);
#endif // wxUSE_MARKUP
// this field contains the label in wx format, i.e. with '&' mnemonics,
// as it was passed to the last SetLabel() call
wxString m_labelOrig;
wxDECLARE_NO_COPY_CLASS(wxControlBase);
};
// ----------------------------------------------------------------------------
@ -93,8 +226,6 @@ protected:
#if defined(__WXUNIVERSAL__)
#include "wx/univ/control.h"
#elif defined(__WXPALMOS__)
#include "wx/palmos/control.h"
#elif defined(__WXMSW__)
#include "wx/msw/control.h"
#elif defined(__WXMOTIF__)
@ -104,7 +235,7 @@ protected:
#elif defined(__WXGTK__)
#include "wx/gtk1/control.h"
#elif defined(__WXMAC__)
#include "wx/mac/control.h"
#include "wx/osx/control.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/control.h"
#elif defined(__WXPM__)

View File

@ -3,7 +3,6 @@
// Purpose: wxConvAuto class declaration
// Author: Vadim Zeitlin
// Created: 2006-04-03
// RCS-ID: $Id: convauto.h 45893 2007-05-08 20:05:16Z VZ $
// Copyright: (c) 2006 Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -12,24 +11,63 @@
#define _WX_CONVAUTO_H_
#include "wx/strconv.h"
#if wxUSE_WCHAR_T
#include "wx/fontenc.h"
// ----------------------------------------------------------------------------
// wxConvAuto: uses BOM to automatically detect input encoding
// ----------------------------------------------------------------------------
// All currently recognized BOM values.
enum wxBOM
{
wxBOM_Unknown = -1,
wxBOM_None,
wxBOM_UTF32BE,
wxBOM_UTF32LE,
wxBOM_UTF16BE,
wxBOM_UTF16LE,
wxBOM_UTF8
};
class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv
{
public:
// default ctor, the real conversion will be created on demand
wxConvAuto() { m_conv = NULL; /* the rest will be initialized later */ }
wxConvAuto(wxFontEncoding enc = wxFONTENCODING_DEFAULT)
{
Init();
m_encDefault = enc;
}
// copy ctor doesn't initialize anything neither as conversion can only be
// deduced on first use
wxConvAuto(const wxConvAuto& WXUNUSED(other)) : wxMBConv() { m_conv = NULL; }
wxConvAuto(const wxConvAuto& other) : wxMBConv()
{
Init();
m_encDefault = other.m_encDefault;
}
virtual ~wxConvAuto()
{
if ( m_ownsConv )
delete m_conv;
}
// get/set the fall-back encoding used when the input text doesn't have BOM
// and isn't UTF-8
//
// special values are wxFONTENCODING_MAX meaning not to use any fall back
// at all (but just fail to convert in this case) and wxFONTENCODING_SYSTEM
// meaning to use the encoding of the system locale
static wxFontEncoding GetFallbackEncoding() { return ms_defaultMBEncoding; }
static void SetFallbackEncoding(wxFontEncoding enc);
static void DisableFallbackEncoding()
{
SetFallbackEncoding(wxFONTENCODING_MAX);
}
virtual ~wxConvAuto() { if ( m_conv && m_ownsConv ) delete m_conv; }
// override the base class virtual function(s) to use our m_conv
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
@ -42,46 +80,64 @@ public:
virtual wxMBConv *Clone() const { return new wxConvAuto(*this); }
private:
// all currently recognized BOM values
enum BOMType
{
BOM_None,
BOM_UTF32BE,
BOM_UTF32LE,
BOM_UTF16BE,
BOM_UTF16LE,
BOM_UTF8
};
// return the BOM type of this buffer
static BOMType DetectBOM(const char *src, size_t srcLen);
static wxBOM DetectBOM(const char *src, size_t srcLen);
// initialize m_conv with the conversion to use by default (UTF-8)
void InitWithDefault()
// return the characters composing the given BOM.
static const char* GetBOMChars(wxBOM bomType, size_t* count);
wxBOM GetBOM() const
{
return m_bomType;
}
private:
// common part of all ctors
void Init()
{
// We don't initialize m_encDefault here as different ctors do it
// differently.
m_conv = NULL;
m_bomType = wxBOM_Unknown;
m_ownsConv = false;
m_consumedBOM = false;
}
// initialize m_conv with the UTF-8 conversion
void InitWithUTF8()
{
m_conv = &wxConvUTF8;
m_ownsConv = false;
}
// create the correct conversion object for the given BOM type
void InitFromBOM(BOMType bomType);
void InitFromBOM(wxBOM bomType);
// create the correct conversion object for the BOM present in the
// beginning of the buffer; adjust the buffer to skip the BOM if found
void InitFromInput(const char **src, size_t *len);
// beginning of the buffer
//
// return false if the buffer is too short to allow us to determine if we
// have BOM or not
bool InitFromInput(const char *src, size_t len);
// adjust src and len to skip over the BOM (identified by m_bomType) at the
// start of the buffer
void SkipBOM(const char **src, size_t *len) const;
// fall-back multibyte encoding to use, may be wxFONTENCODING_SYSTEM or
// wxFONTENCODING_MAX but not wxFONTENCODING_DEFAULT
static wxFontEncoding ms_defaultMBEncoding;
// conversion object which we really use, NULL until the first call to
// either ToWChar() or FromWChar()
wxMBConv *m_conv;
// the multibyte encoding to use by default if input isn't Unicode
wxFontEncoding m_encDefault;
// our BOM type
BOMType m_bomType;
wxBOM m_bomType;
// true if we allocated m_conv ourselves, false if we just use an existing
// global conversion
@ -92,17 +148,8 @@ private:
bool m_consumedBOM;
DECLARE_NO_ASSIGN_CLASS(wxConvAuto)
wxDECLARE_NO_ASSIGN_CLASS(wxConvAuto);
};
#else // !wxUSE_WCHAR_T
// it doesn't matter how we define it in this case as it's unused anyhow, but
// do define it to allow the code using wxConvAuto() as default argument (this
// is done in many places) to compile
typedef wxMBConv wxConvAuto;
#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T
#endif // _WX_CONVAUTO_H_

View File

@ -3,7 +3,6 @@
* Purpose: Various preprocessor helpers
* Author: Vadim Zeitlin
* Created: 2006-09-30
* RCS-ID: $Id: cpp.h 42993 2006-11-03 21:06:57Z VZ $
* Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
* Licence: wxWindows licence
*/
@ -13,9 +12,27 @@
#ifndef _WX_CPP_H_
#define _WX_CPP_H_
#include "wx/compiler.h" /* wxCHECK_XXX_VERSION() macros */
/* wxCONCAT works like preprocessor ## operator but also works with macros */
#define wxCONCAT_HELPER(text, line) text ## line
#define wxCONCAT(text, line) wxCONCAT_HELPER(text, line)
#define wxCONCAT(x1, x2) \
wxCONCAT_HELPER(x1, x2)
#define wxCONCAT3(x1, x2, x3) \
wxCONCAT(wxCONCAT(x1, x2), x3)
#define wxCONCAT4(x1, x2, x3, x4) \
wxCONCAT(wxCONCAT3(x1, x2, x3), x4)
#define wxCONCAT5(x1, x2, x3, x4, x5) \
wxCONCAT(wxCONCAT4(x1, x2, x3, x4), x5)
#define wxCONCAT6(x1, x2, x3, x4, x5, x6) \
wxCONCAT(wxCONCAT5(x1, x2, x3, x4, x5), x6)
#define wxCONCAT7(x1, x2, x3, x4, x5, x6, x7) \
wxCONCAT(wxCONCAT6(x1, x2, x3, x4, x5, x6), x7)
#define wxCONCAT8(x1, x2, x3, x4, x5, x6, x7, x8) \
wxCONCAT(wxCONCAT7(x1, x2, x3, x4, x5, x6, x7), x8)
#define wxCONCAT9(x1, x2, x3, x4, x5, x6, x7, x8, x9) \
wxCONCAT(wxCONCAT8(x1, x2, x3, x4, x5, x6, x7, x8), x9)
/* wxSTRINGIZE works as the preprocessor # operator but also works with macros */
#define wxSTRINGIZE_HELPER(x) #x
@ -24,6 +41,16 @@
/* a Unicode-friendly version of wxSTRINGIZE_T */
#define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x))
/*
Special workarounds for compilers with broken "##" operator. For all the
other ones we can just use it directly.
*/
#ifdef wxCOMPILER_BROKEN_CONCAT_OPER
#define wxPREPEND_L(x) L ## x
#define wxAPPEND_i64(x) x ## i64
#define wxAPPEND_ui64(x) x ## ui64
#endif /* wxCOMPILER_BROKEN_CONCAT_OPER */
/*
Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the
current line number to the given identifier to reduce the probability of the
@ -53,5 +80,108 @@
*/
#define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */
#endif // _WX_CPP_H_
/*
Helpers for defining macros that expand into a single statement.
The standatd solution is to use "do { ... } while (0)" statement but MSVC
generates a C4127 "condition expression is constant" warning for it so we
use something which is just complicated enough to not be recognized as a
constant but still simple enough to be optimized away.
Another solution would be to use __pragma() to temporarily disable C4127.
Notice that wxASSERT_ARG_TYPE in wx/strvargarg.h relies on these macros
creating some kind of a loop because it uses "break".
*/
#ifdef __WATCOMC__
#define wxFOR_ONCE(name) for(int name=0; name<1; name++)
#define wxSTATEMENT_MACRO_BEGIN wxFOR_ONCE(wxMAKE_UNIQUE_NAME(wxmacro)) {
#define wxSTATEMENT_MACRO_END }
#else
#define wxSTATEMENT_MACRO_BEGIN do {
#define wxSTATEMENT_MACRO_END } while ( (void)0, 0 )
#endif
/*
Define __WXFUNCTION__ which is like standard __FUNCTION__ but defined as
NULL for the compilers which don't support the latter.
*/
#ifndef __WXFUNCTION__
/* TODO: add more compilers supporting __FUNCTION__ */
#if defined(__DMC__)
/*
__FUNCTION__ happens to be not defined within class members
http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485
*/
#define __WXFUNCTION__ (NULL)
#elif defined(__GNUC__) || \
(defined(_MSC_VER) && _MSC_VER >= 1300) || \
defined(__FUNCTION__)
#define __WXFUNCTION__ __FUNCTION__
#else
/* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */
#define __WXFUNCTION__ (NULL)
#endif
#endif /* __WXFUNCTION__ already defined */
/* Auto-detect variadic macros support unless explicitly disabled. */
#if !defined(HAVE_VARIADIC_MACROS) && !defined(wxNO_VARIADIC_MACROS)
/* Any C99 or C++11 compiler should have them. */
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
(defined(__cplusplus) && __cplusplus >= 201103L)
#define HAVE_VARIADIC_MACROS
#elif wxCHECK_GCC_VERSION(3,0)
#define HAVE_VARIADIC_MACROS
#elif wxCHECK_VISUALC_VERSION(8)
#define HAVE_VARIADIC_MACROS
#elif wxCHECK_WATCOM_VERSION(1,2)
#define HAVE_VARIADIC_MACROS
#endif
#endif /* !HAVE_VARIADIC_MACROS */
#ifdef HAVE_VARIADIC_MACROS
/*
wxCALL_FOR_EACH(what, ...) calls the macro from its first argument, what(pos, x),
for every remaining argument 'x', with 'pos' being its 1-based index in
*reverse* order (with the last argument being numbered 1).
For example, wxCALL_FOR_EACH(test, a, b, c) expands into this:
test(3, a) \
test(2, b) \
test(1, c)
Up to eight arguments are supported.
(With thanks to https://groups.google.com/d/topic/comp.std.c/d-6Mj5Lko_s/discussion
and http://stackoverflow.com/questions/1872220/is-it-possible-to-iterate-over-arguments-in-variadic-macros)
*/
#define wxCALL_FOR_EACH_NARG(...) wxCALL_FOR_EACH_NARG_((__VA_ARGS__, wxCALL_FOR_EACH_RSEQ_N()))
#define wxCALL_FOR_EACH_NARG_(args) wxCALL_FOR_EACH_ARG_N args
#define wxCALL_FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N
#define wxCALL_FOR_EACH_RSEQ_N() 8, 7, 6, 5, 4, 3, 2, 1, 0
#define wxCALL_FOR_EACH_1(what, x) what(1, x)
#define wxCALL_FOR_EACH_2(what, x, ...) what(2, x) wxCALL_FOR_EACH_1(what, __VA_ARGS__)
#define wxCALL_FOR_EACH_3(what, x, ...) what(3, x) wxCALL_FOR_EACH_2(what, __VA_ARGS__)
#define wxCALL_FOR_EACH_4(what, x, ...) what(4, x) wxCALL_FOR_EACH_3(what, __VA_ARGS__)
#define wxCALL_FOR_EACH_5(what, x, ...) what(5, x) wxCALL_FOR_EACH_4(what, __VA_ARGS__)
#define wxCALL_FOR_EACH_6(what, x, ...) what(6, x) wxCALL_FOR_EACH_5(what, __VA_ARGS__)
#define wxCALL_FOR_EACH_7(what, x, ...) what(7, x) wxCALL_FOR_EACH_6(what, __VA_ARGS__)
#define wxCALL_FOR_EACH_8(what, x, ...) what(8, x) wxCALL_FOR_EACH_7(what, __VA_ARGS__)
#define wxCALL_FOR_EACH_(N, args) \
wxCONCAT(wxCALL_FOR_EACH_, N) args
#define wxCALL_FOR_EACH(what, ...) \
wxCALL_FOR_EACH_(wxCALL_FOR_EACH_NARG(__VA_ARGS__), (what, __VA_ARGS__))
#else
#define wxCALL_FOR_EACH Error_wx_CALL_FOR_EACH_requires_variadic_macros_support
#endif /* HAVE_VARIADIC_MACROS */
#endif /* _WX_CPP_H_ */

View File

@ -0,0 +1,301 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/cppunit.h
// Purpose: wrapper header for CppUnit headers
// Author: Vadim Zeitlin
// Created: 15.02.04
// Copyright: (c) 2004 Vadim Zeitlin
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CPPUNIT_H_
#define _WX_CPPUNIT_H_
///////////////////////////////////////////////////////////////////////////////
// using CPPUNIT_TEST() macro results in this warning, disable it as there is
// no other way to get rid of it and it's not very useful anyhow
#ifdef __VISUALC__
// typedef-name 'foo' used as synonym for class-name 'bar'
#pragma warning(disable:4097)
// unreachable code: we don't care about warnings in CppUnit headers
#pragma warning(disable:4702)
// 'id': identifier was truncated to 'num' characters in the debug info
#pragma warning(disable:4786)
#endif // __VISUALC__
#ifdef __BORLANDC__
#pragma warn -8022
#endif
#ifndef CPPUNIT_STD_NEED_ALLOCATOR
#define CPPUNIT_STD_NEED_ALLOCATOR 0
#endif
///////////////////////////////////////////////////////////////////////////////
// Set the default format for the errors, which can be used by an IDE to jump
// to the error location. This default gets overridden by the cppunit headers
// for some compilers (e.g. VC++).
#ifndef CPPUNIT_COMPILER_LOCATION_FORMAT
#define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l:"
#endif
///////////////////////////////////////////////////////////////////////////////
// Include all needed cppunit headers.
//
#include "wx/beforestd.h"
#ifdef __VISUALC__
#pragma warning(push)
// with cppunit 1.12 we get many bogus warnings 4701 (local variable may be
// used without having been initialized) in TestAssert.h
#pragma warning(disable:4701)
// and also 4100 (unreferenced formal parameter) in extensions/
// ExceptionTestCaseDecorator.h
#pragma warning(disable:4100)
#endif
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/TestCase.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/CompilerOutputter.h>
#ifdef __VISUALC__
#pragma warning(pop)
#endif
#include "wx/afterstd.h"
#include "wx/string.h"
///////////////////////////////////////////////////////////////////////////////
// Set of helpful test macros.
//
// Base macro for wrapping CPPUNIT_TEST macros and so making them conditional
// tests, meaning that the test only get registered and thus run when a given
// runtime condition is true.
// In case the condition is evaluated as false a skip message is logged
// (the message will only be shown in verbose mode).
#define WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, anyTest) \
if (Condition) \
{ anyTest; } \
else \
wxLogInfo(wxString::Format(wxT("skipping: %s.%s\n reason: %s equals false\n"), \
wxString(suiteName, wxConvUTF8).c_str(), \
wxString(#testMethod, wxConvUTF8).c_str(), \
wxString(#Condition, wxConvUTF8).c_str()))
// Conditional CPPUNIT_TEST macro.
#define WXTEST_WITH_CONDITION(suiteName, Condition, testMethod) \
WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST(testMethod))
// Conditional CPPUNIT_TEST_FAIL macro.
#define WXTEST_FAIL_WITH_CONDITION(suiteName, Condition, testMethod) \
WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST_FAIL(testMethod))
CPPUNIT_NS_BEGIN
// provide an overload of cppunit assertEquals(T, T) which can be used to
// compare wxStrings directly with C strings
inline void
assertEquals(const char *expected,
const char *actual,
CppUnit::SourceLine sourceLine,
const std::string& message)
{
assertEquals(wxString(expected), wxString(actual), sourceLine, message);
}
inline void
assertEquals(const char *expected,
const wxString& actual,
CppUnit::SourceLine sourceLine,
const std::string& message)
{
assertEquals(wxString(expected), actual, sourceLine, message);
}
inline void
assertEquals(const wxString& expected,
const char *actual,
CppUnit::SourceLine sourceLine,
const std::string& message)
{
assertEquals(expected, wxString(actual), sourceLine, message);
}
inline void
assertEquals(const wchar_t *expected,
const wxString& actual,
CppUnit::SourceLine sourceLine,
const std::string& message)
{
assertEquals(wxString(expected), actual, sourceLine, message);
}
inline void
assertEquals(const wxString& expected,
const wchar_t *actual,
CppUnit::SourceLine sourceLine,
const std::string& message)
{
assertEquals(expected, wxString(actual), sourceLine, message);
}
CPPUNIT_NS_END
// define an assertEquals() overload for the given types, this is a helper and
// shouldn't be used directly because of VC6 complications, see below
#define WX_CPPUNIT_ASSERT_EQUALS(T1, T2) \
inline void \
assertEquals(T1 expected, \
T2 actual, \
CppUnit::SourceLine sourceLine, \
const std::string& message) \
{ \
if ( !assertion_traits<T1>::equal(expected,actual) ) \
{ \
Asserter::failNotEqual( assertion_traits<T1>::toString(expected), \
assertion_traits<T2>::toString(actual), \
sourceLine, \
message ); \
} \
}
// this macro allows us to specify (usually literal) ints as expected values
// for functions returning integral types different from "int"
//
// FIXME-VC6: due to incorrect resolution of overloaded/template functions in
// this compiler (it basically doesn't use the template version at
// all if any overloaded function matches partially even if none of
// them matches fully) we also need to provide extra overloads
#ifdef __VISUALC6__
#define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \
CPPUNIT_NS_BEGIN \
WX_CPPUNIT_ASSERT_EQUALS(int, T) \
WX_CPPUNIT_ASSERT_EQUALS(T, int) \
WX_CPPUNIT_ASSERT_EQUALS(T, T) \
CPPUNIT_NS_END
CPPUNIT_NS_BEGIN
WX_CPPUNIT_ASSERT_EQUALS(int, int)
CPPUNIT_NS_END
#else // !VC6
#define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \
CPPUNIT_NS_BEGIN \
WX_CPPUNIT_ASSERT_EQUALS(int, T) \
WX_CPPUNIT_ASSERT_EQUALS(T, int) \
CPPUNIT_NS_END
#endif // VC6/!VC6
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(long)
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(short)
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned)
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned long)
#if defined( __VMS ) && defined( __ia64 )
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(std::basic_streambuf<char>::pos_type);
#endif
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(wxLongLong_t)
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned wxLongLong_t)
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
// Use this macro to compare a wxArrayString with the pipe-separated elements
// of the given string
//
// NB: it's a macro and not a function to have the correct line numbers in the
// test failure messages
#define WX_ASSERT_STRARRAY_EQUAL(s, a) \
{ \
wxArrayString expected(wxSplit(s, '|', '\0')); \
\
CPPUNIT_ASSERT_EQUAL( expected.size(), a.size() ); \
\
for ( size_t n = 0; n < a.size(); n++ ) \
{ \
CPPUNIT_ASSERT_EQUAL( expected[n], a[n] ); \
} \
}
// Use this macro to assert with the given formatted message (it should contain
// the format string and arguments in a separate pair of parentheses)
#define WX_ASSERT_MESSAGE(msg, cond) \
CPPUNIT_ASSERT_MESSAGE(std::string(wxString::Format msg .mb_str()), (cond))
#define WX_ASSERT_EQUAL_MESSAGE(msg, expected, actual) \
CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str()), \
(expected), (actual))
///////////////////////////////////////////////////////////////////////////////
// define stream inserter for wxString if it's not defined in the main library,
// we need it to output the test failures involving wxString
#if !wxUSE_STD_IOSTREAM
#include "wx/string.h"
#include <iostream>
inline std::ostream& operator<<(std::ostream& o, const wxString& s)
{
#if wxUSE_UNICODE
return o << (const char *)wxSafeConvertWX2MB(s.wc_str());
#else
return o << s.c_str();
#endif
}
#endif // !wxUSE_STD_IOSTREAM
// VC6 doesn't provide overloads for operator<<(__int64) in its stream classes
// so do it ourselves
#if defined(__VISUALC6__) && defined(wxLongLong_t)
#include "wx/longlong.h"
inline std::ostream& operator<<(std::ostream& ostr, wxLongLong_t ll)
{
ostr << wxLongLong(ll).ToString();
return ostr;
}
inline std::ostream& operator<<(std::ostream& ostr, unsigned wxLongLong_t llu)
{
ostr << wxULongLong(llu).ToString();
return ostr;
}
#endif // VC6 && wxLongLong_t
///////////////////////////////////////////////////////////////////////////////
// Some more compiler warning tweaking and auto linking.
//
#ifdef __BORLANDC__
#pragma warn .8022
#endif
#ifdef _MSC_VER
#pragma warning(default:4702)
#endif // _MSC_VER
// for VC++ automatically link in cppunit library
#ifdef __VISUALC__
#ifdef NDEBUG
#pragma comment(lib, "cppunit.lib")
#else // Debug
#pragma comment(lib, "cppunitd.lib")
#endif // Release/Debug
#endif
#endif // _WX_CPPUNIT_H_

View File

@ -0,0 +1,22 @@
//////////////////////////////////////////////////////////////////////////////
// Name: wx/crt.h
// Purpose: Header to include all headers with wrappers for CRT functions
// Author: Robert Roebling
// Created: 2007-05-30
// Copyright: (c) 2007 wxWidgets dev team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CRT_H_
#define _WX_CRT_H_
#include "wx/defs.h"
// include wxChar type definition:
#include "wx/chartype.h"
// and wrappers for CRT functions:
#include "wx/wxcrt.h"
#include "wx/wxcrtvararg.h"
#endif // _WX_CRT_H_

View File

@ -4,7 +4,6 @@
// Author: Julian Smart, Vadim Zeitlin
// Modified by:
// Created: 08/09/2000
// RCS-ID: $Id: cshelp.h 61872 2009-09-09 22:37:05Z VZ $
// Copyright: (c) 2000 Julian Smart, Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -36,7 +35,7 @@
* window for the application to display help for.
*/
class WXDLLEXPORT wxContextHelp : public wxObject
class WXDLLIMPEXP_CORE wxContextHelp : public wxObject
{
public:
wxContextHelp(wxWindow* win = NULL, bool beginHelp = true);
@ -65,7 +64,7 @@ private:
* to put the application into context help mode.
*/
class WXDLLEXPORT wxContextHelpButton : public wxBitmapButton
class WXDLLIMPEXP_CORE wxContextHelpButton : public wxBitmapButton
{
public:
wxContextHelpButton(wxWindow* parent,
@ -106,7 +105,7 @@ private:
// and overriding ShowHelp() but calling the base class version wouldn't work
// any more, which forces us to use a rather ugly hack and pass the extra
// parameters of ShowHelpAtPoint() to ShowHelp() via member variables.
class WXDLLEXPORT wxHelpProvider
class WXDLLIMPEXP_CORE wxHelpProvider
{
public:
// get/set the current (application-global) help provider (Set() returns
@ -188,7 +187,7 @@ WX_DECLARE_EXPORTED_HASH_MAP( wxUIntPtr, wxString, wxIntegerHash,
// wxSimpleHelpProvider is an implementation of wxHelpProvider which supports
// only plain text help strings and shows the string associated with the
// control (if any) in a tooltip
class WXDLLEXPORT wxSimpleHelpProvider : public wxHelpProvider
class WXDLLIMPEXP_CORE wxSimpleHelpProvider : public wxHelpProvider
{
public:
// implement wxHelpProvider methods
@ -212,12 +211,12 @@ protected:
// both context identifiers and plain text help strings. If the help text is an integer,
// it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the string
// in a tooltip as per wxSimpleHelpProvider.
class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider
class WXDLLIMPEXP_CORE wxHelpControllerHelpProvider : public wxSimpleHelpProvider
{
public:
// Note that it doesn't own the help controller. The help controller
// should be deleted separately.
wxHelpControllerHelpProvider(wxHelpControllerBase* hc = (wxHelpControllerBase*) NULL);
wxHelpControllerHelpProvider(wxHelpControllerBase* hc = NULL);
// implement wxHelpProvider methods
@ -232,11 +231,11 @@ public:
protected:
wxHelpControllerBase* m_helpController;
DECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider)
wxDECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider);
};
// Convenience function for turning context id into wxString
WXDLLEXPORT wxString wxContextId(int id);
WXDLLIMPEXP_CORE wxString wxContextId(int id);
#endif // wxUSE_HELP

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 22.10.99
// RCS-ID: $Id: ctrlsub.h 42816 2006-10-31 08:50:17Z RD $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -16,6 +15,7 @@
#if wxUSE_CONTROLS
#include "wx/arrstr.h"
#include "wx/control.h" // base class
// ----------------------------------------------------------------------------
@ -29,7 +29,7 @@
// implements an extended interface deriving from this one)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxItemContainerImmutable
class WXDLLIMPEXP_CORE wxItemContainerImmutable
{
public:
wxItemContainerImmutable() { }
@ -72,7 +72,7 @@ public:
bool SetStringSelection(const wxString& s);
// return the selected string or empty string if none
wxString GetStringSelection() const;
virtual wxString GetStringSelection() const;
// this is the same as SetSelection( for single-selection controls but
// reads better for multi-selection ones
@ -80,14 +80,109 @@ public:
protected:
// check that the index is valid
inline bool IsValid(unsigned int n) const { return n < GetCount(); }
inline bool IsValidInsert(unsigned int n) const { return n <= GetCount(); }
bool IsValid(unsigned int n) const { return n < GetCount(); }
bool IsValidInsert(unsigned int n) const { return n <= GetCount(); }
};
class WXDLLEXPORT wxItemContainer : public wxItemContainerImmutable
// ----------------------------------------------------------------------------
// wxItemContainer extends wxItemContainerImmutable interface with methods
// for adding/removing items.
//
// Classes deriving from this one must override DoInsertItems() to implement
// adding items to the control. This can often be implemented more efficiently
// than simply looping over the elements and inserting them but if this is not
// the case, the generic DoInsertItemsInLoop can be used in implementation, but
// in this case DoInsertItem() needs to be overridden.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxItemContainer : public wxItemContainerImmutable
{
private:
// AppendItems() and InsertItems() helpers just call DoAppend/InsertItems()
// after doing some checks
//
// NB: they're defined here so that they're inlined when used in public part
int AppendItems(const wxArrayStringsAdapter& items,
void **clientData,
wxClientDataType type)
{
if ( items.IsEmpty() )
return wxNOT_FOUND;
return DoAppendItems(items, clientData, type);
}
int AppendItems(const wxArrayStringsAdapter& items)
{
return AppendItems(items, NULL, wxClientData_None);
}
int AppendItems(const wxArrayStringsAdapter& items, void **clientData)
{
wxASSERT_MSG( GetClientDataType() != wxClientData_Object,
wxT("can't mix different types of client data") );
return AppendItems(items, clientData, wxClientData_Void);
}
int AppendItems(const wxArrayStringsAdapter& items,
wxClientData **clientData)
{
wxASSERT_MSG( GetClientDataType() != wxClientData_Void,
wxT("can't mix different types of client data") );
return AppendItems(items, reinterpret_cast<void **>(clientData),
wxClientData_Object);
}
int InsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData,
wxClientDataType type)
{
wxASSERT_MSG( !IsSorted(), wxT("can't insert items in sorted control") );
wxCHECK_MSG( pos <= GetCount(), wxNOT_FOUND,
wxT("position out of range") );
// not all derived classes handle empty arrays correctly in
// DoInsertItems() and besides it really doesn't make much sense to do
// this (for append it could correspond to creating an initially empty
// control but why would anybody need to insert 0 items?)
wxCHECK_MSG( !items.IsEmpty(), wxNOT_FOUND,
wxT("need something to insert") );
return DoInsertItems(items, pos, clientData, type);
}
int InsertItems(const wxArrayStringsAdapter& items, unsigned int pos)
{
return InsertItems(items, pos, NULL, wxClientData_None);
}
int InsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData)
{
wxASSERT_MSG( GetClientDataType() != wxClientData_Object,
wxT("can't mix different types of client data") );
return InsertItems(items, pos, clientData, wxClientData_Void);
}
int InsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
wxClientData **clientData)
{
wxASSERT_MSG( GetClientDataType() != wxClientData_Void,
wxT("can't mix different types of client data") );
return InsertItems(items, pos,
reinterpret_cast<void **>(clientData),
wxClientData_Object);
}
public:
wxItemContainer() { m_clientDataItemsType = wxClientData_None; }
virtual ~wxItemContainer();
@ -95,99 +190,262 @@ public:
// adding items
// ------------
// append single item, return its position in the control (which can be
// different from the last one if the control is sorted)
int Append(const wxString& item)
{ return DoAppend(item); }
{ return AppendItems(item); }
int Append(const wxString& item, void *clientData)
{ int n = DoAppend(item); SetClientData(n, clientData); return n; }
{ return AppendItems(item, &clientData); }
int Append(const wxString& item, wxClientData *clientData)
{ int n = DoAppend(item); SetClientObject(n, clientData); return n; }
{ return AppendItems(item, &clientData); }
// only for rtti needs (separate name)
void AppendString( const wxString& item)
{ Append( item ); }
// append several items at once to the control, return the position of the
// last item appended
int Append(const wxArrayString& items)
{ return AppendItems(items); }
int Append(const wxArrayString& items, void **clientData)
{ return AppendItems(items, clientData); }
int Append(const wxArrayString& items, wxClientData **clientData)
{ return AppendItems(items, clientData); }
int Append(unsigned int n, const wxString *items)
{ return AppendItems(wxArrayStringsAdapter(n, items)); }
int Append(unsigned int n, const wxString *items, void **clientData)
{ return AppendItems(wxArrayStringsAdapter(n, items), clientData); }
int Append(unsigned int n,
const wxString *items,
wxClientData **clientData)
{ return AppendItems(wxArrayStringsAdapter(n, items), clientData); }
// append several items at once to the control
void Append(const wxArrayString& strings);
// only for RTTI needs (separate name)
void AppendString(const wxString& item)
{ Append(item); }
// inserting items: not for sorted controls!
// -----------------------------------------
// insert single item at the given position, return its effective position
int Insert(const wxString& item, unsigned int pos)
{ return DoInsert(item, pos); }
int Insert(const wxString& item, unsigned int pos, void *clientData);
int Insert(const wxString& item, unsigned int pos, wxClientData *clientData);
{ return InsertItems(item, pos); }
int Insert(const wxString& item, unsigned int pos, void *clientData)
{ return InsertItems(item, pos, &clientData); }
int Insert(const wxString& item, unsigned int pos, wxClientData *clientData)
{ return InsertItems(item, pos, &clientData); }
// insert several items at once into the control, return the index of the
// last item inserted
int Insert(const wxArrayString& items, unsigned int pos)
{ return InsertItems(items, pos); }
int Insert(const wxArrayString& items, unsigned int pos, void **clientData)
{ return InsertItems(items, pos, clientData); }
int Insert(const wxArrayString& items,
unsigned int pos,
wxClientData **clientData)
{ return InsertItems(items, pos, clientData); }
int Insert(unsigned int n, const wxString *items, unsigned int pos)
{ return InsertItems(wxArrayStringsAdapter(n, items), pos); }
int Insert(unsigned int n,
const wxString *items,
unsigned int pos,
void **clientData)
{ return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); }
int Insert(unsigned int n,
const wxString *items,
unsigned int pos,
wxClientData **clientData)
{ return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); }
// replacing items
// ---------------
void Set(const wxArrayString& items)
{ Clear(); Append(items); }
void Set(const wxArrayString& items, void **clientData)
{ Clear(); Append(items, clientData); }
void Set(const wxArrayString& items, wxClientData **clientData)
{ Clear(); Append(items, clientData); }
void Set(unsigned int n, const wxString *items)
{ Clear(); Append(n, items); }
void Set(unsigned int n, const wxString *items, void **clientData)
{ Clear(); Append(n, items, clientData); }
void Set(unsigned int n, const wxString *items, wxClientData **clientData)
{ Clear(); Append(n, items, clientData); }
// deleting items
// --------------
virtual void Clear() = 0;
virtual void Delete(unsigned int n) = 0;
void Clear();
void Delete(unsigned int pos);
// various accessors
// -----------------
// The control may maintain its items in a sorted order in which case
// items are automatically inserted at the right position when they are
// inserted or appended. Derived classes have to override this method if
// they implement sorting, typically by returning HasFlag(wxXX_SORT)
virtual bool IsSorted() const { return false; }
// misc
// ----
// client data stuff
// -----------------
void SetClientData(unsigned int n, void* clientData);
void* GetClientData(unsigned int n) const;
// SetClientObject() takes ownership of the pointer, GetClientObject()
// returns it but keeps the ownership while DetachClientObject() expects
// the caller to delete the pointer and also resets the internally stored
// one to NULL for this item
void SetClientObject(unsigned int n, wxClientData* clientData);
wxClientData* GetClientObject(unsigned int n) const;
wxClientData* DetachClientObject(unsigned int n);
// return the type of client data stored in this control: usually it just
// returns m_clientDataItemsType but must be overridden in the controls
// which delegate their client data storage to another one (e.g. wxChoice
// in wxUniv which stores data in wxListBox which it uses anyhow); don't
// forget to override SetClientDataType() if you override this one
//
// NB: for this to work no code should ever access m_clientDataItemsType
// directly but only via this function!
virtual wxClientDataType GetClientDataType() const
{ return m_clientDataItemsType; }
bool HasClientData() const
{ return GetClientDataType() != wxClientData_None; }
bool HasClientObjectData() const
{ return m_clientDataItemsType == wxClientData_Object; }
{ return GetClientDataType() == wxClientData_Object; }
bool HasClientUntypedData() const
{ return m_clientDataItemsType == wxClientData_Void; }
{ return GetClientDataType() == wxClientData_Void; }
protected:
virtual int DoAppend(const wxString& item) = 0;
virtual int DoInsert(const wxString& item, unsigned int pos) = 0;
// there is usually no need to override this method but you can do it if it
// is more convenient to only do "real" insertions in DoInsertItems() and
// to implement items appending here (in which case DoInsertItems() should
// call this method if pos == GetCount() as it can still be called in this
// case if public Insert() is called with such position)
virtual int DoAppendItems(const wxArrayStringsAdapter& items,
void **clientData,
wxClientDataType type)
{
return DoInsertItems(items, GetCount(), clientData, type);
}
virtual void DoSetItemClientData(unsigned int n, void* clientData) = 0;
virtual void* DoGetItemClientData(unsigned int n) const = 0;
virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData) = 0;
virtual wxClientData* DoGetItemClientObject(unsigned int n) const = 0;
// this method must be implemented to insert the items into the control at
// position pos which can be GetCount() meaning that the items should be
// appended; for the sorted controls the position can be ignored
//
// the derived classes typically use AssignNewItemClientData() to
// associate the data with the items as they're being inserted
//
// the method should return the index of the position the last item was
// inserted into or wxNOT_FOUND if an error occurred
virtual int DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos,
void **clientData,
wxClientDataType type) = 0;
// before the client data is set for the first time for the control which
// hadn't had it before, DoInitItemClientData() is called which gives the
// derived class the possibility to initialize its client data storage only
// when client data is really used
virtual void DoInitItemClientData() { }
virtual void DoSetItemClientData(unsigned int n, void *clientData) = 0;
virtual void *DoGetItemClientData(unsigned int n) const = 0;
virtual void DoClear() = 0;
virtual void DoDeleteOneItem(unsigned int pos) = 0;
// methods useful for the derived classes which don't have any better way
// of adding multiple items to the control than doing it one by one: such
// classes should call DoInsertItemsInLoop() from their DoInsert() and
// override DoInsertOneItem() to perform the real insertion
virtual int DoInsertOneItem(const wxString& item, unsigned int pos);
int DoInsertItemsInLoop(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData,
wxClientDataType type);
// helper for DoInsertItems(): n is the index into clientData, pos is the
// position of the item in the control
void AssignNewItemClientData(unsigned int pos,
void **clientData,
unsigned int n,
wxClientDataType type);
// free the client object associated with the item at given position and
// set it to NULL (must only be called if HasClientObjectData())
void ResetItemClientObject(unsigned int n);
// set the type of the client data stored in this control: override this if
// you override GetClientDataType()
virtual void SetClientDataType(wxClientDataType clientDataItemsType)
{
m_clientDataItemsType = clientDataItemsType;
}
private:
// the type of the client data for the items
wxClientDataType m_clientDataItemsType;
};
// this macro must (unfortunately) be used in any class deriving from both
// wxItemContainer and wxControl because otherwise there is ambiguity when
// calling GetClientXXX() functions -- the compiler can't choose between the
// two versions
#define wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST \
void SetClientData(void *data) \
{ wxEvtHandler::SetClientData(data); } \
void *GetClientData() const \
{ return wxEvtHandler::GetClientData(); } \
void SetClientObject(wxClientData *data) \
{ wxEvtHandler::SetClientObject(data); } \
wxClientData *GetClientObject() const \
{ return wxEvtHandler::GetClientObject(); } \
void SetClientData(unsigned int n, void* clientData) \
{ wxItemContainer::SetClientData(n, clientData); } \
void* GetClientData(unsigned int n) const \
{ return wxItemContainer::GetClientData(n); } \
void SetClientObject(unsigned int n, wxClientData* clientData) \
{ wxItemContainer::SetClientObject(n, clientData); } \
wxClientData* GetClientObject(unsigned int n) const \
{ return wxItemContainer::GetClientObject(n); }
class WXDLLEXPORT wxControlWithItems : public wxControl, public wxItemContainer
// Inheriting directly from a wxWindow-derived class and wxItemContainer
// unfortunately introduces an ambiguity for all GetClientXXX() methods as they
// are inherited twice: the "global" versions from wxWindow and the per-item
// versions taking the index from wxItemContainer.
//
// So we need to explicitly resolve them and this helper template class is
// provided to do it. To use it, simply inherit from wxWindowWithItems<Window,
// Container> instead of Window and Container interface directly.
template <class W, class C>
class wxWindowWithItems : public W, public C
{
public:
wxControlWithItems() { }
virtual ~wxControlWithItems();
typedef W BaseWindowClass;
typedef C BaseContainerInterface;
// we have to redefine these functions here to avoid ambiguities in classes
// deriving from us which would arise otherwise because both base classses
// have the methods with the same names - hopefully, a smart compiler can
// optimize away these simple inline wrappers so we don't suffer much from
// this
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
wxWindowWithItems() { }
void SetClientData(void *data)
{ BaseWindowClass::SetClientData(data); }
void *GetClientData() const
{ return BaseWindowClass::GetClientData(); }
void SetClientObject(wxClientData *data)
{ BaseWindowClass::SetClientObject(data); }
wxClientData *GetClientObject() const
{ return BaseWindowClass::GetClientObject(); }
void SetClientData(unsigned int n, void* clientData)
{ wxItemContainer::SetClientData(n, clientData); }
void* GetClientData(unsigned int n) const
{ return wxItemContainer::GetClientData(n); }
void SetClientObject(unsigned int n, wxClientData* clientData)
{ wxItemContainer::SetClientObject(n, clientData); }
wxClientData* GetClientObject(unsigned int n) const
{ return wxItemContainer::GetClientObject(n); }
};
class WXDLLIMPEXP_CORE wxControlWithItemsBase :
public wxWindowWithItems<wxControl, wxItemContainer>
{
public:
wxControlWithItemsBase() { }
// usually the controls like list/combo boxes have their own background
// colour
virtual bool ShouldInheritColours() const { return false; }
// Implementation only from now on.
// Generate an event of the given type for the selection change.
void SendSelectionChangedEvent(wxEventType eventType);
protected:
// fill in the client object or data field of the event as appropriate
//
@ -196,14 +454,25 @@ protected:
void InitCommandEventWithItems(wxCommandEvent& event, int n);
private:
DECLARE_ABSTRACT_CLASS(wxControlWithItems)
DECLARE_NO_COPY_CLASS(wxControlWithItems)
wxDECLARE_NO_COPY_CLASS(wxControlWithItemsBase);
};
// define the platform-specific wxControlWithItems class
#if defined(__WXMSW__)
#include "wx/msw/ctrlsub.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/ctrlsub.h"
#else
class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase
{
public:
wxControlWithItems() { }
// ----------------------------------------------------------------------------
// inline functions
// ----------------------------------------------------------------------------
private:
DECLARE_ABSTRACT_CLASS(wxControlWithItems)
wxDECLARE_NO_COPY_CLASS(wxControlWithItems);
};
#endif
#endif // wxUSE_CONTROLS

View File

@ -5,7 +5,6 @@
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: cursor.h 40865 2006-08-27 09:42:42Z VS $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -14,27 +13,56 @@
#include "wx/defs.h"
#if defined(__WXPALMOS__)
#include "wx/palmos/cursor.h"
#elif defined(__WXMSW__)
/*
wxCursor classes should have the following public API:
class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor();
wxCursor(const wxImage& image);
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
virtual ~wxCursor();
};
*/
#if defined(__WXMSW__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#include "wx/msw/cursor.h"
#elif defined(__WXMOTIF__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XBM
#include "wx/motif/cursor.h"
#elif defined(__WXGTK20__)
#ifdef __WINDOWS__
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#else
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#endif
#include "wx/gtk/cursor.h"
#elif defined(__WXGTK__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#include "wx/gtk1/cursor.h"
#elif defined(__WXX11__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#include "wx/x11/cursor.h"
#elif defined(__WXMGL__)
#include "wx/mgl/cursor.h"
#elif defined(__WXDFB__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#include "wx/dfb/cursor.h"
#elif defined(__WXMAC__)
#include "wx/mac/cursor.h"
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE
#include "wx/osx/cursor.h"
#elif defined(__WXCOCOA__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE
#include "wx/cocoa/cursor.h"
#elif defined(__WXPM__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#include "wx/os2/cursor.h"
#endif

View File

@ -0,0 +1,52 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/custombgwin.h
// Purpose: Class adding support for custom window backgrounds.
// Author: Vadim Zeitlin
// Created: 2011-10-10
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CUSTOMBGWIN_H_
#define _WX_CUSTOMBGWIN_H_
// ----------------------------------------------------------------------------
// wxCustomBackgroundWindow: Adds support for custom backgrounds to any
// wxWindow-derived class.
// ----------------------------------------------------------------------------
class wxCustomBackgroundWindowBase
{
public:
// Trivial default ctor.
wxCustomBackgroundWindowBase() { }
// Also a trivial but virtual -- to suppress g++ warnings -- dtor.
virtual ~wxCustomBackgroundWindowBase() { }
// Use the given bitmap to tile the background of this window. This bitmap
// will show through any transparent children.
//
// Notice that you must not prevent the base class EVT_ERASE_BACKGROUND
// handler from running (i.e. not to handle this event yourself) for this
// to work.
void SetBackgroundBitmap(const wxBitmap& bmp)
{
DoSetBackgroundBitmap(bmp);
}
protected:
virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) = 0;
wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowBase);
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/custombgwin.h"
#elif defined(__WXMSW__)
#include "wx/msw/custombgwin.h"
#else
#include "wx/generic/custombgwin.h"
#endif
#endif // _WX_CUSTOMBGWIN_H_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin, Robert Roebling
// Modified by:
// Created: 26.05.99
// RCS-ID: $Id: dataobj.h 40772 2006-08-23 13:38:45Z VZ $
// Copyright: (c) wxWidgets Team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -55,7 +54,7 @@ public:
typedef <integral type> NativeFormat;
wxDataFormat(NativeFormat format = wxDF_INVALID);
wxDataFormat(const wxChar *format);
wxDataFormat(const wxString& format);
wxDataFormat& operator=(NativeFormat format);
wxDataFormat& operator=(const wxDataFormat& format);
@ -67,7 +66,7 @@ public:
NativeFormat GetType() const;
wxString GetId() const;
void SetId(const wxChar *format);
void SetId(const wxString& format);
};
*/
@ -83,7 +82,7 @@ public:
#elif defined(__WXX11__)
#include "wx/x11/dataform.h"
#elif defined(__WXMAC__)
#include "wx/mac/dataform.h"
#include "wx/osx/dataform.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dataform.h"
#elif defined(__WXPM__)
@ -92,7 +91,7 @@ public:
// the value for default argument to some functions (corresponds to
// wxDF_INVALID)
extern WXDLLEXPORT const wxDataFormat& wxFormatInvalid;
extern WXDLLIMPEXP_CORE const wxDataFormat& wxFormatInvalid;
// ----------------------------------------------------------------------------
// wxDataObject represents a piece of data which knows which formats it
@ -114,7 +113,7 @@ extern WXDLLEXPORT const wxDataFormat& wxFormatInvalid;
// to be supported by SetData() or GetDataHere().
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxDataObjectBase
class WXDLLIMPEXP_CORE wxDataObjectBase
{
public:
enum Direction
@ -171,7 +170,7 @@ public:
#elif defined(__WXGTK__)
#include "wx/gtk1/dataobj.h"
#elif defined(__WXMAC__)
#include "wx/mac/dataobj.h"
#include "wx/osx/dataobj.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dataobj.h"
#elif defined(__WXPM__)
@ -194,7 +193,7 @@ public:
// Otherwise, you should use wxDataObjectComposite or wxDataObject directly.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxDataObjectSimple : public wxDataObject
class WXDLLIMPEXP_CORE wxDataObjectSimple : public wxDataObject
{
public:
// ctor takes the format we support, but it can also be set later with
@ -246,7 +245,7 @@ private:
// the one and only format we support
wxDataFormat m_format;
DECLARE_NO_COPY_CLASS(wxDataObjectSimple)
wxDECLARE_NO_COPY_CLASS(wxDataObjectSimple);
};
// ----------------------------------------------------------------------------
@ -261,7 +260,7 @@ private:
WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
class WXDLLEXPORT wxDataObjectComposite : public wxDataObject
class WXDLLIMPEXP_CORE wxDataObjectComposite : public wxDataObject
{
public:
// ctor
@ -274,11 +273,17 @@ public:
void Add(wxDataObjectSimple *dataObject, bool preferred = false);
// Report the format passed to the SetData method. This should be the
// format of the data object within the composite that recieved data from
// format of the data object within the composite that received data from
// the clipboard or the DnD operation. You can use this method to find
// out what kind of data object was recieved.
// out what kind of data object was received.
wxDataFormat GetReceivedFormat() const;
// Returns the pointer to the object which supports this format or NULL.
// The returned pointer is owned by wxDataObjectComposite and must
// therefore not be destroyed by the caller.
wxDataObjectSimple *GetObject(const wxDataFormat& format,
wxDataObjectBase::Direction dir = Get) const;
// implement base class pure virtuals
// ----------------------------------
virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const;
@ -295,10 +300,6 @@ public:
virtual size_t GetBufferOffset( const wxDataFormat& format );
#endif
protected:
// returns the pointer to the object which supports this format or NULL
wxDataObjectSimple *GetObject(const wxDataFormat& format) const;
private:
// the list of all (simple) data objects whose formats we support
wxSimpleDataObjectList m_dataObjects;
@ -309,7 +310,7 @@ private:
wxDataFormat m_receivedFormat;
DECLARE_NO_COPY_CLASS(wxDataObjectComposite)
wxDECLARE_NO_COPY_CLASS(wxDataObjectComposite);
};
// ============================================================================
@ -324,7 +325,54 @@ private:
// wxTextDataObject contains text data
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxTextDataObject : public wxDataObjectSimple
#if wxUSE_UNICODE
#if defined(__WXGTK20__)
#define wxNEEDS_UTF8_FOR_TEXT_DATAOBJ
#elif defined(__WXMAC__)
#define wxNEEDS_UTF16_FOR_TEXT_DATAOBJ
#endif
#endif // wxUSE_UNICODE
class WXDLLIMPEXP_CORE wxHTMLDataObject : public wxDataObjectSimple
{
public:
// ctor: you can specify the text here or in SetText(), or override
// GetText()
wxHTMLDataObject(const wxString& html = wxEmptyString)
: wxDataObjectSimple(wxDF_HTML),
m_html(html)
{
}
// virtual functions which you may override if you want to provide text on
// demand only - otherwise, the trivial default versions will be used
virtual size_t GetLength() const { return m_html.Len() + 1; }
virtual wxString GetHTML() const { return m_html; }
virtual void SetHTML(const wxString& html) { m_html = html; }
virtual size_t GetDataSize() const;
virtual bool GetDataHere(void *buf) const;
virtual bool SetData(size_t len, const void *buf);
// Must provide overloads to avoid hiding them (and warnings about it)
virtual size_t GetDataSize(const wxDataFormat&) const
{
return GetDataSize();
}
virtual bool GetDataHere(const wxDataFormat&, void *buf) const
{
return GetDataHere(buf);
}
virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
{
return SetData(len, buf);
}
private:
wxString m_html;
};
class WXDLLIMPEXP_CORE wxTextDataObject : public wxDataObjectSimple
{
public:
// ctor: you can specify the text here or in SetText(), or override
@ -351,7 +399,7 @@ public:
// ----------------------------------
// some platforms have 2 and not 1 format for text data
#if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__))
#if defined(wxNEEDS_UTF8_FOR_TEXT_DATAOBJ) || defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ)
virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
virtual void GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;
@ -363,7 +411,7 @@ public:
size_t GetDataSize(const wxDataFormat& format) const;
bool GetDataHere(const wxDataFormat& format, void *pBuf) const;
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf);
#else
#else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ
virtual size_t GetDataSize() const;
virtual bool GetDataHere(void *buf) const;
virtual bool SetData(size_t len, const void *buf);
@ -380,19 +428,19 @@ public:
{
return SetData(len, buf);
}
#endif
#endif // different wxTextDataObject implementations
private:
wxString m_text;
DECLARE_NO_COPY_CLASS(wxTextDataObject)
wxDECLARE_NO_COPY_CLASS(wxTextDataObject);
};
// ----------------------------------------------------------------------------
// wxBitmapDataObject contains a bitmap
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapDataObjectBase : public wxDataObjectSimple
class WXDLLIMPEXP_CORE wxBitmapDataObjectBase : public wxDataObjectSimple
{
public:
// ctor: you can specify the bitmap here or in SetBitmap(), or override
@ -410,7 +458,7 @@ public:
protected:
wxBitmap m_bitmap;
DECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase)
wxDECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase);
};
// ----------------------------------------------------------------------------
@ -420,7 +468,7 @@ protected:
// data from drag and drop operation.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxFileDataObjectBase : public wxDataObjectSimple
class WXDLLIMPEXP_CORE wxFileDataObjectBase : public wxDataObjectSimple
{
public:
// ctor: use AddFile() later to fill the array
@ -432,7 +480,7 @@ public:
protected:
wxArrayString m_filenames;
DECLARE_NO_COPY_CLASS(wxFileDataObjectBase)
wxDECLARE_NO_COPY_CLASS(wxFileDataObjectBase);
};
// ----------------------------------------------------------------------------
@ -441,7 +489,7 @@ protected:
// It is understood that this data can be copied bitwise.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxCustomDataObject : public wxDataObjectSimple
class WXDLLIMPEXP_CORE wxCustomDataObject : public wxDataObjectSimple
{
public:
// if you don't specify the format in the ctor, you can still use
@ -493,7 +541,7 @@ private:
size_t m_size;
void *m_data;
DECLARE_NO_COPY_CLASS(wxCustomDataObject)
wxDECLARE_NO_COPY_CLASS(wxCustomDataObject);
};
// ----------------------------------------------------------------------------
@ -502,19 +550,20 @@ private:
#if defined(__WXMSW__)
#include "wx/msw/ole/dataobj2.h"
// wxURLDataObject defined in msw/ole/dataobj2.h
#else // !__WXMSW__
#if defined(__WXGTK20__)
#include "wx/gtk/dataobj2.h"
#elif defined(__WXGTK__)
#elif defined(__WXGTK20__)
#include "wx/gtk/dataobj2.h"
// wxURLDataObject defined in msw/ole/dataobj2.h
#else
#if defined(__WXGTK__)
#include "wx/gtk1/dataobj2.h"
#elif defined(__WXX11__)
#include "wx/x11/dataobj2.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/dataobj2.h"
#elif defined(__WXMAC__)
#include "wx/mac/dataobj2.h"
#include "wx/osx/dataobj2.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dataobj2.h"
#elif defined(__WXPM__)
@ -522,7 +571,7 @@ private:
#endif
// wxURLDataObject is simply wxTextDataObject with a different name
class WXDLLEXPORT wxURLDataObject : public wxTextDataObject
class WXDLLIMPEXP_CORE wxURLDataObject : public wxTextDataObject
{
public:
wxURLDataObject(const wxString& url = wxEmptyString)
@ -533,7 +582,7 @@ private:
wxString GetURL() const { return GetText(); }
void SetURL(const wxString& url) { SetText(url); }
};
#endif // __WXMSW__/!__WXMSW__
#endif
#endif // wxUSE_DATAOBJ

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/datectrl.h
// Purpose: implements wxDatePickerCtrl
// Author: Vadim Zeitlin
// Modified by:
// Created: 2005-01-09
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DATECTRL_H_
#define _WX_DATECTRL_H_
#include "wx/defs.h"
#if wxUSE_DATEPICKCTRL
#include "wx/datetimectrl.h" // the base class
#define wxDatePickerCtrlNameStr wxT("datectrl")
// wxDatePickerCtrl styles
enum
{
// default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN
wxDP_DEFAULT = 0,
// a spin control-like date picker (not supported in generic version)
wxDP_SPIN = 1,
// a combobox-like date picker (not supported in mac version)
wxDP_DROPDOWN = 2,
// always show century in the default date display (otherwise it depends on
// the system date format which may include the century or not)
wxDP_SHOWCENTURY = 4,
// allow not having any valid date in the control (by default it always has
// some date, today initially if no valid date specified in ctor)
wxDP_ALLOWNONE = 8
};
// ----------------------------------------------------------------------------
// wxDatePickerCtrl: allow the user to enter the date
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxDateTimePickerCtrl
{
public:
/*
The derived classes should implement ctor and Create() method with the
following signature:
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDatePickerCtrlNameStr);
*/
/*
We inherit the methods to set/get the date from the base class.
virtual void SetValue(const wxDateTime& dt) = 0;
virtual wxDateTime GetValue() const = 0;
*/
// And add methods to set/get the allowed valid range for the dates. If
// either/both of them are invalid, there is no corresponding limit and if
// neither is set, GetRange() returns false.
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0;
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0;
};
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/datectrl.h"
#define wxHAS_NATIVE_DATEPICKCTRL
#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
#include "wx/osx/datectrl.h"
#define wxHAS_NATIVE_DATEPICKCTRL
#else
#include "wx/generic/datectrl.h"
class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric
{
public:
wxDatePickerCtrl() { }
wxDatePickerCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDatePickerCtrlNameStr)
: wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name)
{
}
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl)
};
#endif
#endif // wxUSE_DATEPICKCTRL
#endif // _WX_DATECTRL_H_

View File

@ -0,0 +1,64 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/dateevt.h
// Purpose: declares wxDateEvent class
// Author: Vadim Zeitlin
// Modified by:
// Created: 2005-01-10
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DATEEVT_H_
#define _WX_DATEEVT_H_
#include "wx/event.h"
#include "wx/datetime.h"
#include "wx/window.h"
// ----------------------------------------------------------------------------
// wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent
{
public:
wxDateEvent() { }
wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
: wxCommandEvent(type, win->GetId()),
m_date(dt)
{
SetEventObject(win);
}
const wxDateTime& GetDate() const { return m_date; }
void SetDate(const wxDateTime &date) { m_date = date; }
// default copy ctor, assignment operator and dtor are ok
virtual wxEvent *Clone() const { return new wxDateEvent(*this); }
private:
wxDateTime m_date;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent)
};
// ----------------------------------------------------------------------------
// event types and macros for handling them
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, wxDateEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_TIME_CHANGED, wxDateEvent);
typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&);
#define wxDateEventHandler(func) \
wxEVENT_HANDLER_CAST(wxDateEventFunction, func)
#define EVT_DATE_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn))
#define EVT_TIME_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn))
#endif // _WX_DATEEVT_H_

View File

@ -5,7 +5,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 10.02.99
// RCS-ID: $Id: datetime.h 61872 2009-09-09 22:37:05Z VZ $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -17,19 +16,23 @@
#if wxUSE_DATETIME
#ifndef __WXWINCE__
#include <time.h>
#ifdef __WXWINCE__
#include "wx/msw/wince/time.h"
#else
#include "wx/msw/wince/time.h"
#endif
#include <time.h>
#endif // OS
#include <limits.h> // for INT_MIN
#include "wx/longlong.h"
#include "wx/anystr.h"
class WXDLLIMPEXP_FWD_BASE wxDateTime;
class WXDLLIMPEXP_FWD_BASE wxTimeSpan;
class WXDLLIMPEXP_FWD_BASE wxDateSpan;
#ifdef __WINDOWS__
struct _SYSTEMTIME;
#endif
#include "wx/dynarray.h"
@ -37,11 +40,8 @@ class WXDLLIMPEXP_FWD_BASE wxDateSpan;
// set this to the corresponding value in seconds 1/1/1970 has on your
// systems c-runtime
#if defined(__WXMAC__) && !defined(__DARWIN__) && __MSL__ < 0x6000
#define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L )
#else
#define WX_TIME_BASE_OFFSET 0
#endif
#define WX_TIME_BASE_OFFSET 0
/*
* TODO
*
@ -52,27 +52,6 @@ class WXDLLIMPEXP_FWD_BASE wxDateSpan;
* 5. wxDateTimeHolidayAuthority for Easter and other christian feasts
*/
/* Two wrapper functions for thread safety */
#ifdef HAVE_LOCALTIME_R
#define wxLocaltime_r localtime_r
#else
WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*);
#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__)
// On Windows, localtime _is_ threadsafe!
#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r
#endif
#endif
#ifdef HAVE_GMTIME_R
#define wxGmtime_r gmtime_r
#else
WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*);
#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__)
// On Windows, gmtime _is_ threadsafe!
#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r
#endif
#endif
/*
The three (main) classes declared in this header represent:
@ -127,12 +106,25 @@ WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*);
// wxInvalidDateTime)
class WXDLLIMPEXP_FWD_BASE wxDateTime;
extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultDateTimeFormat;
extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultTimeSpanFormat;
extern WXDLLIMPEXP_DATA_BASE(const char) wxDefaultDateTimeFormat[];
extern WXDLLIMPEXP_DATA_BASE(const char) wxDefaultTimeSpanFormat[];
extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime;
#define wxInvalidDateTime wxDefaultDateTime
// ----------------------------------------------------------------------------
// conditional compilation
// ----------------------------------------------------------------------------
// if configure detected strftime(), we have it too
#ifdef HAVE_STRFTIME
#define wxHAS_STRFTIME
// suppose everyone else has strftime except Win CE unless VC8 is used
#elif !defined(__WXWINCE__) || defined(__VISUALC8__)
#define wxHAS_STRFTIME
#endif
// ----------------------------------------------------------------------------
// wxDateTime represents an absolute moment in the time
// ----------------------------------------------------------------------------
@ -159,7 +151,7 @@ public:
// the time in the current time zone
Local,
// zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
// zones from GMT (= Greenwich Mean Time): they're guaranteed to be
// consequent numbers, so writing something like `GMT0 + offset' is
// safe if abs(offset) <= 12
@ -229,124 +221,6 @@ public:
// TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?)
};
// these values only are used to identify the different dates of
// adoption of the Gregorian calendar (see IsGregorian())
//
// All data and comments taken verbatim from "The Calendar FAQ (v 2.0)"
// by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html
// except for the comments "we take".
//
// Symbol "->" should be read as "was followed by" in the comments
// which follow.
enum GregorianAdoption
{
Gr_Unknown, // no data for this country or it's too uncertain to use
Gr_Standard, // on the day 0 of Gregorian calendar: 15 Oct 1582
Gr_Alaska, // Oct 1867 when Alaska became part of the USA
Gr_Albania, // Dec 1912
Gr_Austria = Gr_Unknown, // Different regions on different dates
Gr_Austria_Brixen, // 5 Oct 1583 -> 16 Oct 1583
Gr_Austria_Salzburg = Gr_Austria_Brixen,
Gr_Austria_Tyrol = Gr_Austria_Brixen,
Gr_Austria_Carinthia, // 14 Dec 1583 -> 25 Dec 1583
Gr_Austria_Styria = Gr_Austria_Carinthia,
Gr_Belgium, // Then part of the Netherlands
Gr_Bulgaria = Gr_Unknown, // Unknown precisely (from 1915 to 1920)
Gr_Bulgaria_1, // 18 Mar 1916 -> 1 Apr 1916
Gr_Bulgaria_2, // 31 Mar 1916 -> 14 Apr 1916
Gr_Bulgaria_3, // 3 Sep 1920 -> 17 Sep 1920
Gr_Canada = Gr_Unknown, // Different regions followed the changes in
// Great Britain or France
Gr_China = Gr_Unknown, // Different authorities say:
Gr_China_1, // 18 Dec 1911 -> 1 Jan 1912
Gr_China_2, // 18 Dec 1928 -> 1 Jan 1929
Gr_Czechoslovakia, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584
Gr_Denmark, // (including Norway) 18 Feb 1700 -> 1 Mar 1700
Gr_Egypt, // 1875
Gr_Estonia, // 1918
Gr_Finland, // Then part of Sweden
Gr_France, // 9 Dec 1582 -> 20 Dec 1582
Gr_France_Alsace, // 4 Feb 1682 -> 16 Feb 1682
Gr_France_Lorraine, // 16 Feb 1760 -> 28 Feb 1760
Gr_France_Strasbourg, // February 1682
Gr_Germany = Gr_Unknown, // Different states on different dates:
Gr_Germany_Catholic, // 1583-1585 (we take 1584)
Gr_Germany_Prussia, // 22 Aug 1610 -> 2 Sep 1610
Gr_Germany_Protestant, // 18 Feb 1700 -> 1 Mar 1700
Gr_GreatBritain, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)')
Gr_Greece, // 9 Mar 1924 -> 23 Mar 1924
Gr_Hungary, // 21 Oct 1587 -> 1 Nov 1587
Gr_Ireland = Gr_GreatBritain,
Gr_Italy = Gr_Standard,
Gr_Japan = Gr_Unknown, // Different authorities say:
Gr_Japan_1, // 19 Dec 1872 -> 1 Jan 1873
Gr_Japan_2, // 19 Dec 1892 -> 1 Jan 1893
Gr_Japan_3, // 18 Dec 1918 -> 1 Jan 1919
Gr_Latvia, // 1915-1918 (we take 1915)
Gr_Lithuania, // 1915
Gr_Luxemburg, // 14 Dec 1582 -> 25 Dec 1582
Gr_Netherlands = Gr_Belgium, // (including Belgium) 1 Jan 1583
// this is too weird to take into account: the Gregorian calendar was
// introduced twice in Groningen, first time 28 Feb 1583 was followed
// by 11 Mar 1583, then it has gone back to Julian in the summer of
// 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is
// the date we take here
Gr_Netherlands_Groningen, // 13 Dec 1700 -> 12 Jan 1701
Gr_Netherlands_Gelderland, // 30 Jun 1700 -> 12 Jul 1700
Gr_Netherlands_Utrecht, // (and Overijssel) 30 Nov 1700->12 Dec 1700
Gr_Netherlands_Friesland, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701
Gr_Norway = Gr_Denmark, // Then part of Denmark
Gr_Poland = Gr_Standard,
Gr_Portugal = Gr_Standard,
Gr_Romania, // 31 Mar 1919 -> 14 Apr 1919
Gr_Russia, // 31 Jan 1918 -> 14 Feb 1918
Gr_Scotland = Gr_GreatBritain,
Gr_Spain = Gr_Standard,
// Sweden has a curious history. Sweden decided to make a gradual
// change from the Julian to the Gregorian calendar. By dropping every
// leap year from 1700 through 1740 the eleven superfluous days would
// be omitted and from 1 Mar 1740 they would be in sync with the
// Gregorian calendar. (But in the meantime they would be in sync with
// nobody!)
//
// So 1700 (which should have been a leap year in the Julian calendar)
// was not a leap year in Sweden. However, by mistake 1704 and 1708
// became leap years. This left Sweden out of synchronisation with
// both the Julian and the Gregorian world, so they decided to go back
// to the Julian calendar. In order to do this, they inserted an extra
// day in 1712, making that year a double leap year! So in 1712,
// February had 30 days in Sweden.
//
// Later, in 1753, Sweden changed to the Gregorian calendar by
// dropping 11 days like everyone else.
Gr_Sweden = Gr_Finland, // 17 Feb 1753 -> 1 Mar 1753
Gr_Switzerland = Gr_Unknown,// Different cantons used different dates
Gr_Switzerland_Catholic, // 1583, 1584 or 1597 (we take 1584)
Gr_Switzerland_Protestant, // 31 Dec 1700 -> 12 Jan 1701
Gr_Turkey, // 1 Jan 1927
Gr_USA = Gr_GreatBritain,
Gr_Wales = Gr_GreatBritain,
Gr_Yugoslavia // 1919
};
// the country parameter is used so far for calculating the start and
// the end of DST period and for deciding whether the date is a work
// day or not
@ -415,26 +289,22 @@ public:
// helper classes
// ------------------------------------------------------------------------
// a class representing a time zone: basicly, this is just an offset
// a class representing a time zone: basically, this is just an offset
// (in seconds) from GMT
class WXDLLIMPEXP_BASE TimeZone
{
public:
TimeZone(TZ tz);
// don't use this ctor, it doesn't work for negative offsets (but can't
// be removed or changed to avoid breaking ABI in 2.8)
TimeZone(wxDateTime_t offset = 0) { m_offset = offset; }
#if wxABI_VERSION >= 20808
// create time zone object with the given offset
TimeZone(long offset = 0) { m_offset = offset; }
static TimeZone Make(long offset)
{
TimeZone tz;
tz.m_offset = offset;
return tz;
}
#endif // wxABI 2.8.8+
long GetOffset() const { return m_offset; }
@ -452,7 +322,9 @@ public:
// instead of modifying the member fields directly!
struct WXDLLIMPEXP_BASE Tm
{
wxDateTime_t msec, sec, min, hour, mday;
wxDateTime_t msec, sec, min, hour,
mday, // Day of the month in 1..31 range.
yday; // Day of the year in 0..365 range.
Month mon;
int year;
@ -487,9 +359,10 @@ public:
// the timezone we correspond to
TimeZone m_tz;
// these values can't be accessed directly because they're not always
// computed and we calculate them on demand
wxDateTime_t wday, yday;
// This value can only be accessed via GetWeekDay() and not directly
// because it's not always computed when creating this object and may
// need to be calculated on demand.
wxDateTime_t wday;
};
// static methods
@ -532,16 +405,25 @@ public:
int year = Inv_Year,
Calendar cal = Gregorian);
// get the full (default) or abbreviated month name in the current
// locale, returns empty string on error
static wxString GetMonthName(Month month,
NameFlags flags = Name_Full);
// get the standard English full (default) or abbreviated month name
static wxString GetEnglishMonthName(Month month,
NameFlags flags = Name_Full);
// get the full (default) or abbreviated weekday name in the current
// locale, returns empty string on error
static wxString GetWeekDayName(WeekDay weekday,
NameFlags flags = Name_Full);
// get the standard English full (default) or abbreviated weekday name
static wxString GetEnglishWeekDayName(WeekDay weekday,
NameFlags flags = Name_Full);
// get the AM and PM strings in the current locale (may be empty)
static void GetAmPmStrings(wxString *am, wxString *pm);
@ -577,7 +459,7 @@ public:
// ------------------------------------------------------------------------
// default ctor does not initialize the object, use Set()!
wxDateTime() { m_time = wxLongLong((wxInt32)UINT_MAX, UINT_MAX); }
wxDateTime() { m_time = wxLongLong(wxINT32_MIN, 0); }
// from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
@ -605,6 +487,12 @@ public:
wxDateTime_t minute = 0,
wxDateTime_t second = 0,
wxDateTime_t millisec = 0);
#ifdef __WINDOWS__
wxDateTime(const struct _SYSTEMTIME& st)
{
SetFromMSWSysTime(st);
}
#endif
// default copy ctor ok
@ -652,11 +540,9 @@ public:
// resets time to 00:00:00, doesn't change the date
wxDateTime& ResetTime();
#if wxABI_VERSION >= 20802
// get the date part of this object only, i.e. the object which has the
// same date as this one but time of 00:00:00
wxDateTime GetDateOnly() const;
#endif // wxABI 2.8.1+
// the following functions don't change the values of the other
// fields, i.e. SetMinute() won't change either hour or seconds value
@ -688,7 +574,7 @@ public:
// default assignment operator is ok
// calendar calculations (functions which set the date only leave the time
// unchanged, e.g. don't explictly zero it): SetXXX() functions modify the
// unchanged, e.g. don't explicitly zero it): SetXXX() functions modify the
// object itself, GetXXX() ones return a new object.
// ------------------------------------------------------------------------
@ -706,7 +592,7 @@ public:
wxDateTime& SetToPrevWeekDay(WeekDay weekday);
inline wxDateTime GetPrevWeekDay(WeekDay weekday) const;
// set to Nth occurence of given weekday in the given month of the
// set to Nth occurrence of given weekday in the given month of the
// given year (time is set to 0), return true on success and false on
// failure. n may be positive (1..5) or negative to count from the end
// of the month (see helper function SetToLastWeekDay())
@ -904,14 +790,6 @@ public:
// because the holidays are different in different countries
bool IsWorkDay(Country country = Country_Default) const;
// is this date later than Gregorian calendar introduction for the
// given country (see enum GregorianAdoption)?
//
// NB: this function shouldn't be considered as absolute authority in
// the matter. Besides, for some countries the exact date of
// adoption of the Gregorian calendar is simply unknown.
bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const;
// dos date and time format
// ------------------------------------------------------------------------
@ -921,6 +799,20 @@ public:
// pack the date in DOS format
unsigned long GetAsDOS() const;
// SYSTEMTIME format
// ------------------------------------------------------------------------
#ifdef __WINDOWS__
// convert SYSTEMTIME to wxDateTime
wxDateTime& SetFromMSWSysTime(const struct _SYSTEMTIME& st);
// convert wxDateTime to SYSTEMTIME
void GetAsMSWSysTime(struct _SYSTEMTIME* st) const;
// same as above but only take date part into account, time is always zero
wxDateTime& SetFromMSWSysDate(const struct _SYSTEMTIME& st);
void GetAsMSWSysDate(struct _SYSTEMTIME* st) const;
#endif // __WINDOWS__
// comparison (see also functions below for operator versions)
// ------------------------------------------------------------------------
@ -1044,46 +936,195 @@ public:
inline wxTimeSpan Subtract(const wxDateTime& dt) const;
inline wxTimeSpan operator-(const wxDateTime& dt2) const;
// conversion to/from text: all conversions from text return the pointer to
// the next character following the date specification (i.e. the one where
// the scan had to stop) or NULL on failure.
wxDateSpan DiffAsDateSpan(const wxDateTime& dt) const;
// conversion to/from text
// ------------------------------------------------------------------------
// all conversions functions return true to indicate whether parsing
// succeeded or failed and fill in the provided end iterator, which must
// not be NULL, with the location of the character where the parsing
// stopped (this will be end() of the passed string if everything was
// parsed)
// parse a string in RFC 822 format (found e.g. in mail headers and
// having the form "Wed, 10 Feb 1999 19:07:07 +0100")
const wxChar *ParseRfc822Date(const wxChar* date);
bool ParseRfc822Date(const wxString& date,
wxString::const_iterator *end);
// parse a date/time in the given format (see strptime(3)), fill in
// the missing (in the string) fields with the values of dateDef (by
// default, they will not change if they had valid values or will
// default to Today() otherwise)
const wxChar *ParseFormat(const wxChar *date,
const wxChar *format = wxDefaultDateTimeFormat,
const wxDateTime& dateDef = wxDefaultDateTime);
bool ParseFormat(const wxString& date,
const wxString& format,
const wxDateTime& dateDef,
wxString::const_iterator *end);
bool ParseFormat(const wxString& date,
const wxString& format,
wxString::const_iterator *end)
{
return ParseFormat(date, format, wxDefaultDateTime, end);
}
bool ParseFormat(const wxString& date,
wxString::const_iterator *end)
{
return ParseFormat(date, wxDefaultDateTimeFormat, wxDefaultDateTime, end);
}
// parse a string containing date, time or both in ISO 8601 format
//
// notice that these functions are new in wx 3.0 and so we don't
// provide compatibility overloads for them
bool ParseISODate(const wxString& date)
{
wxString::const_iterator end;
return ParseFormat(date, wxS("%Y-%m-%d"), &end) && end == date.end();
}
bool ParseISOTime(const wxString& time)
{
wxString::const_iterator end;
return ParseFormat(time, wxS("%H:%M:%S"), &end) && end == time.end();
}
bool ParseISOCombined(const wxString& datetime, char sep = 'T')
{
wxString::const_iterator end;
const wxString fmt = wxS("%Y-%m-%d") + wxString(sep) + wxS("%H:%M:%S");
return ParseFormat(datetime, fmt, &end) && end == datetime.end();
}
// parse a string containing the date/time in "free" format, this
// function will try to make an educated guess at the string contents
const wxChar *ParseDateTime(const wxChar *datetime);
bool ParseDateTime(const wxString& datetime,
wxString::const_iterator *end);
// parse a string containing the date only in "free" format (less
// flexible than ParseDateTime)
const wxChar *ParseDate(const wxChar *date);
bool ParseDate(const wxString& date,
wxString::const_iterator *end);
// parse a string containing the time only in "free" format
const wxChar *ParseTime(const wxChar *time);
bool ParseTime(const wxString& time,
wxString::const_iterator *end);
// this function accepts strftime()-like format string (default
// argument corresponds to the preferred date and time representation
// for the current locale) and returns the string containing the
// resulting text representation
wxString Format(const wxChar *format = wxDefaultDateTimeFormat,
wxString Format(const wxString& format = wxDefaultDateTimeFormat,
const TimeZone& tz = Local) const;
// preferred date representation for the current locale
wxString FormatDate() const { return Format(wxT("%x")); }
wxString FormatDate() const { return Format(wxS("%x")); }
// preferred time representation for the current locale
wxString FormatTime() const { return Format(wxT("%X")); }
wxString FormatTime() const { return Format(wxS("%X")); }
// returns the string representing the date in ISO 8601 format
// (YYYY-MM-DD)
wxString FormatISODate() const { return Format(wxT("%Y-%m-%d")); }
wxString FormatISODate() const { return Format(wxS("%Y-%m-%d")); }
// returns the string representing the time in ISO 8601 format
// (HH:MM:SS)
wxString FormatISOTime() const { return Format(wxT("%H:%M:%S")); }
wxString FormatISOTime() const { return Format(wxS("%H:%M:%S")); }
// return the combined date time representation in ISO 8601 format; the
// separator character should be 'T' according to the standard but it
// can also be useful to set it to ' '
wxString FormatISOCombined(char sep = 'T') const
{ return FormatISODate() + sep + FormatISOTime(); }
// backwards compatible versions of the parsing functions: they return an
// object representing the next character following the date specification
// (i.e. the one where the scan had to stop) or a special NULL-like object
// on failure
//
// they're not deprecated because a lot of existing code uses them and
// there is no particular harm in keeping them but you should still prefer
// the versions above in the new code
wxAnyStrPtr ParseRfc822Date(const wxString& date)
{
wxString::const_iterator end;
return ParseRfc822Date(date, &end) ? wxAnyStrPtr(date, end)
: wxAnyStrPtr();
}
wxAnyStrPtr ParseFormat(const wxString& date,
const wxString& format = wxDefaultDateTimeFormat,
const wxDateTime& dateDef = wxDefaultDateTime)
{
wxString::const_iterator end;
return ParseFormat(date, format, dateDef, &end) ? wxAnyStrPtr(date, end)
: wxAnyStrPtr();
}
wxAnyStrPtr ParseDateTime(const wxString& datetime)
{
wxString::const_iterator end;
return ParseDateTime(datetime, &end) ? wxAnyStrPtr(datetime, end)
: wxAnyStrPtr();
}
wxAnyStrPtr ParseDate(const wxString& date)
{
wxString::const_iterator end;
return ParseDate(date, &end) ? wxAnyStrPtr(date, end)
: wxAnyStrPtr();
}
wxAnyStrPtr ParseTime(const wxString& time)
{
wxString::const_iterator end;
return ParseTime(time, &end) ? wxAnyStrPtr(time, end)
: wxAnyStrPtr();
}
// In addition to wxAnyStrPtr versions above we also must provide the
// overloads for C strings as we must return a pointer into the original
// string and not inside a temporary wxString which would have been created
// if the overloads above were used.
//
// And then we also have to provide the overloads for wxCStrData, as usual.
// Unfortunately those ones can't return anything as we don't have any
// sufficiently long-lived wxAnyStrPtr to return from them: any temporary
// strings it would point to would be destroyed when this function returns
// making it impossible to dereference the return value. So we just don't
// return anything from here which at least allows to keep compatibility
// with the code not testing the return value. Other uses of this method
// need to be converted to use one of the new bool-returning overloads
// above.
void ParseRfc822Date(const wxCStrData& date)
{ ParseRfc822Date(wxString(date)); }
const char* ParseRfc822Date(const char* date);
const wchar_t* ParseRfc822Date(const wchar_t* date);
void ParseFormat(const wxCStrData& date,
const wxString& format = wxDefaultDateTimeFormat,
const wxDateTime& dateDef = wxDefaultDateTime)
{ ParseFormat(wxString(date), format, dateDef); }
const char* ParseFormat(const char* date,
const wxString& format = wxDefaultDateTimeFormat,
const wxDateTime& dateDef = wxDefaultDateTime);
const wchar_t* ParseFormat(const wchar_t* date,
const wxString& format = wxDefaultDateTimeFormat,
const wxDateTime& dateDef = wxDefaultDateTime);
void ParseDateTime(const wxCStrData& datetime)
{ ParseDateTime(wxString(datetime)); }
const char* ParseDateTime(const char* datetime);
const wchar_t* ParseDateTime(const wchar_t* datetime);
void ParseDate(const wxCStrData& date)
{ ParseDate(wxString(date)); }
const char* ParseDate(const char* date);
const wchar_t* ParseDate(const wchar_t* date);
void ParseTime(const wxCStrData& time)
{ ParseTime(wxString(time)); }
const char* ParseTime(const char* time);
const wchar_t* ParseTime(const wchar_t* time);
// implementation
// ------------------------------------------------------------------------
@ -1095,7 +1136,7 @@ public:
inline wxLongLong GetValue() const;
// a helper function to get the current time_t
static time_t GetTimeNow() { return time((time_t *)NULL); }
static time_t GetTimeNow() { return time(NULL); }
// another one to get the current time broken down
static struct tm *GetTmNow()
@ -1252,7 +1293,7 @@ public:
// compare two timestamps: works with the absolute values, i.e. 1
// hour is shorter than -2 hours. Also, it will return false if the
// timespans are equal in absolute value.
bool IsShorterThan(const wxTimeSpan& t) const { return !IsLongerThan(t); }
bool IsShorterThan(const wxTimeSpan& t) const;
inline bool operator<(const wxTimeSpan &ts) const
{
@ -1309,7 +1350,7 @@ public:
// resulting text representation. Notice that only some of format
// specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
// minutes and seconds make sense, but not "PM/AM" string for example.
wxString Format(const wxChar *format = wxDefaultTimeSpanFormat) const;
wxString Format(const wxString& format = wxDefaultTimeSpanFormat) const;
// implementation
// ------------------------------------------------------------------------
@ -1411,6 +1452,8 @@ public:
int GetYears() const { return m_years; }
// get number of months
int GetMonths() const { return m_months; }
// returns 12*GetYears() + GetMonths()
int GetTotalMonths() const { return 12*m_years + m_months; }
// get number of weeks
int GetWeeks() const { return m_weeks; }
// get number of days
@ -1587,7 +1630,9 @@ protected:
inline bool wxDateTime::IsInStdRange() const
{
return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX;
// currently we don't know what is the real type of time_t so prefer to err
// on the safe side and limit it to 32 bit values which is safe everywhere
return m_time >= 0l && (m_time / TIME_T_FACTOR) < wxINT32_MAX;
}
/* static */
@ -1609,9 +1654,16 @@ inline wxDateTime wxDateTime::Today()
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
inline wxDateTime& wxDateTime::Set(time_t timet)
{
// assign first to avoid long multiplication overflow!
m_time = timet - WX_TIME_BASE_OFFSET ;
m_time *= TIME_T_FACTOR;
if ( timet == (time_t)-1 )
{
m_time = wxInvalidDateTime.m_time;
}
else
{
// assign first to avoid long multiplication overflow!
m_time = timet - WX_TIME_BASE_OFFSET;
m_time *= TIME_T_FACTOR;
}
return *this;
}
@ -1947,9 +1999,9 @@ inline wxLongLong wxTimeSpan::GetSeconds() const
inline int wxTimeSpan::GetMinutes() const
{
// explicit cast to int suppresses a warning with CodeWarrior and possibly
// others (changing the return type to long from int is impossible in 2.8)
return (int)((GetSeconds() / 60l).GetLo());
// For compatibility, this method (and the other accessors) return int,
// even though GetLo() actually returns unsigned long with greater range.
return static_cast<int>((GetSeconds() / 60l).GetLo());
}
inline int wxTimeSpan::GetHours() const
@ -2022,6 +2074,11 @@ inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
return GetValue().Abs() > ts.GetValue().Abs();
}
inline bool wxTimeSpan::IsShorterThan(const wxTimeSpan& ts) const
{
return GetValue().Abs() < ts.GetValue().Abs();
}
// ----------------------------------------------------------------------------
// wxDateSpan
// ----------------------------------------------------------------------------

View File

@ -0,0 +1,47 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/timectrl.h
// Purpose: Declaration of wxDateTimePickerCtrl class.
// Author: Vadim Zeitlin
// Created: 2011-09-22
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DATETIME_CTRL_H_
#define _WX_DATETIME_CTRL_H_
#include "wx/defs.h"
#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL
#define wxNEEDS_DATETIMEPICKCTRL
#include "wx/control.h" // the base class
#include "wx/datetime.h"
// ----------------------------------------------------------------------------
// wxDateTimePickerCtrl: Private common base class of wx{Date,Time}PickerCtrl.
// ----------------------------------------------------------------------------
// This class is an implementation detail and should not be used directly, only
// use the documented API of wxDateTimePickerCtrl and wxTimePickerCtrl.
class WXDLLIMPEXP_ADV wxDateTimePickerCtrlBase : public wxControl
{
public:
// Set/get the date or time (in the latter case, time part is ignored).
virtual void SetValue(const wxDateTime& dt) = 0;
virtual wxDateTime GetValue() const = 0;
};
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/datetimectrl.h"
#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
#include "wx/osx/datetimectrl.h"
#else
typedef wxDateTimePickerCtrlBase wxDateTimePickerCtrl;
#endif
#endif // wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL
#endif // _WX_DATETIME_CTRL_H_

View File

@ -1,10 +1,9 @@
/////////////////////////////////////////////////////////////////////////////
// Name: datstrm.h
// Name: wx/datstrm.h
// Purpose: Data stream classes
// Author: Guilhem Lavaux
// Modified by: Mickael Gilabert
// Created: 28/06/1998
// RCS-ID: $Id: datstrm.h 38576 2006-04-05 16:10:08Z VZ $
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -18,15 +17,64 @@
#if wxUSE_STREAMS
class WXDLLIMPEXP_BASE wxDataInputStream
// Common wxDataInputStream and wxDataOutputStream parameters.
class WXDLLIMPEXP_BASE wxDataStreamBase
{
public:
void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
// By default we use extended precision (80 bit) format for both float and
// doubles. Call this function to switch to alternative representation in
// which IEEE 754 single precision (32 bits) is used for floats and double
// precision (64 bits) is used for doubles.
void UseBasicPrecisions()
{
#if wxUSE_APPLE_IEEE
m_useExtendedPrecision = false;
#endif // wxUSE_APPLE_IEEE
}
// UseExtendedPrecision() is not very useful as it corresponds to the
// default value, only call it in your code if you want the compilation
// fail with the error when using wxWidgets library compiled without
// extended precision support.
#if wxUSE_APPLE_IEEE
void UseExtendedPrecision()
{
m_useExtendedPrecision = true;
}
#endif // wxUSE_APPLE_IEEE
#if wxUSE_UNICODE
wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvAuto());
#else
wxDataInputStream(wxInputStream& s);
void SetConv( const wxMBConv &conv );
wxMBConv *GetConv() const { return m_conv; }
#endif
~wxDataInputStream();
protected:
// Ctor and dtor are both protected, this class is never used directly but
// only by its derived classes.
wxDataStreamBase(const wxMBConv& conv);
~wxDataStreamBase();
bool m_be_order;
#if wxUSE_APPLE_IEEE
bool m_useExtendedPrecision;
#endif // wxUSE_APPLE_IEEE
#if wxUSE_UNICODE
wxMBConv *m_conv;
#endif
wxDECLARE_NO_COPY_CLASS(wxDataStreamBase);
};
class WXDLLIMPEXP_BASE wxDataInputStream : public wxDataStreamBase
{
public:
wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvUTF8);
bool IsOk() { return m_input->IsOk(); }
@ -40,6 +88,7 @@ public:
wxUint16 Read16();
wxUint8 Read8();
double ReadDouble();
float ReadFloat();
wxString ReadString();
#if wxHAS_INT64
@ -58,6 +107,7 @@ public:
void Read16(wxUint16 *buffer, size_t size);
void Read8(wxUint8 *buffer, size_t size);
void ReadDouble(double *buffer, size_t size);
void ReadFloat(float *buffer, size_t size);
wxDataInputStream& operator>>(wxString& s);
wxDataInputStream& operator>>(wxInt8& c);
@ -74,30 +124,19 @@ public:
wxDataInputStream& operator>>(wxULongLong& i);
wxDataInputStream& operator>>(wxLongLong& i);
#endif
wxDataInputStream& operator>>(double& i);
wxDataInputStream& operator>>(double& d);
wxDataInputStream& operator>>(float& f);
void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
protected:
wxInputStream *m_input;
bool m_be_order;
#if wxUSE_UNICODE
wxMBConv *m_conv;
#endif
DECLARE_NO_COPY_CLASS(wxDataInputStream)
wxDECLARE_NO_COPY_CLASS(wxDataInputStream);
};
class WXDLLIMPEXP_BASE wxDataOutputStream
class WXDLLIMPEXP_BASE wxDataOutputStream : public wxDataStreamBase
{
public:
#if wxUSE_UNICODE
wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvAuto());
#else
wxDataOutputStream(wxOutputStream& s);
#endif
~wxDataOutputStream();
wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvUTF8);
bool IsOk() { return m_output->IsOk(); }
@ -113,6 +152,7 @@ public:
void Write16(wxUint16 i);
void Write8(wxUint8 i);
void WriteDouble(double d);
void WriteFloat(float f);
void WriteString(const wxString& string);
#if wxHAS_INT64
@ -131,8 +171,8 @@ public:
void Write16(const wxUint16 *buffer, size_t size);
void Write8(const wxUint8 *buffer, size_t size);
void WriteDouble(const double *buffer, size_t size);
void WriteFloat(const float *buffer, size_t size);
wxDataOutputStream& operator<<(const wxChar *string);
wxDataOutputStream& operator<<(const wxString& string);
wxDataOutputStream& operator<<(wxInt8 c);
wxDataOutputStream& operator<<(wxInt16 i);
@ -148,19 +188,13 @@ public:
wxDataOutputStream& operator<<(const wxULongLong &i);
wxDataOutputStream& operator<<(const wxLongLong &i);
#endif
wxDataOutputStream& operator<<(double f);
wxDataOutputStream& operator<<(double d);
wxDataOutputStream& operator<<(float f);
void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
protected:
wxOutputStream *m_output;
bool m_be_order;
#if wxUSE_UNICODE
wxMBConv *m_conv;
#endif
DECLARE_NO_COPY_CLASS(wxDataOutputStream)
wxDECLARE_NO_COPY_CLASS(wxDataOutputStream);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@
// Author: Ron Lee <ron@debian.org>
// Modified by: Vadim Zeitlin (refactored, added bg preservation)
// Created: 16/03/02
// RCS-ID: $Id: dcbuffer.h 61872 2009-09-09 22:37:05Z VZ $
// Copyright: (c) Ron Lee
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -37,7 +36,11 @@
// does not prepare the window DC
#define wxBUFFER_CLIENT_AREA 0x02
class WXDLLEXPORT wxBufferedDC : public wxMemoryDC
// Set when not using specific buffer bitmap. Note that this
// is private style and not returned by GetStyle.
#define wxBUFFER_USES_SHARED_BUFFER 0x04
class WXDLLIMPEXP_CORE wxBufferedDC : public wxMemoryDC
{
public:
// Default ctor, must subsequently call Init for two stage construction.
@ -98,25 +101,11 @@ public:
// Usually called in the dtor or by the dtor of derived classes if the
// BufferedDC must blit before the derived class (which may own the dc it's
// blitting to) is destroyed.
void UnMask()
{
wxCHECK_RET( m_dc, wxT("no underlying wxDC?") );
wxASSERT_MSG( m_buffer && m_buffer->IsOk(), wxT("invalid backing store") );
wxCoord x = 0,
y = 0;
if ( m_style & wxBUFFER_CLIENT_AREA )
GetDeviceOrigin(&x, &y);
m_dc->Blit(0, 0, m_buffer->GetWidth(), m_buffer->GetHeight(),
this, -x, -y );
m_dc = NULL;
}
void UnMask();
// Set and get the style
void SetStyle(int style) { m_style = style; }
int GetStyle() const { return m_style; }
int GetStyle() const { return m_style & ~wxBUFFER_USES_SHARED_BUFFER; }
private:
// common part of Init()s
@ -126,10 +115,6 @@ private:
m_dc = dc;
m_style = style;
// inherit the same layout direction as the original DC
if (dc && dc->IsOk())
SetLayoutDirection(dc->GetLayoutDirection());
}
// check that the bitmap is valid and use it
@ -148,8 +133,10 @@ private:
// the buffering style
int m_style;
wxSize m_area;
DECLARE_DYNAMIC_CLASS(wxBufferedDC)
DECLARE_NO_COPY_CLASS(wxBufferedDC)
wxDECLARE_NO_COPY_CLASS(wxBufferedDC);
};
@ -159,7 +146,7 @@ private:
// Creates a double buffered wxPaintDC, optionally allowing the
// user to specify their own buffer to use.
class WXDLLEXPORT wxBufferedPaintDC : public wxBufferedDC
class WXDLLIMPEXP_CORE wxBufferedPaintDC : public wxBufferedDC
{
public:
// If no bitmap is supplied by the user, a temporary one will be created.
@ -209,7 +196,7 @@ private:
wxPaintDC m_paintdc;
DECLARE_ABSTRACT_CLASS(wxBufferedPaintDC)
DECLARE_NO_COPY_CLASS(wxBufferedPaintDC)
wxDECLARE_NO_COPY_CLASS(wxBufferedPaintDC);
};
@ -226,40 +213,25 @@ private:
#define wxAutoBufferedPaintDCBase wxBufferedPaintDC
#endif
#ifdef __WXDEBUG__
class wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase
class WXDLLIMPEXP_CORE wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase
{
public:
wxAutoBufferedPaintDC(wxWindow* win)
: wxAutoBufferedPaintDCBase(win)
{
TestWinStyle(win);
wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_PAINT,
"You need to call SetBackgroundStyle(wxBG_STYLE_PAINT) in ctor, "
"and also, if needed, paint the background in wxEVT_PAINT handler."
);
}
virtual ~wxAutoBufferedPaintDC() { }
private:
void TestWinStyle(wxWindow* win)
{
// Help the user to get the double-buffering working properly.
wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_CUSTOM,
wxT("In constructor, you need to call SetBackgroundStyle(wxBG_STYLE_CUSTOM), ")
wxT("and also, if needed, paint the background manually in the paint event handler."));
}
DECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC)
wxDECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC);
};
#else // !__WXDEBUG__
// In release builds, just use typedef
typedef wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC;
#endif
// Check if the window is natively double buffered and will return a wxPaintDC

View File

@ -2,41 +2,61 @@
// Name: wx/dcclient.h
// Purpose: wxClientDC base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: dcclient.h 40865 2006-08-27 09:42:42Z VS $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCCLIENT_H_BASE_
#define _WX_DCCLIENT_H_BASE_
#include "wx/defs.h"
#include "wx/dc.h"
#if defined(__WXPALMOS__)
#include "wx/palmos/dcclient.h"
#elif defined(__WXMSW__)
#include "wx/msw/dcclient.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/dcclient.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/dcclient.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/dcclient.h"
#elif defined(__WXX11__)
#include "wx/x11/dcclient.h"
#elif defined(__WXMGL__)
#include "wx/mgl/dcclient.h"
#elif defined(__WXDFB__)
#include "wx/dfb/dcclient.h"
#elif defined(__WXMAC__)
#include "wx/mac/dcclient.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dcclient.h"
#elif defined(__WXPM__)
#include "wx/os2/dcclient.h"
#endif
//-----------------------------------------------------------------------------
// wxWindowDC
//-----------------------------------------------------------------------------
#endif
// _WX_DCCLIENT_H_BASE_
class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
{
public:
wxWindowDC(wxWindow *win);
protected:
wxWindowDC(wxDCImpl *impl) : wxDC(impl) { }
private:
DECLARE_ABSTRACT_CLASS(wxWindowDC)
};
//-----------------------------------------------------------------------------
// wxClientDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
{
public:
wxClientDC(wxWindow *win);
protected:
wxClientDC(wxDCImpl *impl) : wxWindowDC(impl) { }
private:
DECLARE_ABSTRACT_CLASS(wxClientDC)
};
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
{
public:
wxPaintDC(wxWindow *win);
protected:
wxPaintDC(wxDCImpl *impl) : wxClientDC(impl) { }
private:
DECLARE_ABSTRACT_CLASS(wxPaintDC)
};
#endif // _WX_DCCLIENT_H_BASE_

View File

@ -1,11 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/graphdc.h
// Name: wx/dcgraph.h
// Purpose: graphics context device bridge header
// Author: Stefan Csomor
// Modified by:
// Created:
// Copyright: (c) Stefan Csomor
// RCS-ID: $Id: dcgraph.h 53390 2008-04-28 04:19:15Z KO $
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -14,36 +13,59 @@
#if wxUSE_GRAPHICS_CONTEXT
#include "wx/dc.h"
#include "wx/geometry.h"
#include "wx/dynarray.h"
#include "wx/graphics.h"
class WXDLLEXPORT wxWindowDC;
class WXDLLIMPEXP_FWD_CORE wxWindowDC;
#ifdef __WXMAC__
#define wxGCDC wxDC
#endif
class WXDLLEXPORT wxGCDC:
#ifdef __WXMAC__
public wxDCBase
#else
public wxDC
#endif
class WXDLLIMPEXP_CORE wxGCDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxGCDC)
DECLARE_NO_COPY_CLASS(wxGCDC)
public:
wxGCDC(const wxWindowDC& dc);
#ifdef __WXMSW__
wxGCDC( const wxMemoryDC& dc);
#endif
wxGCDC( const wxWindowDC& dc );
wxGCDC( const wxMemoryDC& dc );
#if wxUSE_PRINTING_ARCHITECTURE
wxGCDC( const wxPrinterDC& dc );
#endif
#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
wxGCDC( const wxEnhMetaFileDC& dc );
#endif
wxGCDC(wxGraphicsContext* context);
wxGCDC();
virtual ~wxGCDC();
void Init();
wxGraphicsContext* GetGraphicsContext() const;
void SetGraphicsContext( wxGraphicsContext* ctx );
#ifdef __WXMSW__
// override wxDC virtual functions to provide access to HDC associated with
// this Graphics object (implemented in src/msw/graphics.cpp)
virtual WXHDC AcquireHDC();
virtual void ReleaseHDC(WXHDC hdc);
#endif // __WXMSW__
private:
DECLARE_DYNAMIC_CLASS(wxGCDC)
wxDECLARE_NO_COPY_CLASS(wxGCDC);
};
class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl
{
public:
wxGCDCImpl( wxDC *owner, const wxWindowDC& dc );
wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc );
#if wxUSE_PRINTING_ARCHITECTURE
wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc );
#endif
#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc );
#endif
wxGCDCImpl( wxDC *owner );
virtual ~wxGCDCImpl();
// implement base class pure virtuals
// ----------------------------------
@ -55,10 +77,9 @@ public:
virtual void StartPage();
virtual void EndPage();
// to be virtualized on next major
// flushing the content of this dc immediately onto screen
void Flush();
virtual void Flush();
virtual void SetFont(const wxFont& font);
virtual void SetPen(const wxPen& pen);
@ -77,27 +98,21 @@ public:
virtual int GetDepth() const;
virtual wxSize GetPPI() const;
virtual void SetMapMode(int mode);
virtual void SetUserScale(double x, double y);
virtual void SetLogicalScale(double x, double y);
virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
virtual void SetLogicalFunction(int function);
virtual void SetLogicalFunction(wxRasterOperationMode function);
virtual void SetTextForeground(const wxColour& colour);
virtual void SetTextBackground(const wxColour& colour);
virtual void ComputeScaleAndOrigin();
wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; }
wxGraphicsContext* GetGraphicsContext() const { return m_graphicContext; }
virtual void SetGraphicsContext( wxGraphicsContext* ctx );
protected:
virtual void* GetHandle() const;
// the true implementations
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
int style = wxFLOOD_SURFACE);
wxFloodFillStyle style = wxFLOOD_SURFACE);
virtual void DoGradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
@ -114,7 +129,7 @@ protected:
virtual void DoDrawPoint(wxCoord x, wxCoord y);
#if wxUSE_SPLINES
virtual void DoDrawSpline(wxList *points);
virtual void DoDrawSpline(const wxPointList *points);
#endif
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
@ -146,22 +161,31 @@ protected:
double angle);
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxCoord srcWidth, wxCoord srcHeight,
wxRasterOperationMode = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
virtual void DoGetSize(int *,int *) const;
virtual void DoGetSizeMM(int* width, int* height) const;
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
int fillStyle = wxODDEVEN_RULE);
virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
int fillStyle);
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle);
virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
virtual void DoSetDeviceClippingRegion(const wxRegion& region);
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord width, wxCoord height);
@ -169,22 +193,34 @@ protected:
wxCoord *x, wxCoord *y,
wxCoord *descent = NULL,
wxCoord *externalLeading = NULL,
wxFont *theFont = NULL) const;
const wxFont *theFont = NULL) const;
virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
#ifdef __WXMSW__
virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const;
#endif // __WXMSW__
protected:
// unused int parameter distinguishes this version, which does not create a
// wxGraphicsContext, in the expectation that the derived class will do it
wxGCDCImpl(wxDC* owner, int);
// scaling variables
bool m_logicalFunctionSupported;
double m_mm_to_pix_x, m_mm_to_pix_y;
wxGraphicsMatrix m_matrixOriginal;
wxGraphicsMatrix m_matrixCurrent;
double m_formerScaleX, m_formerScaleY;
wxGraphicsContext* m_graphicContext;
private:
void Init(wxGraphicsContext*);
DECLARE_CLASS(wxGCDCImpl)
wxDECLARE_NO_COPY_CLASS(wxGCDCImpl);
};
#endif
#endif // wxUSE_GRAPHICS_CONTEXT
#endif // _WX_GRAPHICS_DC_H_

View File

@ -5,72 +5,40 @@
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: dcmemory.h 43843 2006-12-07 05:44:44Z PC $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCMEMORY_H_BASE_
#define _WX_DCMEMORY_H_BASE_
#include "wx/dc.h"
#include "wx/bitmap.h"
// NOTE: different native implementations of wxMemoryDC will derive from
// different wxDC classes (wxPaintDC, wxWindowDC, etc), so that
// we cannot derive wxMemoryDCBase from wxDC and then use it as the
// only base class for native impl of wxMemoryDC...
class WXDLLEXPORT wxMemoryDCBase
//-----------------------------------------------------------------------------
// wxMemoryDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC
{
public:
wxMemoryDCBase() { }
// avoid warnings about having virtual functions but non virtual dtor
virtual ~wxMemoryDCBase() { }
wxMemoryDC();
wxMemoryDC( wxBitmap& bitmap );
wxMemoryDC( wxDC *dc );
// select the given bitmap to draw on it
void SelectObject(wxBitmap& bmp)
{
// make sure that the given wxBitmap is not sharing its data with other
// wxBitmap instances as its contents will be modified by any drawing
// operation done on this DC
if (bmp.IsOk())
bmp.UnShare();
DoSelect(bmp);
}
void SelectObject(wxBitmap& bmp);
// select the given bitmap for read-only
virtual void SelectObjectAsSource(const wxBitmap& bmp)
{
DoSelect(bmp);
}
void SelectObjectAsSource(const wxBitmap& bmp);
protected:
virtual void DoSelect(const wxBitmap& bmp) = 0;
// get selected bitmap
const wxBitmap& GetSelectedBitmap() const;
wxBitmap& GetSelectedBitmap();
private:
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
};
#if defined(__WXPALMOS__)
#include "wx/palmos/dcmemory.h"
#elif defined(__WXMSW__)
#include "wx/msw/dcmemory.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/dcmemory.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/dcmemory.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/dcmemory.h"
#elif defined(__WXX11__)
#include "wx/x11/dcmemory.h"
#elif defined(__WXMGL__)
#include "wx/mgl/dcmemory.h"
#elif defined(__WXDFB__)
#include "wx/dfb/dcmemory.h"
#elif defined(__WXMAC__)
#include "wx/mac/dcmemory.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dcmemory.h"
#elif defined(__WXPM__)
#include "wx/os2/dcmemory.h"
#endif
#endif
// _WX_DCMEMORY_H_BASE_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 21.07.2003
// RCS-ID: $Id: dcmirror.h 61872 2009-09-09 22:37:05Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -18,7 +17,7 @@
// wxMirrorDC allows to write the same code for horz/vertical layout
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMirrorDC : public wxDC
class WXDLLIMPEXP_CORE wxMirrorDCImpl : public wxDCImpl
{
public:
// constructs a mirror DC associated with the given real DC
@ -26,13 +25,12 @@ public:
// if mirror parameter is true, all vertical and horizontal coordinates are
// exchanged, otherwise this class behaves in exactly the same way as a
// plain DC
//
// the cast to wxMirrorDC is a dirty hack done to allow us to call the
// protected methods of wxDCBase directly in our code below, without it it
// would be impossible (this is correct from C++ point of view but doesn't
// make any sense in this particular situation)
wxMirrorDC(wxDC& dc, bool mirror) : m_dc((wxMirrorDC&)dc)
{ m_mirror = mirror; }
wxMirrorDCImpl(wxDC *owner, wxDCImpl& dc, bool mirror)
: wxDCImpl(owner),
m_dc(dc)
{
m_mirror = mirror;
}
// wxDCBase operations
virtual void Clear() { m_dc.Clear(); }
@ -53,9 +51,8 @@ public:
virtual bool CanGetTextExtent() const { return m_dc.CanGetTextExtent(); }
virtual int GetDepth() const { return m_dc.GetDepth(); }
virtual wxSize GetPPI() const { return m_dc.GetPPI(); }
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const { return m_dc.Ok(); }
virtual void SetMapMode(int mode) { m_dc.SetMapMode(mode); }
virtual bool IsOk() const { return m_dc.IsOk(); }
virtual void SetMapMode(wxMappingMode mode) { m_dc.SetMapMode(mode); }
virtual void SetUserScale(double x, double y)
{ m_dc.SetUserScale(GetX(x, y), GetY(x, y)); }
virtual void SetLogicalOrigin(wxCoord x, wxCoord y)
@ -65,14 +62,11 @@ public:
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp)
{ m_dc.SetAxisOrientation(GetX(xLeftRight, yBottomUp),
GetY(xLeftRight, yBottomUp)); }
virtual void SetLogicalFunction(int function)
virtual void SetLogicalFunction(wxRasterOperationMode function)
{ m_dc.SetLogicalFunction(function); }
// helper functions which may be useful for the users of this class
wxSize Reflect(const wxSize& sizeOrig)
{
return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig;
}
virtual void* GetHandle() const
{ return m_dc.GetHandle(); }
protected:
// returns x and y if not mirroring or y and x if mirroring
@ -87,30 +81,26 @@ protected:
wxCoord *GetX(wxCoord *x, wxCoord *y) const { return m_mirror ? y : x; }
wxCoord *GetY(wxCoord *x, wxCoord *y) const { return m_mirror ? x : y; }
// exchange x and y unconditionally
static void Swap(wxCoord& x, wxCoord& y)
{
wxCoord t = x;
x = y;
y = t;
}
// exchange x and y components of all points in the array if necessary
void Mirror(int n, wxPoint points[]) const
wxPoint* Mirror(int n, const wxPoint*& points) const
{
wxPoint* points_alloc = NULL;
if ( m_mirror )
{
points_alloc = new wxPoint[n];
for ( int i = 0; i < n; i++ )
{
Swap(points[i].x, points[i].y);
points_alloc[i].x = points[i].y;
points_alloc[i].y = points[i].x;
}
points = points_alloc;
}
return points_alloc;
}
// wxDCBase functions
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
int style = wxFLOOD_SURFACE)
wxFloodFillStyle style = wxFLOOD_SURFACE)
{
return m_dc.DoFloodFill(GetX(x, y), GetY(x, y), col, style);
}
@ -210,7 +200,8 @@ protected:
virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord w, wxCoord h,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = false,
wxRasterOperationMode rop = wxCOPY,
bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
{
return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest),
@ -230,31 +221,31 @@ protected:
m_dc.DoGetSizeMM(GetX(w, h), GetY(w, h));
}
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset)
{
Mirror(n, points);
wxPoint* points_alloc = Mirror(n, points);
m_dc.DoDrawLines(n, points,
GetX(xoffset, yoffset), GetY(xoffset, yoffset));
Mirror(n, points);
delete[] points_alloc;
}
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
int fillStyle = wxODDEVEN_RULE)
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{
Mirror(n, points);
wxPoint* points_alloc = Mirror(n, points);
m_dc.DoDrawPolygon(n, points,
GetX(xoffset, yoffset), GetY(xoffset, yoffset),
fillStyle);
Mirror(n, points);
delete[] points_alloc;
}
virtual void DoSetClippingRegionAsRegion(const wxRegion& WXUNUSED(region))
virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region))
{
wxFAIL_MSG( wxT("not implemented") );
}
@ -269,18 +260,39 @@ protected:
wxCoord *x, wxCoord *y,
wxCoord *descent = NULL,
wxCoord *externalLeading = NULL,
wxFont *theFont = NULL) const
const wxFont *theFont = NULL) const
{
// never mirrored
m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont);
}
private:
wxMirrorDC& m_dc;
wxDCImpl& m_dc;
bool m_mirror;
DECLARE_NO_COPY_CLASS(wxMirrorDC)
wxDECLARE_NO_COPY_CLASS(wxMirrorDCImpl);
};
class WXDLLIMPEXP_CORE wxMirrorDC : public wxDC
{
public:
wxMirrorDC(wxDC& dc, bool mirror)
: wxDC(new wxMirrorDCImpl(this, *dc.GetImpl(), mirror))
{
m_mirror = mirror;
}
// helper functions which may be useful for the users of this class
wxSize Reflect(const wxSize& sizeOrig)
{
return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig;
}
private:
bool m_mirror;
wxDECLARE_NO_COPY_CLASS(wxMirrorDC);
};
#endif // _WX_DCMIRROR_H_

View File

@ -5,7 +5,6 @@
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: dcprint.h 41240 2006-09-15 16:45:48Z PC $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -16,18 +15,28 @@
#if wxUSE_PRINTING_ARCHITECTURE
#if defined(__WXPALMOS__)
#include "wx/palmos/dcprint.h"
#elif defined(__WXMSW__)
#include "wx/msw/dcprint.h"
#endif
#if defined(__WXPM__)
#include "wx/os2/dcprint.h"
#endif
#if defined(__WXMAC__)
#include "wx/mac/dcprint.h"
#endif
#include "wx/dc.h"
//-----------------------------------------------------------------------------
// wxPrinterDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPrinterDC : public wxDC
{
public:
wxPrinterDC();
wxPrinterDC(const wxPrintData& data);
wxRect GetPaperRect() const;
int GetResolution() const;
protected:
wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { }
private:
DECLARE_DYNAMIC_CLASS(wxPrinterDC)
};
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif
// _WX_DCPRINT_H_BASE_
#endif // _WX_DCPRINT_H_BASE_

View File

@ -0,0 +1,17 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/dcps.h
// Purpose: wxPostScriptDC base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCPS_H_BASE_
#define _WX_DCPS_H_BASE_
#include "wx/generic/dcpsg.h"
#endif

View File

@ -5,7 +5,6 @@
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: dcscreen.h 40865 2006-08-27 09:42:42Z VS $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -13,30 +12,24 @@
#define _WX_DCSCREEN_H_BASE_
#include "wx/defs.h"
#include "wx/dc.h"
class WXDLLIMPEXP_CORE wxScreenDC : public wxDC
{
public:
wxScreenDC();
static bool StartDrawingOnTop(wxWindow * WXUNUSED(window))
{ return true; }
static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = NULL)
{ return true; }
static bool EndDrawingOnTop()
{ return true; }
private:
DECLARE_DYNAMIC_CLASS(wxScreenDC)
};
#if defined(__WXPALMOS__)
#include "wx/palmos/dcscreen.h"
#elif defined(__WXMSW__)
#include "wx/msw/dcscreen.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/dcscreen.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/dcscreen.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/dcscreen.h"
#elif defined(__WXX11__)
#include "wx/x11/dcscreen.h"
#elif defined(__WXMGL__)
#include "wx/mgl/dcscreen.h"
#elif defined(__WXDFB__)
#include "wx/dfb/dcscreen.h"
#elif defined(__WXMAC__)
#include "wx/mac/dcscreen.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dcscreen.h"
#elif defined(__WXPM__)
#include "wx/os2/dcscreen.h"
#endif
#endif
// _WX_DCSCREEN_H_BASE_

View File

@ -0,0 +1,227 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/dcsvg.h
// Purpose: wxSVGFileDC
// Author: Chris Elliott
// Modified by:
// Created:
// Copyright: (c) Chris Elliott
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCSVG_H_
#define _WX_DCSVG_H_
#include "wx/string.h"
#include "wx/dc.h"
#if wxUSE_SVG
#define wxSVGVersion wxT("v0100")
#ifdef __BORLANDC__
#pragma warn -8008
#pragma warn -8066
#endif
class WXDLLIMPEXP_FWD_BASE wxFileOutputStream;
class WXDLLIMPEXP_FWD_CORE wxSVGFileDC;
class WXDLLIMPEXP_CORE wxSVGFileDCImpl : public wxDCImpl
{
public:
wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename,
int width=320, int height=240, double dpi=72.0 );
virtual ~wxSVGFileDCImpl();
bool IsOk() const { return m_OK; }
virtual bool CanDrawBitmap() const { return true; }
virtual bool CanGetTextExtent() const { return true; }
virtual int GetDepth() const
{
wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented"));
return -1;
}
virtual void Clear()
{
wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?"));
}
virtual void DestroyClippingRegion();
virtual wxCoord GetCharHeight() const;
virtual wxCoord GetCharWidth() const;
virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
wxCoord WXUNUSED(w), wxCoord WXUNUSED(h))
{
wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
}
virtual void SetPalette(const wxPalette& WXUNUSED(palette))
{
wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
}
virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y),
wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h))
{
wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
}
virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function))
{
wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented"));
}
virtual wxRasterOperationMode GetLogicalFunction() const
{
wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented"));
return wxCOPY;
}
virtual void SetBackground( const wxBrush &brush );
virtual void SetBackgroundMode( int mode );
virtual void SetBrush(const wxBrush& brush);
virtual void SetFont(const wxFont& font);
virtual void SetPen(const wxPen& pen);
virtual void* GetHandle() const { return NULL; }
private:
virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const
{
wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented"));
return true;
}
virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, wxDC *,
wxCoord, wxCoord, wxRasterOperationMode = wxCOPY,
bool = 0, int = -1, int = -1);
virtual void DoCrossHair(wxCoord, wxCoord)
{
wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented"));
}
virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = false);
virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea);
virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord);
virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0);
virtual void DoDrawPoint(wxCoord, wxCoord);
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle);
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
double angle);
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord w, wxCoord h,
double radius = 20) ;
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
virtual bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
const wxColour& WXUNUSED(col),
wxFloodFillStyle WXUNUSED(style) = wxFLOOD_SURFACE)
{
wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented"));
return false;
}
virtual void DoGetSize(int * x, int *y) const
{
if ( x )
*x = m_width;
if ( y )
*y = m_height;
}
virtual void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h,
wxCoord *descent = NULL,
wxCoord *externalLeading = NULL,
const wxFont *font = NULL) const;
virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region))
{
wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetDeviceClippingRegion not yet implemented"));
}
virtual void DoSetClippingRegion(int x, int y, int width, int height);
virtual void DoGetSizeMM( int *width, int *height ) const;
virtual wxSize GetPPI() const;
void Init (const wxString &filename, int width, int height, double dpi);
void write( const wxString &s );
private:
// If m_graphics_changed is true, close the current <g> element and start a
// new one for the last pen/brush change.
void NewGraphicsIfNeeded();
// Open a new graphics group setting up all the attributes according to
// their current values in wxDC.
void DoStartNewGraphics();
wxFileOutputStream *m_outfile;
wxString m_filename;
int m_sub_images; // number of png format images we have
bool m_OK;
bool m_graphics_changed; // set by Set{Brush,Pen}()
int m_width, m_height;
double m_dpi;
// The clipping nesting level is incremented by every call to
// SetClippingRegion() and reset when DestroyClippingRegion() is called.
size_t m_clipNestingLevel;
// Unique ID for every clipping graphics group: this is simply always
// incremented in each SetClippingRegion() call.
size_t m_clipUniqueId;
DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl)
};
class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
{
public:
wxSVGFileDC(const wxString& filename,
int width = 320,
int height = 240,
double dpi = 72.0)
: wxDC(new wxSVGFileDCImpl(this, filename, width, height, dpi))
{
}
};
#endif // wxUSE_SVG
#endif // _WX_DCSVG_H_

View File

@ -5,7 +5,6 @@
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -22,10 +21,10 @@ WX_DECLARE_USER_EXPORTED_LIST(wxDDEClient, wxDDEClientList, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_LIST(wxDDEServer, wxDDEServerList, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_BASE);
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
#include "wx/msw/dde.h"
#else
#error DDE is only supported on MSW
#error DDE is only supported under Windows
#endif
#endif

View File

@ -1,247 +1,388 @@
/**
* Name: wx/debug.h
* Purpose: Misc debug functions and macros
* Author: Vadim Zeitlin
* Modified by: Ryan Norton (Converted to C)
* Created: 29/01/98
* RCS-ID: $Id: debug.h 61872 2009-09-09 22:37:05Z VZ $
* Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
* Licence: wxWindows licence
*/
/////////////////////////////////////////////////////////////////////////////
// Name: wx/debug.h
// Purpose: Misc debug functions and macros
// Author: Vadim Zeitlin
// Created: 29/01/98
// Copyright: (c) 1998-2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_DEBUG_H_
#define _WX_DEBUG_H_
#ifndef _WX_DEBUG_H_
#define _WX_DEBUG_H_
#if !defined(__WXWINCE__)
#include <assert.h>
#endif // systems without assert.h
#ifndef __WXWINCE__
#include <assert.h>
#endif
#include <limits.h> /* for CHAR_BIT used below */
#include <limits.h> // for CHAR_BIT used below
#include "wx/wxchar.h" /* for __TFILE__ and wxChar */
#include "wx/chartype.h" // for __TFILE__ and wxChar
#include "wx/cpp.h" // for __WXFUNCTION__
#include "wx/dlimpexp.h" // for WXDLLIMPEXP_FWD_BASE
/* ---------------------------------------------------------------------------- */
/* Defines controlling the debugging macros */
/* ---------------------------------------------------------------------------- */
class WXDLLIMPEXP_FWD_BASE wxString;
class WXDLLIMPEXP_FWD_BASE wxCStrData;
/* if _DEBUG is defined (MS VC++ and others use it in debug builds), define */
/* __WXDEBUG__ too */
#ifdef _DEBUG
// ----------------------------------------------------------------------------
// Defines controlling the debugging macros
// ----------------------------------------------------------------------------
/*
wxWidgets can be built with several different levels of debug support
specified by the value of wxDEBUG_LEVEL constant:
0: No assertion macros at all, this should only be used when optimizing
for resource-constrained systems (typically embedded ones).
1: Default level, most of the assertions are enabled.
2: Maximal (at least for now): asserts which are "expensive"
(performance-wise) or only make sense for finding errors in wxWidgets
itself, as opposed to bugs in applications using it, are also enabled.
*/
// unless wxDEBUG_LEVEL is predefined (by configure or via wx/setup.h under
// Windows), use the default
#if !defined(wxDEBUG_LEVEL)
#define wxDEBUG_LEVEL 1
#endif // !defined(wxDEBUG_LEVEL)
/*
__WXDEBUG__ is defined when wxDEBUG_LEVEL != 0. This is done mostly for
compatibility but it also provides a simpler way to check if asserts and
debug logging is enabled at all.
*/
#if wxDEBUG_LEVEL > 0
#ifndef __WXDEBUG__
#define __WXDEBUG__
#endif /* !__WXDEBUG__ */
#endif /* _DEBUG */
/* if NDEBUG is defined (<assert.h> uses it), undef __WXDEBUG__ and WXDEBUG */
#ifdef NDEBUG
#endif
#else
#undef __WXDEBUG__
#undef WXDEBUG
#endif /* NDEBUG */
#endif
/* if __WXDEBUG__ is defined, make sure that WXDEBUG is defined and >= 1 */
// Finally there is also a very old WXDEBUG macro not used anywhere at all, it
// is only defined for compatibility.
#ifdef __WXDEBUG__
#if !defined(WXDEBUG) || !WXDEBUG
#undef WXDEBUG
#define WXDEBUG 1
#endif /* !WXDEBUG */
#endif /* __WXDEBUG__ */
#endif // !WXDEBUG
#endif // __WXDEBUG__
#ifndef __WXFUNCTION__
/* TODO: add more compilers supporting __FUNCTION__ */
#if defined(__DMC__)
/*
__FUNCTION__ happens to be not defined within class members
http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485
*/
#define __WXFUNCTION__ (NULL)
#elif defined(__GNUC__) || \
(defined(_MSC_VER) && _MSC_VER >= 1300) || \
defined(__FUNCTION__)
#define __WXFUNCTION__ __FUNCTION__
#else
/* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */
#define __WXFUNCTION__ (NULL)
#endif
#endif /* __WXFUNCTION__ already defined */
/* ---------------------------------------------------------------------------- */
/* Debugging macros */
/* */
/* All debugging macros rely on ASSERT() which in turn calls the user-defined */
/* OnAssert() function. To keep things simple, it's called even when the */
/* expression is true (i.e. everything is ok) and by default does nothing: just */
/* returns the same value back. But if you redefine it to do something more sexy */
/* (popping up a message box in your favourite GUI, sending you e-mail or */
/* whatever) it will affect all ASSERTs, FAILs and CHECKs in your code. */
/* */
/* Warning: if you don't like advice on programming style, don't read */
/* further! ;-) */
/* */
/* Extensive use of these macros is recommended! Remember that ASSERTs are */
/* disabled in final build (without __WXDEBUG__ defined), so they add strictly */
/* nothing to your program's code. On the other hand, CHECK macros do stay */
/* even in release builds, but in general are not much of a burden, while */
/* a judicious use of them might increase your program's stability. */
/* ---------------------------------------------------------------------------- */
/* Macros which are completely disabled in 'release' mode */
/* */
/* NB: these functions are implemented in src/common/appcmn.cpp */
#if defined(__cplusplus) && defined(__WXDEBUG__)
/*
This function is called whenever one of debugging macros fails (i.e.
condition is false in an assertion). To customize its behaviour, override
wxApp::OnAssert().
Parameters:
szFile and nLine - file name and line number of the ASSERT
szFunc - function name of the ASSERT, may be NULL (NB: ASCII)
szCond - text form of the condition which failed
szMsg - optional message explaining the reason
*/
extern void WXDLLIMPEXP_BASE wxOnAssert(const wxChar *szFile,
int nLine,
const char *szFunc,
const wxChar *szCond,
const wxChar *szMsg = NULL);
/* call this function to break into the debugger unconditionally (assuming */
/* the program is running under debugger, of course) */
extern void WXDLLIMPEXP_BASE wxTrap();
/* generic assert macro */
#define wxASSERT(cond) wxASSERT_MSG(cond, NULL)
/* assert with additional message explaining its cause */
/* compilers can give a warning (such as "possible unwanted ;") when using */
/* the default definition of wxASSERT_MSG so we provide an alternative */
#if defined(__MWERKS__)
#define wxASSERT_MSG(cond, msg) \
if ( cond ) \
{} \
else \
wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(#cond), msg)
#else
#define wxASSERT_MSG(cond, msg) \
if ( cond ) \
; \
else \
wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(#cond), msg)
#endif
/* special form of assert: always triggers it (in debug mode) */
#define wxFAIL wxFAIL_MSG(NULL)
/* FAIL with some message */
#define wxFAIL_MSG(msg) wxFAIL_COND_MSG("wxAssertFailure", msg)
/* FAIL with some message and a condition */
#define wxFAIL_COND_MSG(cond, msg) \
wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(cond), msg)
/* An assert helper used to avoid warning when testing constant expressions, */
/* i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about */
/* expression being always true, but not using */
/* wxASSERT( wxAssertIsEqual(sizeof(int), 4) ) */
/* */
/* NB: this is made obsolete by wxCOMPILE_TIME_ASSERT() and should no */
/* longer be used. */
extern bool WXDLLIMPEXP_BASE wxAssertIsEqual(int x, int y);
#else
#define wxTrap()
/* nothing to do in release mode (hopefully at this moment there are */
/* no more bugs ;-) */
#define wxASSERT(cond)
#define wxASSERT_MSG(cond, msg)
#define wxFAIL
#define wxFAIL_MSG(msg)
#define wxFAIL_COND_MSG(cond, msg)
#endif /* __WXDEBUG__ */
#ifdef __cplusplus
/* Use of wxFalse instead of false suppresses compiler warnings about testing */
/* constant expression */
extern WXDLLIMPEXP_DATA_BASE(const bool) wxFalse;
#endif
#define wxAssertFailure wxFalse
/* NB: the following macros also work in release mode! */
// ----------------------------------------------------------------------------
// Handling assertion failures
// ----------------------------------------------------------------------------
/*
These macros must be used only in invalid situation: for example, an
invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of
dereferencing it and causing core dump the function might try using
CHECK( p != NULL ) or CHECK( p != NULL, return LogError("p is NULL!!") )
Type for the function called in case of assert failure, see
wxSetAssertHandler().
*/
typedef void (*wxAssertHandler_t)(const wxString& file,
int line,
const wxString& func,
const wxString& cond,
const wxString& msg);
#if wxDEBUG_LEVEL
// the global assert handler function, if it is NULL asserts don't check their
// conditions
extern WXDLLIMPEXP_DATA_BASE(wxAssertHandler_t) wxTheAssertHandler;
/*
Sets the function to be called in case of assertion failure.
The default assert handler forwards to wxApp::OnAssertFailure() whose
default behaviour is, in turn, to show the standard assertion failure
dialog if a wxApp object exists or shows the same dialog itself directly
otherwise.
While usually it is enough -- and more convenient -- to just override
OnAssertFailure(), to handle all assertion failures, including those
occurring even before wxApp object creation or after its destruction you
need to provide your assertion handler function.
This function also provides a simple way to disable all asserts: simply
pass NULL pointer to it. Doing this will result in not even evaluating
assert conditions at all, avoiding almost all run-time cost of asserts.
Notice that this function is not MT-safe, so you should call it before
starting any other threads.
The return value of this function is the previous assertion handler. It can
be called after any pre-processing by your handler and can also be restored
later if you uninstall your handler.
*/
inline wxAssertHandler_t wxSetAssertHandler(wxAssertHandler_t handler)
{
const wxAssertHandler_t old = wxTheAssertHandler;
wxTheAssertHandler = handler;
return old;
}
/*
Reset the default assert handler.
This may be used to enable asserts, which are disabled by default in this
case, for programs built in release build (NDEBUG defined).
*/
extern void WXDLLIMPEXP_BASE wxSetDefaultAssertHandler();
#else // !wxDEBUG_LEVEL
// provide empty stubs in case assertions are completely disabled
//
// NB: can't use WXUNUSED() here as we're included from wx/defs.h before it is
// defined
inline wxAssertHandler_t wxSetAssertHandler(wxAssertHandler_t /* handler */)
{
return NULL;
}
inline void wxSetDefaultAssertHandler() { }
#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
// simply a synonym for wxSetAssertHandler(NULL)
inline void wxDisableAsserts() { wxSetAssertHandler(NULL); }
/*
A macro which disables asserts for applications compiled in release build.
By default, wxIMPLEMENT_APP (or rather wxIMPLEMENT_WXWIN_MAIN) disable the
asserts in the applications compiled in the release build by calling this.
It does nothing if NDEBUG is not defined.
*/
#ifdef NDEBUG
#define wxDISABLE_ASSERTS_IN_RELEASE_BUILD() wxDisableAsserts()
#else
#define wxDISABLE_ASSERTS_IN_RELEASE_BUILD()
#endif
#if wxDEBUG_LEVEL
/*
wxOnAssert() is used by the debugging macros defined below. Different
overloads are needed because these macros can be used with or without wxT().
All of them are implemented in src/common/appcmn.cpp and unconditionally
call wxTheAssertHandler so the caller must check that it is non-NULL
(assert macros do it).
*/
#if wxUSE_UNICODE
// these overloads are the ones typically used by debugging macros: we have to
// provide wxChar* msg version because it's common to use wxT() in the macros
// and finally, we can't use const wx(char)* msg = NULL, because that would
// be ambiguous
//
// also notice that these functions can't be inline as wxString is not defined
// yet (and can't be as wxString code itself may use assertions)
extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
int line,
const char *func,
const char *cond);
extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
int line,
const char *func,
const char *cond,
const char *msg);
extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
int line,
const char *func,
const char *cond,
const wxChar *msg) ;
#endif /* wxUSE_UNICODE */
// this version is for compatibility with wx 2.8 Unicode build only, we don't
// use it ourselves any more except in ANSI-only build in which case it is all
// we need
extern WXDLLIMPEXP_BASE void wxOnAssert(const wxChar *file,
int line,
const char *func,
const wxChar *cond,
const wxChar *msg = NULL);
// these overloads work when msg passed to debug macro is a string and we
// also have to provide wxCStrData overload to resolve ambiguity which would
// otherwise arise from wxASSERT( s.c_str() )
extern WXDLLIMPEXP_BASE void wxOnAssert(const wxString& file,
int line,
const wxString& func,
const wxString& cond,
const wxString& msg);
extern WXDLLIMPEXP_BASE void wxOnAssert(const wxString& file,
int line,
const wxString& func,
const wxString& cond);
extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
int line,
const char *func,
const char *cond,
const wxCStrData& msg);
extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
int line,
const char *func,
const char *cond,
const wxString& msg);
#endif // wxDEBUG_LEVEL
// ----------------------------------------------------------------------------
// Debugging macros
// ----------------------------------------------------------------------------
/*
Assertion macros: check if the condition is true and call assert handler
(which will by default notify the user about failure) if it isn't.
wxASSERT and wxFAIL macros as well as wxTrap() function do nothing at all
if wxDEBUG_LEVEL is 0 however they do check their conditions at default
debug level 1, unlike the previous wxWidgets versions.
wxASSERT_LEVEL_2 is meant to be used for "expensive" asserts which should
normally be disabled because they have a big impact on performance and so
this macro only does anything if wxDEBUG_LEVEL >= 2.
*/
#if wxDEBUG_LEVEL
// wxTrap() can be used to break into the debugger unconditionally
// (assuming the program is running under debugger, of course).
//
// If possible, we prefer to define it as a macro rather than as a function
// to open the debugger at the position where we trapped and not inside the
// trap function itself which is not very useful.
#if wxCHECK_VISUALC_VERSION(7)
#define wxTrap() __debugbreak()
#else
extern WXDLLIMPEXP_BASE void wxTrap();
#endif // Win VisualC
// Global flag used to indicate that assert macros should call wxTrap(): it
// is set by the default assert handler if the user answers yes to the
// question of whether to trap.
extern WXDLLIMPEXP_DATA_BASE(bool) wxTrapInAssert;
// This macro checks if the condition is true and calls the assert handler
// with the provided message if it isn't and finally traps if the special
// flag indicating that it should do it was set by the handler.
//
// Notice that we don't use the handler return value for compatibility
// reasons (if we changed its return type, we'd need to change wxApp::
// OnAssertFailure() too which would break user code overriding it), hence
// the need for the ugly global flag.
#define wxASSERT_MSG(cond, msg) \
wxSTATEMENT_MACRO_BEGIN \
if ( wxTheAssertHandler && !(cond) && \
(wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, \
#cond, msg), wxTrapInAssert) ) \
{ \
wxTrapInAssert = false; \
wxTrap(); \
} \
wxSTATEMENT_MACRO_END
// a version without any additional message, don't use unless condition
// itself is fully self-explanatory
#define wxASSERT(cond) wxASSERT_MSG(cond, (const char*)NULL)
// wxFAIL is a special form of assert: it always triggers (and so is
// usually used in normally unreachable code)
#define wxFAIL_COND_MSG(cond, msg) \
wxSTATEMENT_MACRO_BEGIN \
if ( wxTheAssertHandler && \
(wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, \
cond, msg), wxTrapInAssert) ) \
{ \
wxTrapInAssert = false; \
wxTrap(); \
} \
wxSTATEMENT_MACRO_END
#define wxFAIL_MSG(msg) wxFAIL_COND_MSG("Assert failure", msg)
#define wxFAIL wxFAIL_MSG((const char*)NULL)
#else // !wxDEBUG_LEVEL
#define wxTrap()
#define wxASSERT(cond)
#define wxASSERT_MSG(cond, msg)
#define wxFAIL
#define wxFAIL_MSG(msg)
#define wxFAIL_COND_MSG(cond, msg)
#endif // wxDEBUG_LEVEL
#if wxDEBUG_LEVEL >= 2
#define wxASSERT_LEVEL_2_MSG(cond, msg) wxASSERT_MSG(cond, msg)
#define wxASSERT_LEVEL_2(cond) wxASSERT(cond)
#else // wxDEBUG_LEVEL < 2
#define wxASSERT_LEVEL_2_MSG(cond, msg)
#define wxASSERT_LEVEL_2(cond)
#endif
// This is simply a wrapper for the standard abort() which is not available
// under all platforms.
//
// It isn't really debug-related but there doesn't seem to be any better place
// for it, so declare it here and define it in appbase.cpp, together with
// wxTrap().
extern void WXDLLIMPEXP_BASE wxAbort();
/*
wxCHECK macros always check their conditions, setting debug level to 0 only
makes them silent in case of failure, otherwise -- including at default
debug level 1 -- they call the assert handler if the condition is false
They are supposed to be used only in invalid situation: for example, an
invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of
dereferencing it and causing core dump the function might use
wxCHECK_RET( p != NULL, "pointer can't be NULL" )
*/
/* check that expression is true, "return" if not (also FAILs in debug mode) */
#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, NULL)
// the generic macro: takes the condition to check, the statement to be executed
// in case the condition is false and the message to pass to the assert handler
#define wxCHECK2_MSG(cond, op, msg) \
if ( cond ) \
{} \
else \
{ \
wxFAIL_COND_MSG(#cond, msg); \
op; \
} \
struct wxDummyCheckStruct /* just to force a semicolon */
/* as wxCHECK but with a message explaining why we fail */
// check which returns with the specified return code if the condition fails
#define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg)
/* check that expression is true, perform op if not */
#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, NULL)
// check that expression is true, "return" if not (also FAILs in debug mode)
#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, (const char*)NULL)
/* as wxCHECK2 but with a message explaining why we fail */
// check that expression is true, perform op if not
#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, (const char*)NULL)
#ifdef __GNUC__
#define wxFORCE_SEMICOLON typedef int wxDummyCheckInt
/* Note: old gcc versions (e.g. 2.8) give an internal compiler error */
/* on a simple forward declaration, when used in a template */
/* function, so rather use a dummy typedef which does work... */
#else
#define wxFORCE_SEMICOLON struct wxDummyCheckStruct
/* Note2: however, some other compilers (notably Digital Mars */
/* don't like multiple typedefs (even though the standard */
/* does allow them), so use a forward declaration for non-gcc. */
#endif
/* see comment near the definition of wxASSERT_MSG for the # if/else reason */
#if defined(__MWERKS__)
#define wxCHECK2_MSG(cond, op, msg) \
if ( cond ) \
{} \
else \
{ \
wxFAIL_COND_MSG(#cond, msg); \
op; \
} \
struct wxDummyCheckStruct /* just to force a semicolon */
#else
#define wxCHECK2_MSG(cond, op, msg) \
if ( cond ) \
; \
else \
{ \
wxFAIL_COND_MSG(#cond, msg); \
op; \
} \
wxFORCE_SEMICOLON /* just to force a semicolon */
#endif
/* special form of wxCHECK2: as wxCHECK, but for use in void functions */
/* */
/* NB: there is only one form (with msg parameter) and it's intentional: */
/* there is no other way to tell the caller what exactly went wrong */
/* from the void function (of course, the function shouldn't be void */
/* to begin with...) */
// special form of wxCHECK2: as wxCHECK, but for use in void functions
//
// NB: there is only one form (with msg parameter) and it's intentional:
// there is no other way to tell the caller what exactly went wrong
// from the void function (of course, the function shouldn't be void
// to begin with...)
#define wxCHECK_RET(cond, msg) wxCHECK2_MSG(cond, return, msg)
/* ---------------------------------------------------------------------------- */
/* Compile time asserts */
/* */
/* Unlike the normal assert and related macros above which are checked during */
/* the program tun-time the macros below will result in a compilation error if */
/* the condition they check is false. This is usually used to check the */
/* expressions containing sizeof()s which cannot be tested with the */
/* preprocessor. If you can use the #if's, do use them as you can give a more */
/* detailed error message then. */
/* ---------------------------------------------------------------------------- */
// ----------------------------------------------------------------------------
// Compile time asserts
//
// Unlike the normal assert and related macros above which are checked during
// the program run-time the macros below will result in a compilation error if
// the condition they check is false. This is usually used to check the
// expressions containing sizeof()s which cannot be tested with the
// preprocessor. If you can use the #if's, do use them as you can give a more
// detailed error message then.
// ----------------------------------------------------------------------------
/*
How this works (you don't have to understand it to be able to use the
@ -263,13 +404,31 @@
It may be used both within a function and in the global scope.
*/
#if defined(__WATCOMC__) && defined(__cplusplus)
#if defined(__WATCOMC__)
/* avoid "unused symbol" warning */
#define wxCOMPILE_TIME_ASSERT(expr, msg) \
class wxMAKE_UNIQUE_ASSERT_NAME { \
unsigned int msg: expr; \
wxMAKE_UNIQUE_ASSERT_NAME() { wxUnusedVar(msg); } \
}
#elif defined( __VMS )
namespace wxdebug{
// HP aCC cannot deal with missing names for template value parameters
template <bool x> struct STATIC_ASSERTION_FAILURE;
template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
// HP aCC cannot deal with missing names for template value parameters
template<int x> struct static_assert_test{};
}
#define WX_JOIN( X, Y ) X##Y
#define WX_STATIC_ASSERT_BOOL_CAST(x) (bool)(x)
#define wxCOMPILE_TIME_ASSERT(expr, msg) \
typedef ::wxdebug::static_assert_test<\
sizeof(::wxdebug::STATIC_ASSERTION_FAILURE< WX_STATIC_ASSERT_BOOL_CAST( expr ) >)>\
WX_JOIN(wx_static_assert_typedef_, __LINE__)
#else
#define wxCOMPILE_TIME_ASSERT(expr, msg) \
struct wxMAKE_UNIQUE_ASSERT_NAME { unsigned int msg: expr; }
@ -285,32 +444,53 @@
#define wxCOMPILE_TIME_ASSERT2(expr, msg, text) \
struct wxMAKE_UNIQUE_ASSERT_NAME2(text) { unsigned int msg: expr; }
/* helpers for wxCOMPILE_TIME_ASSERT below, for private use only */
// helpers for wxCOMPILE_TIME_ASSERT below, for private use only
#define wxMAKE_BITSIZE_MSG(type, size) type ## SmallerThan ## size ## Bits
/* a special case of compile time assert: check that the size of the given type */
/* is at least the given number of bits */
// a special case of compile time assert: check that the size of the given type
// is at least the given number of bits
#define wxASSERT_MIN_BITSIZE(type, size) \
wxCOMPILE_TIME_ASSERT(sizeof(type) * CHAR_BIT >= size, \
wxMAKE_BITSIZE_MSG(type, size))
/* ---------------------------------------------------------------------------- */
/* other miscellaneous debugger-related functions */
/* ---------------------------------------------------------------------------- */
// ----------------------------------------------------------------------------
// other miscellaneous debugger-related functions
// ----------------------------------------------------------------------------
/*
Return true if we're running under debugger.
Currently this only really works under Win32 and Mac in CodeWarrior builds,
it always returns false in other cases.
Currently only really works under Win32 and just returns false elsewhere.
*/
#ifdef __cplusplus
/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
#if defined(__WXMAC__) || defined(__WIN32__)
extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning();
#else /* !Mac */
inline bool wxIsDebuggerRunning() { return false; }
#endif /* Mac/!Mac */
#endif /* __cplusplus */
#if defined(__WIN32__)
extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning();
#else // !Mac
inline bool wxIsDebuggerRunning() { return false; }
#endif // Mac/!Mac
#endif /* _WX_DEBUG_H_ */
// An assert helper used to avoid warning when testing constant expressions,
// i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about
// expression being always true, but not using
// wxASSERT( wxAssertIsEqual(sizeof(int), 4) )
//
// NB: this is made obsolete by wxCOMPILE_TIME_ASSERT() and should no
// longer be used.
extern bool WXDLLIMPEXP_BASE wxAssertIsEqual(int x, int y);
// Use of wxFalse instead of false suppresses compiler warnings about testing
// constant expression
extern WXDLLIMPEXP_DATA_BASE(const bool) wxFalse;
#define wxAssertFailure wxFalse
// This is similar to WXUNUSED() and useful for parameters which are only used
// in assertions.
#if wxDEBUG_LEVEL
#define WXUNUSED_UNLESS_DEBUG(param) param
#else
#define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param)
#endif
#endif // _WX_DEBUG_H_

View File

@ -0,0 +1,247 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/debugrpt.h
// Purpose: declaration of wxDebugReport class
// Author: Vadim Zeitlin
// Created: 2005-01-17
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DEBUGRPT_H_
#define _WX_DEBUGRPT_H_
#include "wx/defs.h"
#if wxUSE_DEBUGREPORT && wxUSE_XML
#include "wx/string.h"
#include "wx/arrstr.h"
class WXDLLIMPEXP_FWD_XML wxXmlNode;
// ----------------------------------------------------------------------------
// wxDebugReport: generate a debug report, processing is done in derived class
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReport
{
public:
// this is used for the functions which may report either the current state
// or the state during the last (fatal) exception
enum Context { Context_Current, Context_Exception };
// ctor creates a temporary directory where we create the files which will
// be included in the report, use IsOk() to check for errors
wxDebugReport();
// dtor normally destroys the temporary directory created in the ctor (with
// all the files it contains), call Reset() to prevent this from happening
virtual ~wxDebugReport();
// return the name of the directory used for this report
const wxString& GetDirectory() const { return m_dir; }
// return true if the object was successfully initialized
bool IsOk() const { return !GetDirectory().empty(); }
// reset the directory name we use, the object can't be used any more after
// this as it becomes invalid/uninitialized
void Reset() { m_dir.clear(); }
// add another file to the report: the file must already exist, its name
// can be either absolute in which case it is copied to the debug report
// directory or relative to GetDirectory()
//
// description is shown to the user in the report summary
virtual void AddFile(const wxString& filename, const wxString& description);
// convenience function: write the given text to a file with the given name
// and then add it to the report (the difference with AddFile() is that the
// file will be created by this function and doesn't have to already exist)
bool AddText(const wxString& filename,
const wxString& text,
const wxString& description);
#if wxUSE_STACKWALKER
// add an XML file containing the current or exception context and the
// stack trace
bool AddCurrentContext() { return AddContext(Context_Current); }
bool AddExceptionContext() { return AddContext(Context_Exception); }
virtual bool AddContext(Context ctx);
#endif
#if wxUSE_CRASHREPORT
// add a file with crash report
bool AddCurrentDump() { return AddDump(Context_Current); }
bool AddExceptionDump() { return AddDump(Context_Exception); }
virtual bool AddDump(Context ctx);
#endif // wxUSE_CRASHREPORT
// add all available information to the report
void AddAll(Context context = Context_Exception);
// process this report: the base class simply notifies the user that the
// report has been generated, this is usually not enough -- instead you
// should override this method to do something more useful to you
bool Process();
// get the name used as base name for various files, by default
// wxApp::GetName()
virtual wxString GetReportName() const;
// get the files in this report
size_t GetFilesCount() const { return m_files.GetCount(); }
bool GetFile(size_t n, wxString *name, wxString *desc) const;
// remove the file from report: this is used by wxDebugReportPreview to
// allow the user to remove files potentially containing private
// information from the report
void RemoveFile(const wxString& name);
protected:
#if wxUSE_STACKWALKER
// used by AddContext()
virtual bool DoAddSystemInfo(wxXmlNode *nodeSystemInfo);
virtual bool DoAddLoadedModules(wxXmlNode *nodeModules);
virtual bool DoAddExceptionInfo(wxXmlNode *nodeContext);
virtual void DoAddCustomContext(wxXmlNode * WXUNUSED(nodeRoot)) { }
#endif
// used by Process()
virtual bool DoProcess();
private:
// name of the report directory
wxString m_dir;
// the arrays of files in this report and their descriptions
wxArrayString m_files,
m_descriptions;
};
#if wxUSE_ZIPSTREAM
// ----------------------------------------------------------------------------
// wxDebugReportCompress: compress all files of this debug report in a .ZIP
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReportCompress : public wxDebugReport
{
public:
wxDebugReportCompress() { }
// you can optionally specify the directory and/or name of the file where
// the debug report should be generated, a default location under the
// directory containing temporary files will be used if you don't
//
// both of these functions should be called before Process()ing the report
// if they're called at all
void SetCompressedFileDirectory(const wxString& dir);
void SetCompressedFileBaseName(const wxString& name);
// returns the full path of the compressed file (empty if creation failed)
const wxString& GetCompressedFileName() const { return m_zipfile; }
protected:
virtual bool DoProcess();
private:
// user-specified file directory/base name, use defaults if empty
wxString m_zipDir,
m_zipName;
// full path to the ZIP file we created
wxString m_zipfile;
};
// ----------------------------------------------------------------------------
// wxDebugReportUploader: uploads compressed file using HTTP POST request
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReportUpload : public wxDebugReportCompress
{
public:
// this class will upload the compressed file created by its base class to
// an HTML multipart/form-data form at the specified address
//
// the URL is the base address, input is the name of the "type=file"
// control on the form used for the file name and action is the value of
// the form action field
wxDebugReportUpload(const wxString& url,
const wxString& input,
const wxString& action,
const wxString& curl = wxT("curl"));
protected:
virtual bool DoProcess();
// this function may be overridden in a derived class to show the output
// from curl: this may be an HTML page or anything else that the server
// returned
//
// return value becomes the return value of Process()
virtual bool OnServerReply(const wxArrayString& WXUNUSED(reply))
{
return true;
}
private:
// the full URL to use with HTTP POST request
wxString m_uploadURL;
// the name of the input field containing the file name in the form at
// above URL
wxString m_inputField;
// the curl command (by default it is just "curl" but could be full path to
// curl or a wrapper script with curl-compatible syntax)
wxString m_curlCmd;
};
#endif // wxUSE_ZIPSTREAM
// ----------------------------------------------------------------------------
// wxDebugReportPreview: presents the debug report to the user and allows him
// to veto report entirely or remove some parts of it
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReportPreview
{
public:
// ctor is trivial
wxDebugReportPreview() { }
// present the report to the user and allow him to modify it by removing
// some or all of the files and, potentially, adding some notes
//
// return true if the report should be processed or false if the user chose
// to cancel report generation or removed all files from it
virtual bool Show(wxDebugReport& dbgrpt) const = 0;
// dtor is trivial as well but should be virtual for a base class
virtual ~wxDebugReportPreview() { }
};
#if wxUSE_GUI
// ----------------------------------------------------------------------------
// wxDebugReportPreviewStd: standard debug report preview window
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReportPreviewStd : public wxDebugReportPreview
{
public:
wxDebugReportPreviewStd() { }
virtual bool Show(wxDebugReport& dbgrpt) const;
};
#endif // wxUSE_GUI
#endif // wxUSE_DEBUGREPORT && wxUSE_XML
#endif // _WX_DEBUGRPT_H_

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 29.06.99
// RCS-ID: $Id: dialog.h 49804 2007-11-10 01:09:42Z VZ $
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -12,14 +11,22 @@
#ifndef _WX_DIALOG_H_BASE_
#define _WX_DIALOG_H_BASE_
#include "wx/defs.h"
#include "wx/containr.h"
#include "wx/toplevel.h"
#include "wx/containr.h"
#include "wx/sharedptr.h"
class WXDLLIMPEXP_FWD_CORE wxSizer;
class WXDLLIMPEXP_FWD_CORE wxStdDialogButtonSizer;
class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
class WXDLLIMPEXP_FWD_CORE wxDialogLayoutAdapter;
class WXDLLIMPEXP_FWD_CORE wxDialog;
class WXDLLIMPEXP_FWD_CORE wxButton;
class WXDLLIMPEXP_FWD_CORE wxScrolledWindow;
class wxTextSizerWrapper;
#define wxDIALOG_NO_PARENT 0x0001 // Don't make owned by apps top window
// Also see the bit summary table in wx/toplevel.h.
#define wxDIALOG_NO_PARENT 0x00000020 // Don't make owned by apps top window
#ifdef __WXWINCE__
#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxNO_BORDER)
@ -27,25 +34,56 @@ class WXDLLIMPEXP_FWD_CORE wxStdDialogButtonSizer;
#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX)
#endif
extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[];
// Layout adaptation levels, for SetLayoutAdaptationLevel
class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow
// Don't do any layout adaptation
#define wxDIALOG_ADAPTATION_NONE 0
// Only look for wxStdDialogButtonSizer for non-scrolling part
#define wxDIALOG_ADAPTATION_STANDARD_SIZER 1
// Also look for any suitable sizer for non-scrolling part
#define wxDIALOG_ADAPTATION_ANY_SIZER 2
// Also look for 'loose' standard buttons for non-scrolling part
#define wxDIALOG_ADAPTATION_LOOSE_BUTTONS 3
// Layout adaptation mode, for SetLayoutAdaptationMode
enum wxDialogLayoutAdaptationMode
{
wxDIALOG_ADAPTATION_MODE_DEFAULT = 0, // use global adaptation enabled status
wxDIALOG_ADAPTATION_MODE_ENABLED = 1, // enable this dialog overriding global status
wxDIALOG_ADAPTATION_MODE_DISABLED = 2 // disable this dialog overriding global status
};
enum wxDialogModality
{
wxDIALOG_MODALITY_NONE = 0,
wxDIALOG_MODALITY_WINDOW_MODAL = 1,
wxDIALOG_MODALITY_APP_MODAL = 2
};
extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[];
class WXDLLIMPEXP_CORE wxDialogBase : public wxNavigationEnabled<wxTopLevelWindow>
{
public:
enum
{
// all flags allowed in wxDialogBase::CreateButtonSizer()
ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT
};
wxDialogBase() { Init(); }
wxDialogBase();
virtual ~wxDialogBase() { }
// define public wxDialog methods to be implemented by the derived classes
virtual int ShowModal() = 0;
virtual void EndModal(int retCode) = 0;
virtual bool IsModal() const = 0;
// show the dialog frame-modally (needs a parent), using app-modal
// dialogs on platforms that don't support it
virtual void ShowWindowModal () ;
virtual void SendWindowModalDialogEvent ( wxEventType type );
#ifdef wxHAS_EVENT_BIND
template<typename Functor>
void ShowWindowModalThenDo(const Functor& onEndModal);
#endif // wxHAS_EVENT_BIND
// Modal dialogs have a return code - usually the id of the last
// pressed button
@ -64,10 +102,33 @@ public:
void SetEscapeId(int escapeId);
int GetEscapeId() const { return m_escapeId; }
// Find the parent to use for modal dialog: try to use the specified parent
// but fall back to the current active window or main application window as
// last resort if it is unsuitable.
//
// As this function is often called from the ctor, the window style may be
// not set yet and hence must be passed explicitly to it so that we could
// check whether it contains wxDIALOG_NO_PARENT bit.
//
// This function always returns a valid top level window or NULL.
wxWindow *GetParentForModalDialog(wxWindow *parent, long style) const;
// This overload can only be used for already initialized windows, i.e. not
// from the ctor. It uses the current window parent and style.
wxWindow *GetParentForModalDialog() const
{
return GetParentForModalDialog(GetParent(), GetWindowStyle());
}
#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL
// splits text up at newlines and places the
// lines into a vertical wxBoxSizer
wxSizer *CreateTextSizer( const wxString &message );
// splits text up at newlines and places the lines into a vertical
// wxBoxSizer
wxSizer *CreateTextSizer( const wxString& message );
// same as above but uses a customized wxTextSizerWrapper to create
// non-standard controls for the lines
wxSizer *CreateTextSizer( const wxString& message,
wxTextSizerWrapper& wrapper );
#endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL
// returns a horizontal wxBoxSizer containing the given buttons
@ -77,15 +138,64 @@ public:
// platforms which have hardware buttons replacing OK/Cancel and such)
wxSizer *CreateButtonSizer(long flags);
// returns a sizer containing the given one and a static line separating it
// from the preceding elements if it's appropriate for the current platform
wxSizer *CreateSeparatedSizer(wxSizer *sizer);
// returns the sizer containing CreateButtonSizer() below a separating
// static line for the platforms which use static lines for items
// separation (i.e. not Mac)
//
// this is just a combination of CreateButtonSizer() and
// CreateSeparatedSizer()
wxSizer *CreateSeparatedButtonSizer(long flags);
#if wxUSE_BUTTON
wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags );
#endif // wxUSE_BUTTON
// Do layout adaptation
virtual bool DoLayoutAdaptation();
// Can we do layout adaptation?
virtual bool CanDoLayoutAdaptation();
// Returns a content window if there is one. This can be used by the layout adapter, for
// example to make the pages of a book control into scrolling windows
virtual wxWindow* GetContentWindow() const { return NULL; }
// Add an id to the list of main button identifiers that should be in the button sizer
void AddMainButtonId(wxWindowID id) { m_mainButtonIds.Add((int) id); }
wxArrayInt& GetMainButtonIds() { return m_mainButtonIds; }
// Is this id in the main button id array?
bool IsMainButtonId(wxWindowID id) const { return (m_mainButtonIds.Index((int) id) != wxNOT_FOUND); }
// Level of adaptation, from none (Level 0) to full (Level 3). To disable adaptation,
// set level 0, for example in your dialog constructor. You might
// do this if you know that you are displaying on a large screen and you don't want the
// dialog changed.
void SetLayoutAdaptationLevel(int level) { m_layoutAdaptationLevel = level; }
int GetLayoutAdaptationLevel() const { return m_layoutAdaptationLevel; }
/// Override global adaptation enabled/disabled status
void SetLayoutAdaptationMode(wxDialogLayoutAdaptationMode mode) { m_layoutAdaptationMode = mode; }
wxDialogLayoutAdaptationMode GetLayoutAdaptationMode() const { return m_layoutAdaptationMode; }
// Returns true if the adaptation has been done
void SetLayoutAdaptationDone(bool adaptationDone) { m_layoutAdaptationDone = adaptationDone; }
bool GetLayoutAdaptationDone() const { return m_layoutAdaptationDone; }
// Set layout adapter class, returning old adapter
static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter);
static wxDialogLayoutAdapter* GetLayoutAdapter() { return sm_layoutAdapter; }
// Global switch for layout adaptation
static bool IsLayoutAdaptationEnabled() { return sm_layoutAdaptation; }
static void EnableLayoutAdaptation(bool enable) { sm_layoutAdaptation = enable; }
// modality kind
virtual wxDialogModality GetModality() const;
protected:
// emulate click of a button with the given id if it's present in the dialog
//
@ -108,7 +218,6 @@ protected:
// wxID_OK return code
void AcceptAndClose();
// The return code from modal dialog
int m_returnCode;
@ -118,9 +227,36 @@ protected:
// The identifier for cancel button (usually wxID_CANCEL)
int m_escapeId;
// Flags whether layout adaptation has been done for this dialog
bool m_layoutAdaptationDone;
// Extra button identifiers to be taken as 'main' button identifiers
// to be placed in the non-scrolling area
wxArrayInt m_mainButtonIds;
// Adaptation level
int m_layoutAdaptationLevel;
// Local override for global adaptation enabled status
wxDialogLayoutAdaptationMode m_layoutAdaptationMode;
// Global layout adapter
static wxDialogLayoutAdapter* sm_layoutAdapter;
// Global adaptation switch
static bool sm_layoutAdaptation;
private:
// common part of all ctors
void Init();
// helper of GetParentForModalDialog(): returns the passed in window if it
// can be used as our parent or NULL if it can't
wxWindow *CheckIfCanBeUsedAsParent(wxWindow *parent) const;
// Helper of OnCharHook() and OnCloseWindow(): find the appropriate button
// for closing the dialog and send a click event for it.
//
// Return true if we found a button to close the dialog and "clicked" it or
// false otherwise.
bool SendCloseButtonClickEvent();
// handle Esc key presses
void OnCharHook(wxKeyEvent& event);
@ -135,18 +271,88 @@ private:
void OnSysColourChanged(wxSysColourChangedEvent& event);
DECLARE_NO_COPY_CLASS(wxDialogBase)
wxDECLARE_NO_COPY_CLASS(wxDialogBase);
DECLARE_EVENT_TABLE()
WX_DECLARE_CONTROL_CONTAINER();
};
/*!
* Base class for layout adapters - code that, for example, turns a dialog into a
* scrolling dialog if there isn't enough screen space. You can derive further
* adapter classes to do any other kind of adaptation, such as applying a watermark, or adding
* a help mechanism.
*/
class WXDLLIMPEXP_CORE wxDialogLayoutAdapter: public wxObject
{
DECLARE_CLASS(wxDialogLayoutAdapter)
public:
wxDialogLayoutAdapter() {}
// Override this function to indicate that adaptation should be done
virtual bool CanDoLayoutAdaptation(wxDialog* dialog) = 0;
// Override this function to do the adaptation
virtual bool DoLayoutAdaptation(wxDialog* dialog) = 0;
};
/*!
* Standard adapter. Does scrolling adaptation for paged and regular dialogs.
*
*/
class WXDLLIMPEXP_CORE wxStandardDialogLayoutAdapter: public wxDialogLayoutAdapter
{
DECLARE_CLASS(wxStandardDialogLayoutAdapter)
public:
wxStandardDialogLayoutAdapter() {}
// Overrides
// Indicate that adaptation should be done
virtual bool CanDoLayoutAdaptation(wxDialog* dialog);
// Do layout adaptation
virtual bool DoLayoutAdaptation(wxDialog* dialog);
// Implementation
// Create the scrolled window
virtual wxScrolledWindow* CreateScrolledWindow(wxWindow* parent);
#if wxUSE_BUTTON
// Find a standard or horizontal box sizer
virtual wxSizer* FindButtonSizer(bool stdButtonSizer, wxDialog* dialog, wxSizer* sizer, int& retBorder, int accumlatedBorder = 0);
// Check if this sizer contains standard buttons, and so can be repositioned in the dialog
virtual bool IsOrdinaryButtonSizer(wxDialog* dialog, wxBoxSizer* sizer);
// Check if this is a standard button
virtual bool IsStandardButton(wxDialog* dialog, wxButton* button);
// Find 'loose' main buttons in the existing layout and add them to the standard dialog sizer
virtual bool FindLooseButtons(wxDialog* dialog, wxStdDialogButtonSizer* buttonSizer, wxSizer* sizer, int& count);
#endif // wxUSE_BUTTON
// Reparent the controls to the scrolled window, except those in buttonSizer
virtual void ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL);
static void DoReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL);
// A function to fit the dialog around its contents, and then adjust for screen size.
// If scrolled windows are passed, scrolling is enabled in the required orientation(s).
virtual bool FitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow);
virtual bool FitWithScrolling(wxDialog* dialog, wxWindowList& windows);
static bool DoFitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow);
static bool DoFitWithScrolling(wxDialog* dialog, wxWindowList& windows);
// Find whether scrolling will be necessary for the dialog, returning wxVERTICAL, wxHORIZONTAL or both
virtual int MustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize);
static int DoMustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize);
};
#if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__)
#include "wx/univ/dialog.h"
#else
#if defined(__WXPALMOS__)
#include "wx/palmos/dialog.h"
#elif defined(__WXMSW__)
#if defined(__WXMSW__)
#include "wx/msw/dialog.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/dialog.h"
@ -155,7 +361,7 @@ private:
#elif defined(__WXGTK__)
#include "wx/gtk1/dialog.h"
#elif defined(__WXMAC__)
#include "wx/mac/dialog.h"
#include "wx/osx/dialog.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dialog.h"
#elif defined(__WXPM__)
@ -163,5 +369,73 @@ private:
#endif
#endif
class WXDLLIMPEXP_CORE wxWindowModalDialogEvent : public wxCommandEvent
{
public:
wxWindowModalDialogEvent (wxEventType commandType = wxEVT_NULL, int id = 0)
: wxCommandEvent(commandType, id) { }
wxDialog *GetDialog() const
{ return wxStaticCast(GetEventObject(), wxDialog); }
int GetReturnCode() const
{ return GetDialog()->GetReturnCode(); }
virtual wxEvent *Clone() const { return new wxWindowModalDialogEvent (*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowModalDialogEvent )
};
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_WINDOW_MODAL_DIALOG_CLOSED , wxWindowModalDialogEvent );
typedef void (wxEvtHandler::*wxWindowModalDialogEventFunction)(wxWindowModalDialogEvent &);
#define wxWindowModalDialogEventHandler(func) \
wxEVENT_HANDLER_CAST(wxWindowModalDialogEventFunction, func)
#define EVT_WINDOW_MODAL_DIALOG_CLOSED(winid, func) \
wx__DECLARE_EVT1(wxEVT_WINDOW_MODAL_DIALOG_CLOSED, winid, wxWindowModalDialogEventHandler(func))
#ifdef wxHAS_EVENT_BIND
template<typename Functor>
class wxWindowModalDialogEventFunctor
{
public:
wxWindowModalDialogEventFunctor(const Functor& f)
: m_f(new Functor(f))
{}
void operator()(wxWindowModalDialogEvent& event)
{
if ( m_f )
{
// We only want to call this handler once. Also, by deleting
// the functor here, its data (such as wxWindowPtr pointing to
// the dialog) are freed immediately after exiting this operator().
wxSharedPtr<Functor> functor(m_f);
m_f.reset();
(*functor)(event.GetReturnCode());
}
else // was already called once
{
event.Skip();
}
}
private:
wxSharedPtr<Functor> m_f;
};
template<typename Functor>
void wxDialogBase::ShowWindowModalThenDo(const Functor& onEndModal)
{
Bind(wxEVT_WINDOW_MODAL_DIALOG_CLOSED,
wxWindowModalDialogEventFunctor<Functor>(onEndModal));
ShowWindowModal();
}
#endif // wxHAS_EVENT_BIND
#endif
// _WX_DIALOG_H_BASE_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 07.07.99
// RCS-ID: $Id: dialup.h 49804 2007-11-10 01:09:42Z VZ $
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -43,7 +42,7 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString;
* main thread?
*/
class WXDLLEXPORT wxDialUpManager
class WXDLLIMPEXP_CORE wxDialUpManager
{
public:
// this function should create and return the object of the
@ -152,13 +151,13 @@ public:
// wxDialUpManager events
// ----------------------------------------------------------------------------
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(wxEVT_DIALUP_CONNECTED, 450)
DECLARE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED, 451)
END_DECLARE_EVENT_TYPES()
class WXDLLIMPEXP_FWD_CORE wxDialUpEvent;
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIALUP_CONNECTED, wxDialUpEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIALUP_DISCONNECTED, wxDialUpEvent );
// the event class for the dialup events
class WXDLLEXPORT wxDialUpEvent : public wxEvent
class WXDLLIMPEXP_CORE wxDialUpEvent : public wxEvent
{
public:
wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent)
@ -171,7 +170,7 @@ public:
bool IsConnectedEvent() const
{ return GetEventType() == wxEVT_DIALUP_CONNECTED; }
// does this event come from wxDialUpManager::Dial() or from some extrenal
// does this event come from wxDialUpManager::Dial() or from some external
// process (i.e. does it result from our own attempt to establish the
// connection)?
bool IsOwnEvent() const { return m_id != 0; }
@ -180,14 +179,14 @@ public:
virtual wxEvent *Clone() const { return new wxDialUpEvent(*this); }
private:
DECLARE_NO_ASSIGN_CLASS(wxDialUpEvent)
wxDECLARE_NO_ASSIGN_CLASS(wxDialUpEvent);
};
// the type of dialup event handler function
typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&);
#define wxDialUpEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDialUpEventFunction, &func)
wxEVENT_HANDLER_CAST(wxDialUpEventFunction, func)
// macros to catch dialup events
#define EVT_DIALUP_CONNECTED(func) \

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 08.12.99
// RCS-ID: $Id: dir.h 53135 2008-04-12 02:31:04Z VZ $
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -14,6 +13,7 @@
#include "wx/longlong.h"
#include "wx/string.h"
#include "wx/filefn.h" // for wxS_DIR_DEFAULT
class WXDLLIMPEXP_FWD_BASE wxArrayString;
@ -21,14 +21,17 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString;
// constants
// ----------------------------------------------------------------------------
// these flags define what kind of filenames is included in the list of files
// enumerated by GetFirst/GetNext
enum
// These flags affect the behaviour of GetFirst/GetNext() and Traverse().
// They define what types are included in the list of items they produce.
// Note that wxDIR_NO_FOLLOW is relevant only on Unix and ignored under systems
// not supporting symbolic links.
enum wxDirFlags
{
wxDIR_FILES = 0x0001, // include files
wxDIR_DIRS = 0x0002, // include directories
wxDIR_HIDDEN = 0x0004, // include hidden files
wxDIR_DOTDOT = 0x0008, // include '.' and '..'
wxDIR_NO_FOLLOW = 0x0010, // don't dereference any symlink
// by default, enumerate everything except '.' and '..'
wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN
@ -63,7 +66,7 @@ public:
virtual wxDirTraverseResult OnDir(const wxString& dirname) = 0;
// called for each directory which we couldn't open during our traversal
// of the directory tyree
// of the directory tree
//
// this method can also return either wxDIR_STOP, wxDIR_IGNORE or
// wxDIR_CONTINUE but the latter is treated specially: it means to retry
@ -83,8 +86,6 @@ class WXDLLIMPEXP_FWD_BASE wxDirData;
class WXDLLIMPEXP_BASE wxDir
{
public:
// test for existence of a directory with the given name
static bool Exists(const wxString& dir);
// ctors
// -----
@ -95,18 +96,26 @@ public:
// opens the directory for enumeration, use IsOpened() to test success
wxDir(const wxString& dir);
// dtor cleans up the associated ressources
~wxDir();
// dtor calls Close() automatically
~wxDir() { Close(); }
// open the directory for enumerating
bool Open(const wxString& dir);
// close the directory, Open() can be called again later
void Close();
// returns true if the directory was successfully opened
bool IsOpened() const;
// get the full name of the directory (without '/' at the end)
wxString GetName() const;
// Same as GetName() but does include the trailing separator, unless the
// string is empty (only for invalid directories).
wxString GetNameWithSep() const;
// file enumeration routines
// -------------------------
@ -120,10 +129,10 @@ public:
bool GetNext(wxString *filename) const;
// return true if this directory has any files in it
bool HasFiles(const wxString& spec = wxEmptyString);
bool HasFiles(const wxString& spec = wxEmptyString) const;
// return true if this directory has any subdirectories
bool HasSubDirs(const wxString& spec = wxEmptyString);
bool HasSubDirs(const wxString& spec = wxEmptyString) const;
// enumerate all files in this directory and its subdirectories
//
@ -146,15 +155,31 @@ public:
const wxString& filespec,
int flags = wxDIR_DEFAULT);
#if wxUSE_LONGLONG
// returns the size of all directories recursively found in given path
static wxULongLong GetTotalSize(const wxString &dir, wxArrayString *filesSkipped = NULL);
#endif // wxUSE_LONGLONG
// static utilities for directory management
// (alias to wxFileName's functions for dirs)
// -----------------------------------------
// test for existence of a directory with the given name
static bool Exists(const wxString& dir);
static bool Make(const wxString &dir, int perm = wxS_DIR_DEFAULT,
int flags = 0);
static bool Remove(const wxString &dir, int flags = 0);
private:
friend class wxDirData;
wxDirData *m_data;
DECLARE_NO_COPY_CLASS(wxDir)
wxDECLARE_NO_COPY_CLASS(wxDir);
};
#endif // _WX_DIR_H_

View File

@ -0,0 +1,17 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/dirctrl.h
// Purpose: Directory control base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIRCTRL_H_BASE_
#define _WX_DIRCTRL_H_BASE_
#include "wx/generic/dirctrlg.h"
#endif
// _WX_DIRCTRL_H_BASE_

View File

@ -5,7 +5,6 @@
// Modified by:
// Created:
// Copyright: (c) Robert Roebling
// RCS-ID: $Id: dirdlg.h 44027 2006-12-21 19:26:48Z VZ $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -20,9 +19,9 @@
// constants
// ----------------------------------------------------------------------------
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[];
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[];
extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[];
#define wxDD_CHANGE_DIR 0x0100
#define wxDD_DIR_MUST_EXIST 0x0200
@ -40,7 +39,7 @@ extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[];
// wxDirDialogBase
//-------------------------------------------------------------------------
class WXDLLEXPORT wxDirDialogBase : public wxDialog
class WXDLLIMPEXP_CORE wxDirDialogBase : public wxDialog
{
public:
wxDirDialogBase() {}
@ -96,8 +95,7 @@ protected:
#if defined(__WXUNIVERSAL__)
#include "wx/generic/dirdlgg.h"
#define wxDirDialog wxGenericDirDialog
#elif defined(__WXMSW__) && (defined(__SALFORDC__) || \
!wxUSE_OLE || \
#elif defined(__WXMSW__) && (!wxUSE_OLE || \
(defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS))
#include "wx/generic/dirdlgg.h"
#define wxDirDialog wxGenericDirDialog
@ -106,18 +104,17 @@ protected:
#define wxDirDialog wxGenericDirDialog
#elif defined(__WXMSW__)
#include "wx/msw/dirdlg.h" // Native MSW
#elif defined(__WXGTK24__)
#elif defined(__WXGTK20__)
#include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
#elif defined(__WXGTK__)
#include "wx/generic/dirdlgg.h"
#define wxDirDialog wxGenericDirDialog
#elif defined(__WXMAC__)
#include "wx/mac/dirdlg.h" // Native Mac
#include "wx/osx/dirdlg.h" // Native Mac
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dirdlg.h" // Native Cocoa
#elif defined(__WXMOTIF__) || \
defined(__WXX11__) || \
defined(__WXMGL__) || \
defined(__WXCOCOA__) || \
defined(__WXPM__)
#include "wx/generic/dirdlgg.h" // Other ports use generic implementation
@ -128,7 +125,7 @@ protected:
// common ::wxDirSelector() function
// ----------------------------------------------------------------------------
WXDLLEXPORT wxString
WXDLLIMPEXP_CORE wxString
wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,

View File

@ -3,7 +3,6 @@
// Purpose: wxDisplay class
// Author: Royce Mitchell III, Vadim Zeitlin
// Created: 06/21/02
// RCS-ID: $Id: display.h 49804 2007-11-10 01:09:42Z VZ $
// Copyright: (c) 2002-2006 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -22,7 +21,7 @@
WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
// default, uninitialized, video mode object
extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode;
extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode) wxDefaultVideoMode;
#endif // wxUSE_DISPLAY
class WXDLLIMPEXP_FWD_CORE wxWindow;
@ -37,7 +36,7 @@ class WXDLLIMPEXP_FWD_CORE wxDisplayImpl;
// wxDisplay: represents a display/monitor attached to the system
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxDisplay
class WXDLLIMPEXP_CORE wxDisplay
{
public:
// initialize the object containing all information about the given
@ -62,7 +61,7 @@ public:
// find the display where the given window lies, return wxNOT_FOUND if it
// is not shown at all
static int GetFromWindow(wxWindow *window);
static int GetFromWindow(const wxWindow *window);
// return true if the object was initialized successfully
@ -122,7 +121,7 @@ private:
wxDisplayImpl *m_impl;
DECLARE_NO_COPY_CLASS(wxDisplay)
wxDECLARE_NO_COPY_CLASS(wxDisplay);
};
#endif // _WX_DISPLAY_H_BASE_

Some files were not shown because too many files have changed in this diff Show More